Decorators and Its Utility in Odoo?

Decorators and Its Utility in Odoo?

A decorator is a function that takes a function as input and returns a function. The anatomy of the decorator is: @decorator-expression Function-definition Decorator-expression is an expression that returns a callable thing. The callable thing has to take a single argument. Function definition is a function definition (it, therefore, must begin with def). In older version of odoo, we use a cursor, uid, context and ids […]

Read More

How to Make Configuration Wizard for Application Settings

How to Make Configuration Wizard for Application Settings

It provides support for setting default values, assigning groups to employee users, and installing modules. To make such a ‘settings’ wizard, define a model like: class my_config_wizard(osv.osv_memory): _name = ‘my.settings’ _inherit = ‘res.config.settings’ _columns = { ‘default_foo’: fields.type(…, default_model=’my.model’), ‘group_bar’: fields.boolean(…, group=’base.group_user’,  implied_group=’my.group’), ‘module_baz’: fields.boolean(…), ‘other_field’: fields.type(…), } The method “execute“ provides some support based on a naming convention: For a field like ‘default_XXX’, “execute“ sets the (global) default value of the field ‘XXX’ in the model named by “default_model“ to the field’s value. E:g- “default_sale_tax_id” in account.config.settings allows you to set default taxes for sale. For a selection field like ‘group_XXX’ composed of 2 integers values (‘0’ and ‘1’), “execute“ adds/removes ‘implied_group’ to/from the implied groups of ‘group’, depending on the field’s value. E.g-”group_product_variant” in purchase.config.the setting allows you to define some variant of the same products if Checked. For a boolean field like ‘module_XXX’, “execute“ triggers the immediate installation of the module named ‘XXX’ if the field has value “True“. E.g-”module_crm_voip” in sale.config.setting if checked then it leads to installation of VOIP module. For a selection field like ‘module_XXX’ composed of 2 integers values (‘0’ and                                            ‘1’),“execute“ triggers the immediate installation of the module named ‘XXX’ if the field has the integer value “1“. *   For the other fields, the method “execute“ invokes all methods with a name that starts with ‘set_’; such methods can be defined to implement the effect of those fields. In View file add ‘oe_form_configuration’ class to the <form> tag. Contact Us for Customized ERP Solutions

Read More

How To Inherit JS In Xml?

How To Inherit JS In Xml?

Add custom css and javascript files in odoo.   Topic-1:Adding static resources (CSS and JavaScript) to Odoo Example : Creating the XML   The first step is to create a new XML file in your custom module. Create a new XML file under yourModuleName/views, like this: New XML file Now the first thing to do is to tell __openerp__.py that you’ve added this new XML […]

Read More

Decoding & Setting Up Image Display in Template

Decoding & Setting Up Image Display in Template

Subject : Display Images in Email (send using Templates). Related : Send Email using Templates via applications. Descriptions: We can send email using email template to the custom. That time suppose we have company logo then we would like to image display  logo in email. Sometimes image will not show in email or display in broken format. For that, we have to use python base64 […]

Read More

How to Hide a Menu/Submenu from All Users in Odoo?

How to Hide a Menu/Submenu from All Users in Odoo?

Once we install a specific module in Odoo, there is situation where we decide to hide some menu/submenus (unwanted menus for our customized module). Possible ways to hide menus are:  1.Hide from user interface i) Go to settings -> Groups -> create a group with no user inside it. ii) Go to settings -> technical -> user interface -> menu and search Reporting top               […]

Read More

How to Override Menu Items in Odoo 9?

How to Override Menu Items in Odoo 9?

Changes Name of menu by inheriting.   <record id=”crm.crm_case_category_act_oppor11″ model=”ir.actions.act_window”> <field name=”context”>{‘stage_type’: ‘opportunity’, ‘default_type’: ‘opportunity’, ‘default_user_id’: uid, ‘needaction_menu_ref’: ‘sale.menu_sale_quotations’}</field> <field name=”name”>Opportunities – PT action</field> </record>   <record model=”ir.ui.menu” id=”hr.menu_hr_root”> <field name=”name”>HR</field> </record>   Override groups <menuitem name=”menuName” id=”mod_id.menu_id” … /> At installing the module, however, they are stored as records of the ‘ir.ui.menu’ object type. where the many2many relationship to ‘res.groups’ is defined.   Given […]

Read More