I am writing a code to add new field in "res.partner". I searched everywhere but couldn't find the solution to this problem.
I am naming the Class "ResPartner" and inheriting "res.partner". adding personal_id field and running and installing the module it worked fine. Now,
If: I add a new field in that existing DB it will give me the error that res_partner. does not exist.
BUT: If I create a new db after I have written the new fields in python under "res.partner" and install the module in that db it will run without any error.
class ResPartner(models.Model):
_inherit = 'res.partner'
personal_id = fields.Char(string="Personal ID Number")
child_name_new = fields.Integer(string="Name of the Child:")
birth_date_child = fields.Date(string="Date of birth of child")
admission_date_child = fields.Date(string="Date of admission")
EXPECTED: NO ERROR
ERROR:
File /home/braincrew/Documents/projects/odoo/odoo12/odoo/odoo/models.py", line 2765, in read
self._read_from_database(stored, inherited)
File "/home/braincrew/Documents/projects/odoo/odoo12/odoo/odoo/models.py", line 2892, in _read_from_database
cr.execute(query_str, params)
File "/home/braincrew/Documents/projects/odoo/odoo12/odoo/odoo/sql_db.py", line 148, in wrapper
return f(self, *args, **kwargs)
File "/home/braincrew/Documents/projects/odoo/odoo12/odoo/odoo/sql_db.py", line 225, in execute
res = self._obj.execute(query, params)
psycopg2.ProgrammingError: column res_partner.child_name_new does not exist
LINE 1: ...nce","res_partner"."personal_id" as "personal_id","res_partn..."