Odoo SAAS:将关联模型中的字段添加到另一个模型的树视图中
Odoo SAAS: Add field from associated model into a tree view of another model
我在 res.partner 中有 2 个字段,我想根据 partner_id 字段在 account.invoice 的树视图中显示。由于 SaaS 版本不允许编程访问,我想知道如何通过树视图 Web 界面执行此操作(引用另一个模型和字段)。
提前致谢!
在 account.invoice 模型中创建与 res.partner
字段相关的字段
x_invoice_preference=fields.Selection(related="partner_id.x_invoice_preference")
最好在其他模型中将相关字段命名为相同名称
小例子:
class class1(models.Model):
_name = 'table1'
name = fields.Char()
class class2(models.Model):
_name = 'table2'
table1_id = fields.Many2one('table1','table 1');
#this how you create a related field in order to
#show it in the form or the tree when you select the value of the many2one field it
# will have the same value of the vield name of the tabl1
name = fields.Char(related="table1_id.name",readonly=True)
#field_name m2onField.field_name
我在 res.partner 中有 2 个字段,我想根据 partner_id 字段在 account.invoice 的树视图中显示。由于 SaaS 版本不允许编程访问,我想知道如何通过树视图 Web 界面执行此操作(引用另一个模型和字段)。
提前致谢!
在 account.invoice 模型中创建与 res.partner
字段相关的字段x_invoice_preference=fields.Selection(related="partner_id.x_invoice_preference")
最好在其他模型中将相关字段命名为相同名称
小例子:
class class1(models.Model):
_name = 'table1'
name = fields.Char()
class class2(models.Model):
_name = 'table2'
table1_id = fields.Many2one('table1','table 1');
#this how you create a related field in order to
#show it in the form or the tree when you select the value of the many2one field it
# will have the same value of the vield name of the tabl1
name = fields.Char(related="table1_id.name",readonly=True)
#field_name m2onField.field_name