Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1920 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer

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

Auteur

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 antwoord

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
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
3
apr. 23
11324
1
apr. 23
14267
9
dec. 23
23655
1
mei 20
6135
1
mei 19
2685