Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
2046 Prikazi

from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
#from datetime import datetime, timedelta


class sale_order(models.Model):
_inherit = 'sale.order'


customer_balance = fields.Float(related="partner_id.credit",string="Balance")
total_balance = fields.float(string='Total Balance')


Avatar
Opusti
Best Answer

Hi,

You can make the total_balance as compute field depending on the field total_inquiry and early_balance field you mentioned.

@api.depends('total_inquiry', 'early_balance')
def _compute_total_balance(self):
balance = self.early_balance + self.total_inquiry
self.total_balance = balance

total_balance = fields.float(string='Total Balance', compute=_compute_total_balance)


The above code is based on new API, you might have to adjust the code according to old API.

Thanks

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
0
jan. 24
1495
0
mar. 15
3813
0
mar. 15
3350
1
jun. 22
2465
0
maj 22
1830