Skip to content

Commit 5cfe918

Browse files
committed
l10n_it_split_payment: fix check_balanced
1 parent 54336a2 commit 5cfe918

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

l10n_it_split_payment/models/account_move.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,19 @@ def _compute_amount(self):
4242
return res
4343

4444
def write(self, vals):
45+
if self.env.context.get("skip_split_payment_computation"):
46+
return super(AccountMove, self).write(vals)
4547
res = super(AccountMove, self.with_context(check_move_validity=False)).write(
4648
vals
4749
)
48-
if self.env.context.get("skip_split_payment_computation"):
49-
return res
5050
if "fiscal_position_id" in vals:
5151
self._compute_amount()
5252
self.with_context(
5353
skip_split_payment_computation=True, check_move_validity=False
5454
).compute_split_payment()
5555
container = {"records": self}
56-
self._check_balanced(container)
56+
with self._check_balanced(container):
57+
pass
5758
return res
5859

5960
def copy(self, default=None):

l10n_it_split_payment/models/account_move_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class AccountMoveLine(models.Model):
1717
def _compute_is_split_payment(self):
1818
for line in self:
1919
line.is_split_payment = False
20-
if line.account_id == line.company_id.sp_account_id:
20+
if line.account_id and line.account_id == line.company_id.sp_account_id:
2121
line.is_split_payment = True
2222

2323
def _compute_all_tax(self):

0 commit comments

Comments
 (0)