我编辑了compute_amount的功能一切都没关系现在的问题是当我支付发票时我仍然得到旧的金额,任何改变之前有人在这个工作吗? 这是我的新compute_amount
@api.one
@api.depends('invoice_line.price_subtotal', 'tax_line.amount','timbre','partner_id')
def _compute_amount(self):
if self.type == 'out_invoice':
if self.partner_id.rs == True:
print'rs',self.partner_id.rs
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_rs = (self.amount_untaxed + self.amount_tax) * 0.01
self.amount_total = self.amount_untaxed + self.amount_tax + self.amount_rs + self.timbre
else :
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_total = self.amount_untaxed + self.amount_tax + self.timbre
else :
self.amount_untaxed = sum(line.price_subtotal for line in self.invoice_line)
self.amount_tax = sum(line.amount for line in self.tax_line)
self.amount_total = self.amount_untaxed + self.amount_tax
答案 0 :(得分:0)
如果是on_change方法并且该字段具有readonly属性,则write方法将不会获取新值。
对于此问题,解决方案可能是您创建了一个不可见的镜像函数字段。