Skip to content
Snippets Groups Projects
Commit ff53bdfb authored by Xavier Morel's avatar Xavier Morel
Browse files

[FIX] l10n_latam_invoice_document: check of account_move type


The `type` field was renamed `move_type` in
d675dbaa but a forward-port re-added a
use of the old `type` name, which breaks if an account.move is
unlinked while l10n_latam_invoice_document is unlinked (and there are
related moves to update).

Instead of renaming the field, use the proper utility method for the
category (purchase) provided by account.move.

closes odoo/odoo#47301

Signed-off-by: default avatarXavier Morel (xmo) <xmo@odoo.com>
parent db6a018c
No related branches found
No related tags found
No related merge requests found
......@@ -179,5 +179,5 @@ class AccountMove(models.Model):
def unlink(self):
""" When using documents, on vendor bills the document_number is set manually by the number given from the vendor,
the odoo sequence is not used. In this case We allow to delete vendor bills with document_number/move_name """
self.filtered(lambda x: x.type in x.get_purchase_types() and x.state in ('draft', 'cancel') and x.l10n_latam_use_documents).write({'name': '/'})
self.filtered(lambda x: x.is_purchase_document() and x.state in ('draft', 'cancel') and x.l10n_latam_use_documents).write({'name': '/'})
return super().unlink()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment