0

我想在 odoo 15 中创建具有 3 折扣自定义计算的发票,一切都快完成了,但price_subtotal总是得到这样的错误值,谁能告诉我缺少什么?在此处输入图像描述

这是我做的方法

def _get_price_total_and_subtotal(self, price_unit=None, quantity=None, discount=None, discount_2=None, discount_3=None, currency=None, product=None, partner=None, taxes=None, move_type=None):
    self.ensure_one()
    return self._get_price_total_and_subtotal_model(
        price_unit=price_unit or self.price_unit,
        quantity=quantity or self.quantity,
        discount=discount or self.discount,
        discount_2=discount_2 or self.discount_2,
        discount_3=discount_3 or self.discount_3,
        currency=currency or self.currency_id,
        product=product or self.product_id,
        partner=partner or self.partner_id,
        taxes=taxes or self.tax_ids,
        move_type=move_type or self.move_id.move_type,
    )

添加到这一
def _get_price_total_and_subtotal_model(self, price_unit, quantity, discount, discount_2, discount_3, currency, product, partner, taxes, move_type):

像这样修改这一

    line_discount_price_unit = price_unit * (1 - (discount / 100.0))
    line_discount_price_unit2 = line_discount_price_unit * (1 - (discount_2 / 100.0))
    line_discount_price_unit3 = line_discount_price_unit2 * (1 - (discount_3 / 100.0))
    subtotal = quantity * line_discount_price_unit3
4

0 回答 0