コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
2084 ビュー

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')


アバター
破棄
最善の回答

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

アバター
破棄
関連投稿 返信 ビュー 活動
0
1月 24
1527
0
3月 15
3855
0
3月 15
3384
1
6月 22
2520
0
5月 22
1849