Odoo Help


Sales order custom fields

on 1/9/14, 3:54 PM 1,806 views

Can anyone help, we have been looking at using openerp 7 in our company, what we have looking to do is add some custom fields in the sales order and manufacture orders. Up to 3 searchable boxes but 2 of them to be drop down boxes to allow you to select make of car and model of car. As we are a vehicle based company that need to show vehicle data and it be searchable. Can anyone help with this



Gopakumar N G

--Gopakumar N G--
| 5 4 7
Cochin, India
--Gopakumar N G--

Project Lead at Bizweaver Technologies Pvt. Ltd.

Gopakumar N G
On 1/10/14, 2:00 AM

Create a new module, say 'sale_customization' in the addons directory and create __init__.py and __openerp__.py files in the module. Then create a file sale.py in it and add the following code:

from openerp.osv import fields,osv

    class sale_order(osv.osv):
        _inherit = 'sale.order'
        _columns = {
              'field1': fields.char('Field1', size=64), 
              'make_of_car': fields.selection([('make1', 'Make1'), ('make2', 'Make2')] ,'Make of the Car', required=True),
              'model_of_car': fields.selection([('model1', 'Model1'), ('model2', 'Model2')] ,'Model of the Car', required=True),

Now add the line import sale in __init__.py file. Then create a file sale_view.xml in the module and add the following in it:

<?xml version="1.0" encoding="utf-8"?>
        <record id="view_order_form_inherit" model="ir.ui.view">
            <field name="name">sale.order.form.1</field>
            <field name="model">sale.order</field>
            <field name="type">form</field>
            <field name="inherit_id" ref="sale.view_order_form"/>
            <field name="arch" type="xml">
                     <xpath expr="//field[@name='origin']" position="after">
                        <field name="field1"/>
                        <field name="make_of_car"/>
                        <field name="model_of_car"/>

Now add the following to the __openerp__.py file.

    "name" : "Sale Customization",
    "version" : "1.0",
    "author" : "Gopakumar N G",
    "website" : "http://www.zbeanztech.com",
    "category" : "Custom",
    "depends" : ["sale"],
    "description": """ Sale customizations """

    'init_xml': [],
    'update_xml': [
    'demo_xml': [
    'test': [
    'installable': True,
    'active': False,

Now restart the server and update the module list in Administration->Modules->Update Module List , the in Installed Modules menu uncheck the 'Installed' filter and select your module and install it.

Many thanks for your info will give it a try

on 1/10/14, 2:25 PM

I need add custom fields "estampacion, marquilla, insumos y empaque", all contain sub fields how i do that?

Jhon Felipe Urrego Mejia
on 2/26/14, 4:49 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 1/9/14, 3:54 PM
Seen: 1806 times
Last updated: 3/16/15, 8:10 AM