在product.template模块中,我添加了一个长度/宽度变量,如下图在这里输入图像描述所示
I需要:自定义在表单视图中的属性值列中创建值,其中的外部id是odoo 12中的product.product_template_only_form_view:
例如:如果用户在列属性值中输入值:*数字1*编号2*或值:x空间number2空间或值: number1 x空间x number2空间,我需要函数来修剪空格并在本专栏中设置数值1/2!
其他条件:,如果number1 < number2,则需要在属性值列中设置值,如数字2/数字1,因为我们应该有(长度>宽度)。
下面是这个案例的屏幕截图:在这里输入图像描述
发布于 2019-04-04 18:34:40
class valuesInherit(models.Model):
_inherit = 'product.template'
@api.depends('attribute_line_ids')
def Change (self):
if self.your_length_field and self.your_length_field:
if if self.your_length_field > if self.your_width_field:
self.result_field = self.your_length_field/ your_length_field
if self.your_length_field and self.your_length_field:
if if self.your_length_field < if self.your_width_field:
self.result_field = your_length_field/ self.your_length_field https://stackoverflow.com/questions/55517915
复制相似问题