Created
October 3, 2016 14:56
-
-
Save simahawk/8c6319c3763d3fe7b21d44ee48aeb069 to your computer and use it in GitHub Desktop.
Odoo - add website configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WebsiteConfigSettings(models.TransientModel): | |
"""Override website config model.""" | |
_inherit = "website.config.settings" | |
my_new_field = fields.Char( | |
string='My field', | |
related='website_id.my_new_field' | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<openerp> | |
<data> | |
<record id="website_config_settings" model="ir.ui.view"> | |
<field name="name">website settings form</field> | |
<field name="model">website.config.settings</field> | |
<field name="inherit_id" ref="website.view_website_config_settings"/> | |
<field name="arch" type="xml"> | |
<xpath expr="//group[@name='advanced']" position="after"> | |
<group string="MY section" name="my-section"> | |
<field name="my_new_field" /> | |
</group> | |
</xpath> | |
</field> | |
</record> | |
</data> | |
</openerp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Website(models.Model): | |
"""Override website model.""" | |
_inherit = "website" | |
my_new_field = fields.Char('My field') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<openerp> | |
<data> | |
<record id="website_form" model="ir.ui.view"> | |
<field name="name">advanced website form</field> | |
<field name="model">website</field> | |
<field name="inherit_id" ref="website.view_website_form"/> | |
<field name="arch" type="xml"> | |
<field name="social_github" position="replace"> | |
<field name="my_new_field" /> | |
</field> | |
</field> | |
</record> | |
</data> | |
</openerp> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you please tell me why do we need the website_view.xml?
It does not seem to affect the display at all.