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

I'm migrating the OCA module hr_expense_invoice from 15 to 16, and am getting the following error when trying to install the migrated version:

Field 'reference' used in context ({'default_type': 'in_invoice','type': 'in_invoice','journal_type': 'purchase','default_ref': reference,'default_invoice_date': date,'default_line_ids': [{'product_id': product_id,'name': name,'price_unit': unit_amount,'quantity': quantity,'date': date,'account_id': account_id,'tax_ids': tax_ids, }], }) is restricted to the group(s) account.group_account_invoice,account.group_account_readonly,account.group_account_readonly.

Here is the line that is causing the error:


name="invoice_id"
context="{'default_type': 'in_invoice',
'type': 'in_invoice',
'journal_type': 'purchase',
'default_ref': reference,
'default_invoice_date': date,
'default_line_ids': [{'product_id': product_id,
'name': name,
'price_unit': unit_amount,
'quantity': quantity,
'date': date,
'account_id': account_id,
'tax_ids': tax_ids, }], }"
/>

This may be related to Odoo 16's PR to remove a node from a view if the user doesn't meet the group criteria.

I have tried to solve this by forcing the "reference" field to appear in the view by including the following immediately before the code above but it does not help:


Does anybody know how to fix this?

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

I found the issue: I was not properly forcing the "reference" field to appear in the view.

Incorrect:

Correct:

    

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

Hi,
reference field may be defined in the view with groups attribute specified into it, so in order to solve above issue, an extra field of reference with invisible="1" attribute has to be added to the same view.

Thanks

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

I cannot see the code in your Incorrect/Correct answers. Can you post it again please? This forum eats the code with the formatting

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 1 23
14507
1
thg 4 24
2584
0
thg 11 23
1098
0
thg 5 23
1828
2
thg 6 24
4021