Hi!
Let's say have two models, for persons and addresses, where the addresses always belong to a person, and a person may choose one of them as main address.
class person(osv.osv):
_name = "my.persons"
_columns = {
"name": fields.char("Name", size=64, required=True),
"address_id": fields.many2one("my.addresses" string="Main Address"),
"addresses_ids": fields.one2many("my.addresses", "person_id", string="All addresses"),
}
class adress(osv.osv):
_name = "my.addresses"
_columns = {
"name": fields.char("name", size=75),
"person_id": fields.many2one("my.persons", "Person", required=True),
}
Now, how do I enter data for this (as demo data / pre-supplied data) to an addon?
Exporting via base module recorder uses some searches like
<field model="my.addresses" name="address_id" search="[('name', '=', 'something')]"/>
and some ref fields like
<field name="address_id" ref="my_addresses_5"/>
The later are even used when they are NOT previously defined in the export of base module recorder, but only afterwards...
It all ends with a long traceback pastebin eXmk93ST (not allowed to post links) and
File "/home/openerp/openerp/addons/base/ir/ir_model.py", line 647, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: my.addresses_something
I tried all this on v6.1 (as I have need of the GTK client and can't upgrade to 7 therefore).
So, how is it done properly?