Skip to Content
Menu
This question has been flagged
4 Replies
2666 Views

Hello,

First of all, everything  i make is working on my local computer but this error happen when i tried to update this module inside of a server.


I add some fieldsto res.company

class InheritAccountMove(models.Model):
_inherit = 'res.company'

tax_office = fields.Many2one('tax.office', string='Tax Office')
building_no = fields.Char(string='Building Number')
district_name = fields.Char(string='District/Town')
e_invoice_username = fields.Char(string="E-Invoice API Username")
e_invoice_password = fields.Char(string="E-Invoice API Password")
e_invoice_catalog = fields.Char(string="E-Invoice API Catalog")
e_invoice_isyeri = fields.Char(string="E-Invoice API Isyeri")
e_invoice_wsdl = fields.Char(string="E-Invoice API wsdl")


This is the XML looklike

id="view_company_form_inherit" model="ir.ui.view">
name="name">company.form
name="model">res.company
name="inherit_id" ref="base.view_company_form"/>
name="arch" type="xml">
expr="//field[@name='vat']" position="after">
name="tax_office"/>
name="building_no"/>
name="district_name"/>
name="e_invoice_username"/>
name="e_invoice_password"/>
name="e_invoice_catalog"/>
name="e_invoice_isyeri"/>
name="e_invoice_wsdl"/>


Its returning:

THERE IS NO FIELD "e_invoice_username" inside of res.company.

this fields starting with e_invoice is new ones. tax_office, building_no and district name was created 1 week ago and only with them it was working good.

Error started when i add this e_invoice fields.

I tried uninstall whole module and upload again but nothing changed.

I didn't understand why this is happening ?

Any idea for this problem ?


Avatar
Discard
Best Answer

The XML is working and found the fields but the fields not added to the DB so you need to restart Odoo service and then from apps -> update app lists (need to activate developer), because you are added some python code.

Important Note: If you have any changes in python code, you need to restart the Odoo service and update app lists.

Avatar
Discard
Best Answer

It looks like you are getting an error that says that there is no field e_invoice_username in the res.company model. This error is usually caused by one of the following issues:

  1. The field was not correctly defined in the Python code. Make sure that you have correctly defined the field in your InheritAccountMove model and that it has the correct name and type.

  2. The Python code has not been loaded by the Odoo server. Make sure that the module containing the Python code has been installed and that the server has been restarted after the installation.

  3. There is a problem with the XML definition of the field. Make sure that the field is correctly defined in the XML and that it is being inherited from the correct view.

  4. There is a problem with the database. If you made any changes to the database directly (e.g. through SQL commands), these changes may have caused the error. In this case, you may need to restore the database from a backup.


Avatar
Discard
Best Answer

There could be multiple reasons for the cause.

One of the common reasons could be this. Please make sure that the module is not added in multiple places like Odoo addons and in some other folders as well. 

If this is the case, remove the module from one of the places and use the latest one and try to upgrade it again.

Avatar
Discard
Best Answer

This is why I prefer to create or customize a model using Studio, to avoid issues like this. Fast simple and error free. After the model and views are working well we can continue the manual coding if needed.

Avatar
Discard

This can be done if your Odoo hosted in odoo.sh or on-promise but you can't do that if your hosted in Odoo Online.

Related Posts Replies Views Activity
2
Mar 24
674
2
Jun 16
16828
3
May 23
1795
3
May 22
5858
3
Mar 22
11911