Odoo Help

Shameem Babu @ iWesabe
On 3/28/17, 5:59 AM

In Odoo 10,

Python file
from odoo import models, fields

class SaleOrderInherited(models.Model):
_inherit = 'sale.order'

custom_field = fields.Char(string='Custom Field')
Xml file
<!--Inherit the sale order form view--> 
<record id="view_sale_order_custom" model="ir.ui.view">
<field name="name">sale.order.custom.form.inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="custom_field"/>
Watch this on YouTube : Additional field to existing view in odoo 10

All the best !

Alfa y Omega Pachuca
On 11/13/15, 8:52 PM

In odoo 9 (in you have you odoo server in other directory, just change the path to you odoo directory installation)

Create a new custom module:

cd /odoo/odoo-server <--Here inside is the odoo.py script to create a new custom module.

sudo ./odoo.py scaffold myfieldsinsaleorder /odoo/custom/addons <--This is my directory for my custom modules, this code create a new custom module

cd /odoo/custom/addons/myfieldsinsaleorder

Edit __openerp__.py and save this settings:

locate: 'depends': ['base'], and add 'sale' and 'product' like this:

'depends': ['base','sale','product'],

Edit models.py and save this settings: <-- here you can add your custom fields

from openerp import models, fields, api

class myfieldsinsaleorder(models.Model):

_inherit = 'sale.order'

mycustomfield1 = fields.Char('My custom field 1 Label', default = 'My custom field 1 default value')

Edit templates.xml and save this settings: <-- here you can add the custom field to sale order form and print to sale order quotation document



<record id="my_view_saleorder_form_inherit" model="ir.ui.view">

<field name="name">my.view.saleorder.form.inherit</field>

<field name="model">sale.order</field>

<field name="inherit_id" ref="sale.view_order_form"/>

<field name="arch" type="xml">

<!-- Locate the position to add a new tab "My New Tab" in "Form View Sale Order"-->

<xpath expr="//page[1]" position="after">

<page string="My New Tab">


<!-- here we add our new field "mycustomfield1" inside our new tab -->

<field name="mycustomfield1"/>






<!-- This is to add our field in the quotation saler order and print -->

<template id="my_report_saleorder_document" inherit_id="sale.report_saleorder_document">

<xpath expr="//table[@class='table table-condensed']" position="after">

<strong>My label field for quotation sale order: </strong><span t-field="doc.mycustomfield1"/><br></br>

<!-- with this code we can add fields from other module (products) to sale order document and print -->

<strong>Field get it from product module: </strong><span t-field="doc.product_id.product_tmpl_id.warranty"/>





On 2/26/14, 5:11 AM


You can create custom field in Sale order by creating a module or from GUI.

From GUI, you can add the custom field using menu: Settings > Technical > Database Structure > Fields (Make sure the user has 'Technical Features' enabled in their access rights) To make them show up on the UI itself you will then need to add them to a view (Settings > Technical > User Interface > Views).

I need create with new module, i don't want after update lose everything

Jhon Felipe Urrego Mejia
on 2/26/14, 6:27 PM
Bart Criel
On 2/27/14, 2:58 AM


You need to create 2 files: a xml- and a py-file. The example below shows how to add a field 'MRSP' to the product form.

Content of the py-file

class product_product(osv.osv):
    _inherit = "product.product"

    _columns = {
                'mrsp': fields.float('MRSP', digits_compute=dp.get_precision('Product Price'),
                                    help="The Manufacturer Recommended Sales Price."),


Example content of the xml-file (this depends heavily on where and how you want to put the field, so I can't be more specific; use existing xml files as inspiration)

<record id="product_mrsp_form_view" model="ir.ui.view">
    <field name="name">product.normal.form</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="product.product_normal_form_view"/>
    <field eval="7" name="priority"/>
    <field name="arch" type="xml">
               <field name="mrsp" attrs="{'invisible': [('sale_ok', '!=', True)]}"/>

You of course need to add these files in __init__ and __openerp__


hI, how can i create other flange in sales order?

Jhon Felipe Urrego Mejia
on 3/5/14, 12:20 AM

What do you mean with "flange"?

Ring Pharma NV, Bart Criel
on 3/5/14, 4:19 PM


Jhon Felipe Urrego Mejia
on 3/5/14, 6:52 PM

Hi please give me some support i need add 5 columns to sales order line, tnks

Jhon Felipe Urrego Mejia
on 3/19/14, 7:08 PM

This topic http://help.openerp.com/question/16336/how-i-can-create-module-openerp-7/ is full of interesting and relevant information. Use a simple existing module (e.g. sale_margin) as example or inspiration.

Ring Pharma NV, Bart Criel
on 3/27/14, 10:46 AM

I need create with new module, i don't want after update lose everything

You may refer the following link for developing custom module: http://www.pixelite.co.nz/article/adding-additional-fields-using-custom-module-openerp-7

on 2/27/14, 12:20 AM
Mayur Maheshwari
On 2/26/14, 7:33 AM

But .it's batter you add custom field in xml with use of view inheritance.

Jhon Felipe Urrego Mejia
on 2/26/14, 1:21 PM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 2/26/14, 3:57 AM
Seen: 41051 times
Last updated: 7/30/18, 9:02 PM