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”)
odoo部分知识点注解2
@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’)
odoo部分知识点注解2
odoo部分知识点注解2
odoo部分知识点注解2
odoo部分知识点注解2
odoo部分知识点注解2
odoo部分知识点注解2

1.2qc_inspection_view.py











1.3前端
odoo部分知识点注解2

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)
odoo部分知识点注解2

odoo部分知识点注解2
odoo部分知识点注解2

odoo部分知识点注解2

相关文章:

  • 2021-12-15
  • 2021-12-04
  • 2021-11-19
  • 2021-03-31
  • 2021-06-18
  • 2021-09-22
  • 2021-09-13
  • 2022-02-12
猜你喜欢
  • 2021-05-19
  • 2021-12-03
  • 2021-07-06
  • 2021-06-30
  • 2021-08-23
  • 2021-04-25
  • 2021-11-27
相关资源
相似解决方案