콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2196 화면

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.



아바타
취소
베스트 답변

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!

아바타
취소

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

작성자

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?

베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
3
4월 23
11680
1
4월 23
14696
9
12월 23
23982
1
5월 20
6421
1
5월 19
2921