Hi guys,
After installed module base_address_city, I would like to create another field called District to have relationship Many2one to city_id (base_address_city)
My simple code:
(base_address_district.py)
...
class District(models.Model):
_name = 'res.district'
_description = 'District'
_order = 'name'
name = fields.Char(String='District Name', required=True, translate=True, help='The full name of the district')
zipcode = fields.Char("Zip")
city_id = fields.Many2one('res_city', 'City', required=True)
class Partner(models.Model):
_inherit = ['res.partner']
_name = 'res.partner'
district = fields.Many2one('res.district', ondelete='restrict', string='district', index=True)
@api.onchange('district_id')
def _onchange_district_id(self):
self.district = self.district_id.name
self.zip = self.district_id.zipcode
self.city_id = self.district_id.city_id
(base_address_district.xml)
...
<record id="view_res_partner_extended_district_form" model="ir.ui.view">
<field name="name">view_res_partner_extended_district_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='street2']" position="after">
<field name="district" groups="base.group_no_one" placeholder="District..." />
</xpath>
</field>
</record>
...
Then face the error:
...
psycopg2.ProgrammingError: relation "_unknown" does not exist LINE 1: SELECT "_unknown".id FROM "_unknown" ORDER BY "_unknown"."id...
By searching internet, there is few ppl found similar issue while adding a module that have relationship with base module or res module for example:
https://www.odoo.com/forum/help-1/question/weird-error-programmingerror-relation-unknown-does-not-exist-line-1-select-unknown-id-from-unknown-order-by-unknown-id-74185
Please help to suggest if there is solution and reason behind.