[IMP] account_edi: don't show Electronic Invoicing field on account.move view if no EDI require web-service
TASK ID: 2439258 closes odoo/odoo#64493 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
@@ -16,7 +16,7 @@ class AccountMove(models.Model):
|
||||
string="Electronic invoicing",
|
||||
store=True,
|
||||
compute='_compute_edi_state',
|
||||
help='The aggregated state of all the EDIs of this move')
|
||||
help='The aggregated state of all the EDIs with web-service of this move')
|
||||
edi_error_count = fields.Integer(
|
||||
compute='_compute_edi_error_count',
|
||||
help='How many EDIs are in error for this move ?')
|
||||
@@ -29,7 +29,7 @@ class AccountMove(models.Model):
|
||||
@api.depends('edi_document_ids.state')
|
||||
def _compute_edi_state(self):
|
||||
for move in self:
|
||||
all_states = set(move.edi_document_ids.mapped('state'))
|
||||
all_states = set(move.edi_document_ids.filtered(lambda d: d.edi_format_id._needs_web_services()).mapped('state'))
|
||||
if all_states == {'sent'}:
|
||||
move.edi_state = 'sent'
|
||||
elif all_states == {'cancelled'}:
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='journal_div']" position="after">
|
||||
<field name="edi_document_ids" invisible="1" />
|
||||
<field name="edi_state" invisible="1" />
|
||||
<field name="edi_state" attrs="{'invisible': ['|', ('edi_document_ids', '=', []), ('state', '=', 'draft')]}"/>
|
||||
<field name="edi_state" attrs="{'invisible': ['|', '|', ('edi_state', '=', False), ('edi_document_ids', '=', []), ('state', '=', 'draft')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@id='other_tab']" position="after">
|
||||
<page id="edi_documents" string="EDI Documents" groups="base.group_no_one" attrs="{'invisible': [('edi_document_ids', '=', [])]}">
|
||||
|
||||
@@ -31,8 +31,7 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='journal_id']" position="after">
|
||||
<field name="edi_document_ids" invisible="1" />
|
||||
<field name="edi_state" invisible="1" />
|
||||
<field name="edi_state" attrs="{'invisible': ['|', ('edi_document_ids', '=', []), ('state', '=', 'draft')]}"/>
|
||||
<field name="edi_state" attrs="{'invisible': ['|', '|', ('edi_state', '=', False), ('edi_document_ids', '=', []), ('state', '=', 'draft')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//group[@name='group3']" position="after">
|
||||
<group groups="base.group_no_one">
|
||||
|
||||
Reference in New Issue
Block a user