sale_down_payment: add a hook that can be used for notifications

This commit is contained in:
Alexis de Lattre
2021-05-27 23:08:17 +02:00
parent 592a82a417
commit dbbd14f58a
3 changed files with 16 additions and 1 deletions

View File

@@ -25,6 +25,14 @@ class AccountPayment(models.Model):
res['sale_id'] = self.sale_id.id
return res
def _create_payment_entry(self, amount):
move = super()._create_payment_entry(amount)
if hasattr(self, 'sale_id') and self.sale_id:
for line in move.line_ids:
if line.sale_id and line.account_id.internal_type == 'receivable':
line._sale_down_payment_hook()
return move
class AccountAbstractPayment(models.AbstractModel):
_inherit = "account.abstract.payment"