[FIX] account_facturx: do not write non-existing fields

If a field does not exist, writing it creates a warning in the logs.
This would for example prevent a valid test to pass.
This is needed because extract_state is a field from account_invoice_extract,
which is not a dependency of account_facturx.

X-original-commit: bb03b05df39097a954388ba6b00c025989351f16
This commit is contained in:
Nans Lefebvre
2019-10-10 14:28:08 +00:00
committed by fw-bot
parent 1ef89f0928
commit 381fa5abdd
@@ -329,4 +329,5 @@ class AccountMove(models.Model):
raise UserError(_('No decoder was found for the xml file: {}. The file is badly formatted, not supported or the decoder is not installed').format(attachment.name))
def _remove_ocr_option(self):
self.write({'extract_state': 'done'})
if 'extract_state' in self:
self.write({'extract_state': 'done'})