Commit 26cb7b89 authored by lucianortiz's avatar lucianortiz
Browse files

[T4015] add compute payment_notices

parent c32629e4
No related merge requests found
Showing with 8 additions and 0 deletions
......@@ -37,8 +37,16 @@ class ResPartner(models.Model):
string="Payment notices",
default=0,
help='Billing Notices',
compute="_compute_payment_notices"
)
@api.depends_context('company')
def _compute_payment_notices(self):
BillingNotice = self.env['billing.notice']
partner_notices_by_company = BillingNotice.search(
[('client_name', '=', self.name), ('state', '=', 'sent'), ('company', '=', self.env.company.id)])
self.payment_notices = sum([notice.amount for notice in partner_notices_by_company])
@api.depends('credit', 'debit', 'payment_notices')
def _compute_amount_due(self):
for rec in self:
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment