It should be noted that in Odoo 15 I don't have this issue.
When I want to update the attribute groups
in the XML I have the following error:
Field 'journal_id' used in context ({..... hes group(s) account.group_account_invoice,account.group_account_readonly.
I want to update the permission to see the field journal_id
in the account move form view. But when I install it the first time the module that is overriding the groups
attribute is working FINE, but when I tried to update the same module I have always the same issue, this brings inconsistency.
This is my current code:
<xpath expr="//header//button[@name='button_draft']" position="attributes">
<attribute name="groups">account.group_account_user</attribute>
</xpath>
View to override (Invoice form view)
<odoo>
<data>
<record model="ir.ui.view" id="inherit_account_move_form_view_for_sp_siat">
<field name="name">account.move.form: sp siat</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<!-- OVERRIDED -->
<xpath expr="//div[@name='journal_div']" position="after">
<field name="sp_siat_type_sector_document" string="Documento Electronico" force_save="1"/>
</xpath>
<xpath expr="//header//button[@name='button_draft']" position="attributes">
<attribute name="groups">account.group_account_user</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
---
The only statement of the journal_id that is using the context is the following:
```XML
<label for="journal_id" groups="account.group_account_readonly" invisible="context.get('default_journal_id') and context.get('move_type', 'entry') != 'entry'"/>
<div name="journal_div" class="d-flex" invisible="context.get('default_journal_id') and context.get('move_type', 'entry') != 'entry'">
<field name="journal_id" groups="account.group_account_readonly" options="{'no_create': True, 'no_open': True}" attrs="{'readonly': [('posted_before', '=', True)]}"/>
<span class="oe_inline o_form_label mx-3" groups="base.group_multi_currency" attrs="{'invisible': [('move_type', '=', 'entry')]}"> in </span>
<field name="currency_id" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')], 'invisible': [('move_type', '=', 'entry')]}"/>
</div>