Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
1602 Vistas

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
Descartar
Mejor respuesta

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
Descartar

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?

Mejor respuesta

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
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 23
10998
1
abr 23
13750
9
dic 23
23274
1
may 20
5841
1
may 19
2498