Odoo Help


How to override Your company data through a custom module in v8 ?

on 7/1/15, 9:39 AM 815 views

Hi !

In v7, you could do:

<record id="base.main_company" model="res.company"> <field name="name">Your New Company</field> <field name="partner_id" ref="main_partner"/> <field name="rml_header1">Your New Company Tagline</field> <field name="currency_id" ref="base.EUR"/> </record>

But in v8 you can't. Any other way doing this ?

On 7/1/15, 10:18 AM

Update: (better alternative)


<data noupdate="1">
<function model="res.company" name="set_my_company_data"/>


class ResCompany(models.Model):
_inherit = "res.company"

def set_my_company_data(self):
_logger.info("Setting company data...")
module_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
img_path = os.path.join(module_dir, 'static/img/custom_company_logo.png')
with open(img_path) as img:
logo = img.read().encode('base64')

'name': "My Custom Name",
'logo': logo,
_logger.info("... done.")


I found a workaround:

        <record id="foo" model="res.company">
<field name="inherit_id" ref="base.main_company"/>
<field name="name">Foo</field>
<field name="logo" type="base64" file="foo/static/img/foo_logo.png"/>
           <field name="street">5 rue Foo Bar</field>

The .py that allows that to work:

class ResCompany(models.Model):
_inherit = "res.company"

def create(self, vals):
inherit_id = vals.get('inherit_id', False)
if inherit_id:
# this is an inheritance
del vals['inherit_id']
super(ResCompany, self.browse(inherit_id)).write(vals)
return self
return super(ResCompany, self).create(vals)
On 9/22/16, 1:49 PM

The query update ir_model_data set noupdate=False where noupdate=True must make everything updatable.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 7/1/15, 9:39 AM
Seen: 815 times
Last updated: 9/22/16, 1:49 PM