【发布时间】:2018-01-15 15:13:08
【问题描述】:
我在销售订单行(高度和宽度)中添加了两个新的服装字段和一个称为总面积的字段。我想计算总面积字段中的两个字段(高度和宽度)
谢谢
【问题讨论】:
-
你试过什么?向我们展示您的代码。请参观并阅读stackoverflow.com/help/how-to-ask。
标签: python python-3.x python-2.7 odoo-10 odoo
我在销售订单行(高度和宽度)中添加了两个新的服装字段和一个称为总面积的字段。我想计算总面积字段中的两个字段(高度和宽度)
谢谢
【问题讨论】:
标签: python python-3.x python-2.7 odoo-10 odoo
在sale_order_line classe 试试这个
@api.depends('height', 'width')
def _get_area(self):
for line in self:
line.area = line.height * line.width
height = fields.Integer(string='Height')
width = fields.Integer(string='Width')
area = fields.Integer(compute='_get_area', string='Area article', readonly=True, store=True)
【讨论】: