I'm trying to populate two tables via xml, restaurant.floor and restaurant.table from a custom module.
All goes just fine when I create the floor entry with
<record id="floor_main" model="restaurant.floor">
<field name="name">floor_main</field>
<field name="background_color">rgb(136,137,242)</field>
<field name="pos_config_id" eval="ref('point_of_sale.pos_config_main')" />
</record>
but as soon as my xml reach the first of my tables definitions with
<record id="table_01" model="restaurant.table">
<field name="name">Mesa 01</field>
<field name="floor_id" eval="ref('pos_restaurant.floor_main')" />
<field name="seats">2</field>
<field name="color">rgb(172,109,173)</field>
<field name="shape">square</field>
<field name="width">120</field>
<field name="height">120</field>
<field name="position_h">900</field>
<field name="position_v">5</field>
</record>
I get a parse error
ParseError: "<type 'exceptions.ValueError'>: "External ID not found in the system: pos_restaurant.floor_main" while evaluating"ref('pos_restaurant.floor_main')""
And that's strange, because the db table I'm trying to update is on the same module (pos_restaurant) of restaurant.floor.
Pos_restaurant module is on the dependencies inside my manifest and the structure of my data.xml was copied from the demo.xml on pos_restaurant, then the syntax should be fine.
Solved changing the record id on the floor definition to grab the correct external ID on tables creation:
<record id="pos_restaurant.floor_main" model="restaurant.floor">