There are records inside openerp/addons/base/res/res_country_data.xml file:
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="ae" model="res.country">
<field name="name">United Arab Emirates</field>
<field name="code">ae</field>
<field file="base/static/img/country_flags/ae.png" name="image" type="base64" />
<field name="currency_id" ref="AED" />
<field eval="971" name="phone_code" />
</record>
I would like to extend this data to include reference to my model data, so I've tried following:
<openerp>
<data>
<!-- extend data from country_data.xml -->
<record id="ae_range" model="res.country">
<field name="ean_range" ref="res.country.ean_range">629</field>
</record>
<!-- data for my model country model must be pointing to -->
<record id="629" model="res.country.ean_range">
<field name="range_start">629</field>
<field name="range_end">629</field>
<field name="name">629</field>
</record>
as suggested in this question, tried common inherit rules, such as:
<record id="ae_range" model="res.country">
<field name="inherit_id" ref="res.country.ean_range"/>
...
</record>
But each time I get error about missing xmlid. How can I extend already existing data file and populate module with my own data? Maybe I'm doing something terribly wrong, maybe you could suggest how to populate country model with data for my field which had been added during module installation?
EDIT: Class definitions
class InstantProductTemplate(models.Model):
_name = 'product.template'
_inherit = 'product.template'
country_of_origin = fields.Many2one('res.country',
string='Country of origin',
default="_guess_country",
store=True)
class InstantCountryRanges(models.Model):
_name = 'res.country'
_inherit = 'res.country'
ean_range = fields.One2many('res.country.ean_range', 'name')
class InstantCountry(models.Model):
_name = 'res.country.ean_range'
name = fields.Char()
range_start = fields.Integer("Range start")
range_end = fields.Integer("Range end")
Thank you in advance!