summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
Diffstat (limited to 'addons')
-rw-r--r--addons/l10n_ar/models/account_move.py13
-rw-r--r--addons/l10n_latam_invoice_document/models/account_move.py3
2 files changed, 14 insertions, 2 deletions
diff --git a/addons/l10n_ar/models/account_move.py b/addons/l10n_ar/models/account_move.py
index 32e870c9b5f..74b72d5136f 100644
--- a/addons/l10n_ar/models/account_move.py
+++ b/addons/l10n_ar/models/account_move.py
@@ -42,6 +42,19 @@ class AccountMove(models.Model):
if not_invoices:
raise ValidationError(_("The selected Journal can't be used in this transaction, please select one that doesn't use documents as these are just for Invoices."))
+ @api.constrains('move_type', 'l10n_latam_document_type_id')
+ def _check_invoice_type_document_type(self):
+ """ LATAM module define that we are not able to use debit_note or invoice document types in an invoice refunds,
+ However for Argentinian Document Type's 99 (internal type = invoice) we are able to used in a refund invoices.
+
+ In this method we exclude the argentinian document type 99 from the generic constraint """
+ ar_doctype_99 = self.filtered(
+ lambda x: x.l10n_latam_country_code == 'AR' and
+ x.l10n_latam_document_type_id.code == '99' and
+ x.move_type in ['out_refund', 'in_refund'])
+
+ super(AccountMove, self - ar_doctype_99)._check_invoice_type_document_type()
+
def _get_afip_invoice_concepts(self):
""" Return the list of values of the selection field. """
return [('1', 'Products / Definitive export of goods'), ('2', 'Services'), ('3', 'Products and Services'),
diff --git a/addons/l10n_latam_invoice_document/models/account_move.py b/addons/l10n_latam_invoice_document/models/account_move.py
index cccd09cc812..52e4aef66a2 100644
--- a/addons/l10n_latam_invoice_document/models/account_move.py
+++ b/addons/l10n_latam_invoice_document/models/account_move.py
@@ -192,8 +192,7 @@ class AccountMove(models.Model):
for rec in self.filtered('l10n_latam_document_type_id.internal_type'):
internal_type = rec.l10n_latam_document_type_id.internal_type
invoice_type = rec.move_type
- if internal_type in ['debit_note', 'invoice'] and invoice_type in ['out_refund', 'in_refund'] and \
- rec.l10n_latam_document_type_id.code != '99':
+ if internal_type in ['debit_note', 'invoice'] and invoice_type in ['out_refund', 'in_refund']:
raise ValidationError(_('You can not use a %s document type with a refund invoice', internal_type))
elif internal_type == 'credit_note' and invoice_type in ['out_invoice', 'in_invoice']:
raise ValidationError(_('You can not use a %s document type with a invoice', internal_type))