Skip to content

Commit

Permalink
[FIX] l10n_id_efaktur: payment terms blocking payment
Browse files Browse the repository at this point in the history
Setup indonesian invoicing
Create a payment term with payment in 30 days and 10% if paid before 2
days
Create an invoice with said payment term
Confirm and register payment

Operation will be blocked by error
"Cannot mix VAT subject and Non-VAT subject items in the same invoice
with this kode transaksi"

This occurs when creating the payment move. All the lines have
display_type set to 'product' (defualt value), so the system checks
consistency of kode transaksi as in an invoice

opw-3063052

closes odoo#107120

Signed-off-by: Josse Colpaert <jco@odoo.com>
  • Loading branch information
agr-odoo committed Dec 5, 2022
1 parent 70827a7 commit cbf9250
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions addons/l10n_id_efaktur/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ def _compute_need_kode_transaksi(self):
for move in self:
move.l10n_id_need_kode_transaksi = move.partner_id.l10n_id_pkp and not move.l10n_id_tax_number and move.move_type == 'out_invoice' and move.country_code == 'ID'

@api.constrains('l10n_id_kode_transaksi', 'line_ids')
@api.constrains('l10n_id_kode_transaksi', 'line_ids', 'partner_id')
def _constraint_kode_ppn(self):
ppn_tag = self.env.ref('l10n_id.ppn_tag')
for move in self.filtered(lambda m: m.l10n_id_kode_transaksi != '08'):
for move in self.filtered(lambda m: m.l10n_id_need_kode_transaksi and m.l10n_id_kode_transaksi != '08'):
if any(ppn_tag.id in line.tax_tag_ids.ids for line in move.line_ids if line.display_type == 'product') \
and any(ppn_tag.id not in line.tax_tag_ids.ids for line in move.line_ids if line.display_type == 'product'):
raise UserError(_('Cannot mix VAT subject and Non-VAT subject items in the same invoice with this kode transaksi.'))
for move in self.filtered(lambda m: m.l10n_id_kode_transaksi == '08'):
for move in self.filtered(lambda m: m.l10n_id_need_kode_transaksi and m.l10n_id_kode_transaksi == '08'):
if any(ppn_tag.id in line.tax_tag_ids.ids for line in move.line_ids if line.display_type == 'product'):
raise UserError('Kode transaksi 08 is only for non VAT subject items.')

Expand Down

0 comments on commit cbf9250

Please sign in to comment.