首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在odoo 12下如何定制不同的产品价值?

在odoo 12下如何定制不同的产品价值?
EN

Stack Overflow用户
提问于 2019-04-04 14:01:58
回答 1查看 250关注 0票数 0

在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,因为我们应该有(长度>宽度)。

下面是这个案例的屏幕截图:在这里输入图像描述

EN

回答 1

Stack Overflow用户

发布于 2019-04-04 18:34:40

代码语言:javascript
复制
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 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55517915

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档