试图将 One2Many 字段限制为仅同一公司的记录
Trying to limit One2Many field to only records of the same company
基本上,我想在这个字段上放置一个域:
line_ids = fields.One2many(
"hr.payslip.line",
"slip_id",
string="Payslip Lines",
readonly=True,
domain=[("company_id", "=", self.company_id.id)],
)
但我得到:
domain=[("company_id", "=", self.company_id.id)],
NameError: name 'self' is not defined
我认为 Odoo 对此有一个完美的解决方案,属性:check_company=True
基本上,我想在这个字段上放置一个域:
line_ids = fields.One2many(
"hr.payslip.line",
"slip_id",
string="Payslip Lines",
readonly=True,
domain=[("company_id", "=", self.company_id.id)],
)
但我得到:
domain=[("company_id", "=", self.company_id.id)],
NameError: name 'self' is not defined
我认为 Odoo 对此有一个完美的解决方案,属性:check_company=True