Skip to content

Commit

Permalink
Fix bug OCA#16 : add support for adjustment lines (per line and global)
Browse files Browse the repository at this point in the history
Add support for Tax Due Date on invoice import
  • Loading branch information
alexis-via authored and nguyenminhchien committed Feb 20, 2024
1 parent 1fda43d commit d3a21fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions base_business_document_import/models/business_document_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ def _match_tax(
'amount': 20.0, # required
'unece_type_code': 'VAT',
'unece_categ_code': 'S',
'unece_due_date_code': '432',
}
With l10n_fr, it will return 20% VAT tax.
"""
ato = self.env['account.tax']
self._strip_cleanup_dict(tax_dict)
Expand All @@ -513,7 +513,7 @@ def _match_tax(
domain.append(('price_include', '=', False))
elif price_include is True:
domain.append(('price_include', '=', True))
# with the code abose, if you set price_include=None, it will
# with the code above, if you set price_include=None, it will
# won't depend on the value of the price_include parameter
assert tax_dict.get('amount_type') in ['fixed', 'percent'],\
'bad tax type'
Expand All @@ -525,7 +525,12 @@ def _match_tax(
if tax_dict.get('unece_categ_code'):
domain.append(
('unece_categ_code', '=', tax_dict['unece_categ_code']))
taxes = ato.search(domain)
if tax_dict.get('unece_due_date_code'):
domain += [
'|',
('unece_due_date_code', '=', tax_dict['unece_due_date_code']),
('unece_due_date_code', '=', False)]
taxes = ato.search(domain, order='unece_due_date_code')
for tax in taxes:
tax_amount = tax.amount
if not float_compare(
Expand Down

0 comments on commit d3a21fb

Please sign in to comment.