odoo部分知识点注解2

odoo部分知识点注解2

1.1qc_inspection.py
@api.multi
def _links_get(self):
link_obj = self.env[‘res.request.link’]
return [(r.object, r.name) for r in link_obj.search([])]
object_id = fields.Reference(
string=‘Reference’, selection=_links_get, readonly=True,
states={‘draft’: [(‘readonly’, False)]}, ondelete=“set null”)
在这里插入图片描述
@api.depends(‘object_id’)
def _compute_product_id(self):
for i in self:
if i.object_id and i.object_id._name == ‘product.product’:
i.product_id = i.object_id
else:
i.product_id = False
product_id = fields.Many2one(
comodel_name=“product.product”, compute="_compute_product_id",
store=True, help=“Product associated with the inspection”,
oldname=‘product’)
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

1.2qc_inspection_view.py











1.3前端
在这里插入图片描述

2.1qc_inspection.py
@api.depends(‘inspection_lines’, ‘inspection_lines.success’)
def _compute_success(self):
for i in self:
i.success = all([x.success for x in i.inspection_lines])
inspection_lines = fields.One2many(
comodel_name=‘qc.inspection.line’, inverse_name=‘inspection_id’,
string=‘Inspection lines’, readonly=True,
states={‘ready’: [(‘readonly’, False)]})
success = fields.Boolean(
compute="_compute_success", string=‘Success’,
help=‘This field will be marked if all tests have succeeded.’,
store=True)
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值