如何计算(折扣=销售价格-单价)(1-价格_单价)*100?
请做一个计算函数,可以根据你的计算结果计算出dicsount。sale_price
和 unit_price
.
@api.depends('unit_price', 'sale_price')
def compute_discount(self):
for rec in self:
rec.discount = (1-unit_price/sale_price)/100
如果我没有猜错的话,你需要把这个计算方法添加在 purchase.order.line
.