[FIX] l10n_it_edi: downpayment document type selection fix
TD02 is the only document type in l10n_it_edi that requires the invoice to be a downpayment, but this doesn't mean that downpayments are limited to it. The condition has been adapted to allow downpayments to fall under the other document types cases. opw-3033403 closes odoo/odoo#104242 X-original-commit: 197dbf7a8d14b619d19ff5904eb07d53c1fd97d2 Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Paolo Gatti (pgi) <pgi@odoo.com>
This commit is contained in:
@@ -229,7 +229,7 @@ class AccountEdiFormat(models.Model):
|
||||
|
||||
def _l10n_it_document_type_mapping(self):
|
||||
return {
|
||||
'TD01': dict(move_types=['out_invoice'], import_type='in_invoice'),
|
||||
'TD01': dict(move_types=['out_invoice'], import_type='in_invoice', downpayment=False),
|
||||
'TD02': dict(move_types=['out_invoice'], import_type='in_invoice', downpayment=True),
|
||||
'TD04': dict(move_types=['out_refund'], import_type='in_refund'),
|
||||
'TD07': dict(move_types=['out_invoice'], import_type='in_invoice', simplified=True),
|
||||
@@ -251,7 +251,9 @@ class AccountEdiFormat(models.Model):
|
||||
info_partner_in_eu = infos.get('partner_in_eu', False)
|
||||
if all([
|
||||
invoice.move_type in infos.get('move_types', False),
|
||||
invoice._is_downpayment() == infos.get('downpayment', False),
|
||||
# Only check downpayment if the key is specified in the document_type_mapping entry
|
||||
# If it's not specified, the get() will return None and the condition will be True
|
||||
infos.get('downpayment') in (None, invoice._is_downpayment()),
|
||||
is_self_invoice == infos.get('self_invoice', False),
|
||||
is_simplified == infos.get('simplified', False),
|
||||
info_services_or_goods in ("both", services_or_goods),
|
||||
@@ -259,6 +261,7 @@ class AccountEdiFormat(models.Model):
|
||||
goods_in_italy == infos.get('goods_in_italy', False),
|
||||
]):
|
||||
return code
|
||||
|
||||
return None
|
||||
|
||||
def _l10n_it_is_simplified_document_type(self, document_type):
|
||||
|
||||
Reference in New Issue
Block a user