Last active
April 13, 2018 15:49
-
-
Save tienhieuD/e6a5bc844ec00a72754546300cbc8033 to your computer and use it in GitHub Desktop.
View for config exmalple Odoo
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
# -*- coding: utf-8 -*- | |
from odoo import fields, models, api | |
class Config(models.TransientModel): | |
_name = 'mylib.config' | |
_inherit = 'res.config.settings' | |
_description = 'My Library Config' | |
library_name = fields.Char() | |
@api.multi | |
def set_library_name(self): | |
self.ensure_one() | |
for config in self: | |
self.env['ir.config_parameter'].set_param('library_name', config.library_name) | |
@api.model | |
def get_default_library_name(self, fields): | |
library_name = self.env['ir.config_parameter'].get_param('library_name') | |
return {'library_name': library_name} |
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"?> | |
<odoo> | |
<data> | |
<record id="mylib_config_act" model="ir.actions.act_window"> | |
<field name="name">Cấu hình thư viện</field> | |
<field name="res_model">mylib.config</field> | |
<field name="view_mode">form</field> | |
<!--<field name="target">inline</field>--> | |
</record> | |
<record id="mylib_config_form" model="ir.ui.view"> | |
<field name="name">Cấu hình thư viện</field> | |
<field name="model">mylib.config</field> | |
<field name="arch" type="xml"> | |
<form string="Cấu hình thư viện" class="oe_form_configuration" > | |
<header> | |
<button string="Apply" type="object" name="execute" class="oe_highlight"/> | |
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel" /> | |
<!--special="cancel"--> | |
</header> | |
<!--<sheet>--> | |
<!--<group>--> | |
<label for="library_name"/> | |
<field name="library_name"/> | |
<!--</group>--> | |
<!--</sheet>--> | |
</form> | |
</field> | |
</record> | |
</data> | |
</odoo> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment