1
我不能讓樹視圖中顯示任何數據,甚至我可以創建一個沒有問題的項目,他們出現在數據庫中空樹視圖
這裏是查看XML:
<record id="view_invoice_lab_tree" model="ir.ui.view">
<field name="name">lab.invoice.tree</field>
<field name="model">lab.invoice</field>
<field name="arch" type="xml">
<tree string="Labs Invoices">
<field name="name" string="invoice Number"/>
<field name="create_date"/>
<field name="patient_id"/>
<field name="amount_total"/>
</tree>
</field>
</record>
模型結構:
class LabOrderLine(models.Model):
_name = 'lab.order.line'
_description = 'labs Order Line'
name = fields.Text(string='Description', required=True)
order_id = fields.Many2one('lab.invoice', string='Invoice Reference', required=True, ondelete='cascade', index=True, copy=False)
nameLab = fields.Many2one(
string='Lab',
comodel_name='medical.lab.patient',
required=True,
ondelete='cascade',
)
patient_id= fields.Many2one(
'medical.patient',
string='patient',
related='nameLab.patient_id',
readonly=True,
required=True,
)
class labinvoice (models.Model):
_name = "lab.invoice"
name = fields.Char(string='Invoice Reference', default=lambda self: _('New'), store=True)
order_line = fields.One2many('lab.order.line', 'order_id', string='Order Lines', copy=True, )
nameLab = fields.Many2one('medical.lab.patient',related='order_line.nameLab',string='name Lab', store=True)
patient_id = fields.Many2one('medical.patient',related='order_line.patient',string='name Patient', store=True, readonly=True)
我認爲這個問題是與One2many場
你在說什麼「模型」? 'lab.invoice'或'lab.order.line'的樹狀視圖 – qvpham
我在說lab.invoice – Borealis
好吧。那麼'amount_total'定義在哪裏? – qvpham