[FIX] account_edi: allow attachment and error in same document
Allow having in an attachment as well as an error in the same document. This will allow to see the document that generates the error, and easy the process of debugging. closes odoo/odoo#60599 X-original-commit: 7313e9823fffcac747af633b9b1694aa661dfa1f Related: odoo/enterprise#14357 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
This commit is contained in:
@@ -80,11 +80,13 @@ class AccountEdiDocument(models.Model):
|
||||
move_result = edi_result.get(move, {})
|
||||
if move_result.get('attachment'):
|
||||
old_attachment = document.attachment_id
|
||||
document.write({
|
||||
values = {
|
||||
'attachment_id': move_result['attachment'].id,
|
||||
'state': 'sent',
|
||||
'error': False,
|
||||
})
|
||||
'error': move_result.get('error', False),
|
||||
}
|
||||
if not values.get('error'):
|
||||
values.update({'state': 'sent'})
|
||||
document.write(values)
|
||||
if not old_attachment.res_model or not old_attachment.res_id:
|
||||
attachments_to_unlink |= old_attachment
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user