计算(折扣=销售价格-单价)

问题描述 投票:0回答:1

如何计算(折扣=销售价格-单价)(1-价格_单价)*100?

详情见下图https:/i.stack.imgur.comsdoe5.png。

odoo odoo-10 odoo-12
1个回答
0
投票

请做一个计算函数,可以根据你的计算结果计算出dicsount。sale_priceunit_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.

© www.soinside.com 2019 - 2024. All rights reserved.