Required actions for applying module changes

If you edit the python code of the module you need only to restart the server in order the most recent changes to be applied to the system. Otherwise in a case when an XML document is edited you need to upgrade the module.

Share the knowledge!

How to make the tree view inline editable

If you want to edit the tree view of one2many or many2many field inline, without opening a popup window, you can do that by adding the attribute “editable” in the view definition.
Regarding your needs, if you want to add a new line at the top of the view, the value must be “top” or in a case when you need a new line at the bottom of the view the value must be “bottom”.

For example, adding a new line at the top of the tree view of the order_line field in the sale.order model should look like:

<xpath expr="//field[@name='order_line']" position="attributes">
    <attribute name="editable">top</attribute>
</xpath>
Share the knowledge!

Issue with translation in a custom module

In a case when you have a different translation for a field from existing module in your custom module, may happen your translation not to be taken. Actually, translation from the custom module will be loaded before the original module and translation from the original module will override it.

In order to prevent that you need to add the attribute ‘sequence‘ in the definition of your module in the __openerp__.py file with a value bigger than the sequence‘s value in the original module. Default ‘sequence‘ value for every module is 100, what means your should add bigger value for the custom module.

Share the knowledge!

Quotation And Sales Order Addresses

According to your needs, Odoo allows you to set one or multiple addresses per Sales Order. If you need to have different invoice and delivery address from the customer’s address you can achieve that simply by selecting “Allow a different address for delivery and invoicing” in Settings >> Configuration >> Sales in Odoo v8 or if you use Odoo v9  you can gain the same by selecting “Display 3 fields on sales orders: customer, invoice address, delivery address” in Sales >> Configuration >> Settings.

Share the knowledge!

Timeout Error

Have you ever had an issue such timeout error in Odoo ? In case if you face this issue, you can resolve it by increasing the values for limit_time_cpu and limit_time_real. These attributes should be defined in the Odoo’s config file. Default values for them are:
limit_time_cpu = 60

limit_time_real = 120
Share the knowledge!

How to override a Related field

In Odoo you can define a related field by setting up the related attribute in the field definition, more info you can find for this type of fields in the post.

In case when you want to override a related field and to change the related attribute with computed you need to define a computed method and additionally to set the related attribute to related=”

For example, the field free_member is a related field in Odoo, and now you need to change the functionality in the way that you need to make this field computed. You can do that in the following way:

from openerp import models, fields, api

class PartnerContact(models.Model):
    _name = 'partner.contact'

    free_member = fields.Boolean(related='', computed="_get_free_member", store=True)
 
    @api.one()
    def _get_free_member(self):
        if self.user:
            self.free_member = self.user_id.free_member

If you think that this is completely same as using a related field, check our next post and see why it is not.

Share the knowledge!

How to create an invoice from multiple Delivery Orders in Odoo v8

If you use Odoo v8 you can create an invoice from multiple Delivery Orders in the following way:

  • Open the Delivery Order’s list view and select the Delivery Orders from which you want to create an invoice. The important think is all selected Delivery Orders to have the same partner
  • From the “More” menu choose the option “Create Draft Invoices”
  • Select  the option “Group By partner” on the wizard that will show up
  • Click on the button “Create”  after filling rest of the fields on the wizard and you are done.

Please note that the Delivery Orders need to be created from Sales Orders in order to be invoiceable.

 

Share the knowledge!

How to remove “Create” and “Edit” buttons from a form view

If you need to remove one or both buttons from the form view you can do that by setting up create and/or edit attributes in the form tag of the view definition to false.

<form create="false" edit="false">
Share the knowledge!

How to remove “Create and Edit” option from the many2one field

When you search in a Many2one field you can see at the bottom of the dropdown an option that says “Create and Edit” if you click on it a new window will be opened where you can create a new object of the relational model. This option is enabled by default but if you don’t want that behaviour for some fields you can remove it simply by adding in the field definition of the view:

options="{'no_create': True}"

For example, if you need to add a new view where one of the fields is payment_term, and you don’t want this option to show up in the dropdown of it, its definition should look like:

<field name="payment_term" options="{'no_create': True}"/>
Share the knowledge!

Odoo database manager

You can manage Odoo’s databases directly from the Odoo interface by visiting following URL:

<hostname>/web/database/manager

For example, to open database manager on your local Odoo installation that runs on port 8069 the URL should look like:

http://localhost:8069/web/database/manager

Operations that you can do from there are Create, Delete, Duplicate, Backup, and Restore database.

Also, you can set a new master password for your system from the database manager.

Share the knowledge!