【问题标题】:How to compute two custom fields in sale order line?如何计算销售订单行中的两个自定义字段?
【发布时间】:2018-01-15 15:13:08
【问题描述】:

我在销售订单行(高度和宽度)中添加了两个新的服装字段和一个称为总面积的字段。我想计算总面积字段中的两个字段(高度和宽度)

谢谢

【问题讨论】:

标签: python python-3.x python-2.7 odoo-10 odoo


【解决方案1】:

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)

【讨论】:

    猜你喜欢
    • 2020-12-13
    • 1970-01-01
    • 2011-06-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多