1
votes

When creating a module for Odoo, does the order of the files in the manifest file matter? For example, if I'm creating fields via data files, do those files have to come before the any view data files if the views reference the new fields?

Let's say there is a file view.xml, and the view has the following arch:

<field name="name" position="after">
  <field name="x_new_field">
</field>

Then there is another data file called 'field.xml' that creates x_new_field.

In the __manifest__.py file, will this work:

"data": [
  'view.xml',
  'field.xml'
]

Or does the field have to come first so that the view can properly refer to it?

Similarly, what if a field being added contains a compute method that reference another field being added. Do the order of the fields in the manifest file matter? In which situations does the order matter, and it which situations does it not?

1

1 Answers

1
votes

Yes you cannot reference to an XMLid that is not parsed yet by the framework this happen even in the same file let say if you create a menu before the action in the same file you will have external id not found error.

this is the same in files because odoo parse file in the given order you cannot reference to some thing that is not parsed by the framework.

Note : in upgrading module you may not have this error because the external id is all ready in database when is parsed the first time the module is installed for examle if you create an action in an xml file that you found out that you have forget the menu if you put the menu in any place your code will work because the action is all ready parsed and saved in database.

sorry for my english ^^