Skip to content

Commit

Permalink
temp rebasing PR 392 (5d063ff)
Browse files Browse the repository at this point in the history
  • Loading branch information
roboadhoc committed Sep 6, 2023
2 parents 7005cc1 + 5d063ff commit 25731a6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions account_withholding/models/account_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,20 @@ def _prepare_move_line_default_vals(self, write_off_line_vals=None):
if self.payment_method_code == 'withholding':
if self.payment_type == 'transfer':
raise UserError(_('You can not use withholdings on transfers!'))
rep_line = self._get_withholding_repartition_line()
res[0]['name'] = self.withholding_number or '/'
res[0]['account_id'] = rep_line.account_id.id
return res

@api.model
def _get_trigger_fields_to_synchronize(self):
res = super()._get_trigger_fields_to_synchronize()
return res + ('withholding_number', 'tax_withholding_id')

def _compute_outstanding_account_id(self):
withholding_payments = self.filtered(lambda x: x.payment_method_code == 'withholding')
for withholding_payment in withholding_payments:
account = False
if self.tax_withholding_id:
rep_line = withholding_payment._get_withholding_repartition_line()
account = rep_line.account_id.id
withholding_payment.outstanding_account_id = account
return super(AccountPayment, self - withholding_payments)._compute_outstanding_account_id()

0 comments on commit 25731a6

Please sign in to comment.