Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
1479 Ansichten

There is a field on stock_landed_cost that was defined as so

mrp_production_ids = fields.Many2many( 'mrp.production', string='Manufacturing order', copy=False, groups='stock.group_stock_manager')

I would like to remove the groups parameter or at least add "stock.group_stock_user" through the ui. In ir.model.field, the "groups" field is empty and I cannot even modify the field because it is a base field.



Avatar
Verwerfen
Beste Antwort

Hi Tony,

When the groups attribute is used in Python, it can only be overridden by a custom module.

You need to inherit the model and override the field mrp_production_ids on your model.  Be sure to give Users in that group permission to create stock.landed.cost and stock.landed.cost.lines and stock.valuation.layer records so Landed Cost records can be created.

or

You go to the menu Settings/Technical/Database Structure/Fields (Need active developer mode)

Search field mrp_production_ids and choose

Select the Access Rights Tab. You can edit the permission of field here

Hope to help you!

Avatar
Verwerfen

So if you have settings permission, try do it in the 2nd way. It’s done on UI

Autor

Hi thanks for the reply. Im on odoo online. I cannot modify base fields remember? So your second suggestion wont work unfortunately. Is there a way to inherit instead?

Beste Antwort

Hi,


Properties of base fields cannot be altered in this manner! You can only modify them through Python code, preferably through a custom addon!

You can inherit the model and alter the field like below. If you want to remove the group, you don't have to mention the groups attribute.

Use the below code in your custom module.

# -- coding: utf-8 --

from odoo import fields, models, api


class StockLandedCost(models.Model):

    _inherit = 'stock.landed.cost'


    mrp_production_ids = fields.Many2many(

        'mrp.production', string='Manufacturing order',

        copy=False, groups='stock.group_stock_user')


Hope it helps

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
3
Apr. 23
10905
1
Apr. 23
13444
9
Dez. 23
23136
1
Mai 20
5734
1
Mai 19
2368