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')
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilitat
- Inventari
- PoS
- Project
- MRP
This question has been flagged
1
Respondre
1955
Vistes
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
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Registrar-seRelated Posts | Respostes | Vistes | Activitat | |
---|---|---|---|---|
|
0
de gen. 24
|
1436 | ||
|
0
de març 15
|
3730 | ||
|
0
de març 15
|
3285 | ||
|
1
de juny 22
|
2436 | ||
|
0
de maig 22
|
1764 |