mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
19 lines
648 B
Python
19 lines
648 B
Python
# Part of Hibou Suite Professional. See LICENSE_PROFESSIONAL file for full copyright and licensing details.
|
|
|
|
from odoo import api, fields, models
|
|
|
|
|
|
class ResPartner(models.Model):
|
|
_inherit = 'res.partner'
|
|
|
|
credit_remaining = fields.Float('Credit Remaining', compute='_compute_credit_remaining')
|
|
credit_hold = fields.Boolean('Credit Hold')
|
|
|
|
@api.depends('credit_limit', 'credit')
|
|
def _compute_credit_remaining(self):
|
|
for partner in self:
|
|
if partner.credit_limit:
|
|
partner.credit_remaining = partner.credit_limit - partner.credit
|
|
else:
|
|
partner.credit_remaining = 0.0
|