如何从odoo中的其他模块检索字段值?
How to retrieve field value from other modules in odoo?
我想从制造中检索一个名为 "product_qty" 的字段 module.It 在 mrp_bom 中定义 class.All 相关字段的示例显示 class es 存在于同一个 file.Is 中,可以获取 mrp 模块中 "product_qty" 的值,并在我的自定义模块中定义的 class 中检索它吗?
class product_template(models.Model):
_inherit = "product.template"
product_quantity = fields.Many2one('mrp.bom')
quantity = fields.Char(related='product_quantity.product_qty')
The fields will be created in database only if it's store=True (in
case of related field or functional field).
Related values will not be available until you save that record (on create time).
您应该尝试关注,
class product_template(models.Model):
_inherit = "product.template"
product_quantity = fields.Many2one('mrp.bom')
quantity = fields.Float(string="Qty", related='product_quantity.product_qty', store=True, readonly=True)
我想从制造中检索一个名为 "product_qty" 的字段 module.It 在 mrp_bom 中定义 class.All 相关字段的示例显示 class es 存在于同一个 file.Is 中,可以获取 mrp 模块中 "product_qty" 的值,并在我的自定义模块中定义的 class 中检索它吗?
class product_template(models.Model):
_inherit = "product.template"
product_quantity = fields.Many2one('mrp.bom')
quantity = fields.Char(related='product_quantity.product_qty')
The fields will be created in database only if it's store=True (in case of related field or functional field). Related values will not be available until you save that record (on create time).
您应该尝试关注,
class product_template(models.Model):
_inherit = "product.template"
product_quantity = fields.Many2one('mrp.bom')
quantity = fields.Float(string="Qty", related='product_quantity.product_qty', store=True, readonly=True)