Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
2542 Lượt xem

I create a model named 'task.budget' and then in another module used the tier_validation as follows:

classTaskBudget(models.Model):    _name ="task.budget"    _inherit =["task.budget","tier.validation"]    _state_from =["to_approve"]    _state_to =["approved"]    _tier_validation_manual_config =False@api.modeldef_get_under_validation_exceptions(self):        res =super(TaskBudget,self)._get_under_validation_exceptions()        res.append("route_id")

I coded by imitating the OCA purchase_request_tier_validation.

Here is the problem, I also have a model named task.task, it has a One2many field refers to the task.budget. And in the form view of task.task,I just show the budget as follows:

<fieldname="budget_ids"readonly='true'/>

But in the form view of task, once I click on the line of budget, it raises a error as above.

Error: Missing field string information for the field 'need_validation' from the 'task.budget' model
    at http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6684:258
    at traverse (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6679:200)
    at http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6679:242
    at _.each._.forEach (http://192.168.56.102:8269/web/assets/544-21bb36b/web.assets_common.min.js:63:404)
    at traverse (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6679:211)
    at processArch (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6683:180)
    at generateLegacyLoadViewsResult (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:6681:106)
    at http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:5710:447
    at async getFormViewInfo (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:3623:483)
    at async openRecord (http://192.168.56.102:8269/web/assets/1371-f84290c/web.assets_backend.min.js:3628:56)

It makes me quite confused, cause the need_validation is a field of tier_validation model, it doesn't make sense.Can anyone explain this to me, thank you.


Ảnh đại diện
Huỷ bỏ
Tác giả

It's not working.

Thans for your replying.

The way I refer to task.budget in task.task like this:

budget_ids = fields.One2many(

required=True,

string="budget details",

inverse_name='task_id',

comodel_name='task.budget',

domain=[('state','=','approved')],

)

Tác giả Câu trả lời hay nhất

I solved this by adding the fields in the view like this:

<fieldname="requested_by"position="after">

<fieldname="need_validation"invisible="1"/>

<fieldname="validated"invisible="1"/>

<fieldname="rejected"invisible="1"/>

<fieldname="can_review"invisible="1"/>

<fieldname="next_review"invisible="1"/>

<fieldname="review_ids"invisible="1"/>

field>

I use a One2many field infer to the purchase.request and installed the purchase request tier validation, it seems like the module I created does not know the fields that purchase.request inherits from tier.validation. So it needs to be shown in the tier validation form view.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi


Can you install/upgrade the module base_tier_validation, and check is this issue is resolved or not


Regards


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 6 24
7
1
thg 2 24
26
3
thg 2 20
16519
1
thg 7 19
3780
0
thg 9 17
6669