Skip to content

Commit

Permalink
FIX l10n_it_reverse_charge RC payment move should be posted (OCA#559)
Browse files Browse the repository at this point in the history
  • Loading branch information
eLBati authored and are-agilebg committed Apr 28, 2023
1 parent 9bc5173 commit 5da70c8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion l10n_it_reverse_charge/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

{
'name': 'Reverse Charge IVA',
'version': '10.0.1.1.1',
'version': '10.0.1.1.2',
'category': 'Localization/Italy',
'summary': 'Reverse Charge for Italy',
'author': 'Odoo Italia Network,Odoo Community Association (OCA)',
Expand Down
2 changes: 2 additions & 0 deletions l10n_it_reverse_charge/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def reconcile_supplier_invoice(self):
payment_debit_line = move_line
elif move_line.credit:
payment_credit_line = move_line
rc_payment.post()

lines_to_rec = move_line_model.browse([
self.get_inv_line_to_reconcile().id,
Expand Down Expand Up @@ -239,6 +240,7 @@ def reconcile_rc_invoice(self, rc_payment):
(0, 0, rc_payment_debit_line_data),
(0, 0, rc_payment_credit_line_data),
]
rc_payment.post()
inv_line_to_reconcile = self.get_rc_inv_line_to_reconcile(rc_invoice)
for move_line in rc_payment.line_ids:
if move_line.account_id.id == inv_line_to_reconcile.account_id.id:
Expand Down
6 changes: 6 additions & 0 deletions l10n_it_reverse_charge/tests/test_rc.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def test_intra_EU(self):
invoice.action_invoice_open()
self.assertIsNot(bool(invoice.rc_self_invoice_id), False)
self.assertEqual(invoice.rc_self_invoice_id.state, 'paid')
self.assertEqual(
invoice.rc_self_invoice_id.payment_move_line_ids.move_id.state,
'posted')

def test_extra_EU(self):
supplier_extraEU = self.partner_model.create({
Expand Down Expand Up @@ -240,6 +243,9 @@ def test_extra_EU(self):
invoice.action_invoice_open()
self.assertIsNot(bool(invoice.rc_self_purchase_invoice_id), False)
self.assertEqual(invoice.rc_self_purchase_invoice_id.state, 'paid')
self.assertEqual(
invoice.rc_self_purchase_invoice_id.payment_move_line_ids.
move_id.state, 'posted')

def test_intra_EU_cancel_and_draft(self):
supplier_intraEU = self.partner_model.create({
Expand Down

0 comments on commit 5da70c8

Please sign in to comment.