SO销售单和PO采购单,一定要在原始主类下添加字段,不能在继承类添加字段,不然xml识别不到字段。
SO销售单:
添加express_price字段后,找到def _compute_amount(self):方法,最后两行加入小计和合计的计算逻辑:
@api.depends('product_uom_qty', 'discount', 'price_unit', 'tax_id')
def _compute_amount(self):
"""
Compute the amounts of the SO line.
"""
for line in self:
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
taxes = line.tax_id.compute_all(price, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=line.order_id.partner_shipping_id)
line.update({
'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),
'price_total': taxes['total_included'],