Hi !
I'm trying to add a social media link for Pinterest in the configuration setting of the website module (Odoo 12) but I keep getting the error "Field `social_pinterest` does not exist" when I update the module. The code causing the problem is:
<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.website</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="website.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[hasclass('settings')]//field[@name='social_instagram']" position="after">
<label for="social_pinterest" string="Pinterest" class="col-md-3 o_light_label"/>
<field name="social_pinterest"/>
</xpath>
</field>
</record>
Where, for whatever reason, the field social_pinterest cannot be found by Odoo (as far as I understand). I tried to declare that field, in python, as follow:
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
social_pinterest = fields.Char()
class Website(models.Model):
_inherit = 'website'
_name = "website"
def _default_social_pinterest(self):
return "test"
social_pinterest = fields.Char('Pinterest Account', default=_default_social_pinterest)
But this does not work. The module is declared in __init__.py and I even tried to add the field directly into the code of the original website module (and yes, I update it). But nothing works... Any idea of what I'm missing? If I replace 'social_pinterest' in the view code above, by any of the fields already declared in the website module (e.g. social_facebook), then is working fine, so it's definitely a problem with the definition of that field...
Thanks a lot for your help!