2

I am using odoo 10 and I want to add the barcode field to main form. I sucessfully moved the field but it does not save or show any data.

enter image description here

Here is the code I used to show the Barcode field on the form. As you can see it does not show any data.

<xpath expr="//field[@name='category_id']" position="after">
                <field name="barcode" />
                <field name="pin" />
</xpath>
KbiR
  • 4,047
  • 6
  • 37
  • 103
user2379186
  • 421
  • 6
  • 27

1 Answers1

3

You can not have a field more than once in the same view. Odoo will store the value to only one field.

So you need to remove/replace either barcode field.

Here is the example:

<xpath expr="//page[@name='sales_purchases']/group/group[@name='point_of_sale']/field[@name='barcode']" position="replace">
// may be you have to specify the complete path.
// //page[@name='sales_purchases']/group/group[@name='point_of_sale']
</xpath>

<xpath expr="//field[@name='category_id']" position="after">
                <field name="barcode" />
                <field name="pin" />

</xpath>

Hope it will help you.

KbiR
  • 4,047
  • 6
  • 37
  • 103
  • I did not know you could not have more than one field on an Odoo view. The code you gave to replace barcode did not work. You say specify the complete path. Where do I find complete path? – user2379186 Nov 23 '18 at 08:00
  • The ` barcode` field is added by `point_of_sale` module. I have updated my answer. – KbiR Nov 24 '18 at 05:43