Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4 ตอบกลับ
2411 มุมมอง

Hi,

for the life of me I don't get what is wrong with this xml file and when I try to install the module I get: 

AssertionError: Element odoo has extra content: record, line 4
My XML


  • hr.expense.view.form
    hr.expense










อวตาร
ละทิ้ง
ผู้เขียน

<record id="hr_expense_view_form" model="ir.ui.view">
<field name="name">hr.expense.view.form</field>
<field name="model">hr.expense</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_uom_id']" position="after">
<label for="x_total_price_divided_by_6" string="VAT"/>
<field name="x_total_price_divided_by_6"/>
</xpath>
</field>
<field name="depends">
<module name="lrukvat"/>
</field>
</record>

คำตอบที่ดีที่สุด

Hi,
The added code in the comment was not in the proper syntax, it was a mix of adding new form and inheriting an existing form.

So if you are trying to inherit and add the form, specify the record to inherit using the inherit_id key and using the xpath expression locate the node and perform the needed operation.

Thanks

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You most likely have an incorrect xml. Read this post: https://www.linkedin.com/pulse/nasty-assertion-error-element-odoo-has-extra-content-malekinejad/. I also had a typo that would have never found. My IDE also didn't highlight it.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด


yeah when I was posting my question it was not letting me do it properly, I added a comment 




hr.expense.view.form
hr.expense











อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Please enter the code properly for reference. This error usually occurs when there’s extra element in the record. Like an additional attribute or extra field which don’t belong to the model.

อวตาร
ละทิ้ง