【发布时间】:2020-12-13 00:16:07
【问题描述】:
我正在尝试计算销售订单行上的折扣字段,该方法在 odoo 12 中运行良好,但在 odoo 13 中,每次尝试添加行时都会出现此错误
sale.order.line(
,).discount_mount
这就是我所做的
class discount_cycle(models.Model):
_inherit = 'sale.order.line'
discount_mount = fields.Float(string="", required=False , compute='discount_calculation')
@api.depends('product_id','discount','price_subtotal')
def discount_calculation(self):
for rec in self:
if rec.discount:
if rec.product_uom_qty > 1:
rec.discount_mount = ((rec.price_unit * rec.product_uom_qty) * (rec.discount / 100))
else:
rec.discount_mount = (rec.price_unit * (rec.discount / 100))
pass
请注意,在 odoo V 12 中是 @api.one,那么我该如何解决这个问题以及在这种情况下 @api.one 的替代品是什么
【问题讨论】:
标签: python python-3.x odoo decorator odoo-13