跳至內容
選單
此問題已被標幟
1 回覆
156 瀏覽次數

I get this error and I don't know how to fix it:

odoo.tools.convert.ParseError: while parsing /mnt/extra-addons/packing_operation/views/packing_order_views.xml:4, somewhere inside
<record id="view_packing_order_tree" model="ir.ui.view">
    <field name="name">packing.order.tree</field>
    <field name="model">packing.order</field>
    <field name="arch" type="xml">
        <tree>
            <field name="name"/>
            <field name="state" widget="badge" options="{'style': 'color'}"/>
            <field name="user_id"/>
            <field name="full_packing_date"/>
        </tree>
    </field>
    </record>

ChatGPT thinks that tree is OK for ir.ui.view.type.

My model:

class PackingOrder(models.Model):


    _name = "packing.order"

    _description = "Packing Order"


    name = fields.Char(string="Task number",

                       required=True,

                       copy=False,

                       default="New",

    )


    user_id = fields.Many2one("res.users", string="Operator")

    cancellation_reason = fields.Text(string="Cancel reason")

    line_ids = fields.One2many("packing.order.line",

                               "order_id",

                               string="Order lines",

                               )

    full_packing_date = fields.Datetime(

        string="Date of full packing", readonly=True

    )

    barcode_scanner = fields.Char(string="Scanner (product ID)")


    state = fields.Selection([

    ('waiting', 'Waiting'),

    ('in_progress', 'In progress'),

    ('done', 'Done'),

    ('cancel', 'Cancel'),

    ], string="Status", compute='_compute_state', store=True)

頭像
捨棄
作者

Thank you very much for answer. Spent a day trying to fix it.

最佳答案

In Odoo 18, the tree view is no longer supported – it has been fully replaced by list. Sometimes ChatGPT (or even developers who are used to older versions) might still assume that tree is valid because it was used up to Odoo 16. But in reality, from Odoo 17 onward, you must use list instead of tree for list views.

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
0
8月 25
1026
1
7月 25
889
0
6月 25
803
1
5月 25
1459
2
3月 25
1874