Odoo Help

Welcome!

This community 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.

0

Adding custom field to sales order product lines?

By
Clemens Kroell
on 1/17/14, 6:41 AM 800 views

hi,

i try to add a custom text field "detail" to the product lines in a sales order. i created a new module and added the following code:

__init__.py

import sales_order_detail_field

sales_order_detail_field.py

from openerp.osv import fields, osv

class sales_order_detail_field(osv.Model):
        _name = 'sale.order'
        _inherit = 'sale.order.line'
        _columns = {
                'detail': fields.text('Detail'),
        }

sales_order_detail_field(

sales_order_detail_field.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
   <record model="ir.ui.view" id="detail_field_in_view">
    <field name="name">New Sale Order field detail</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='order_line']/form/notebook/page[@string='Order Line']//field[@name='product_uom_qty' ]" position="before">
        <field name="detail" />
    </xpath>
    </field>
</record>
    </data>
</openerp>

but when i reload my openerp window, i jus tget the following error

raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Fehler w\xe4hrend der Pr\xfcfung des Feldes field(s) arch: Invalid XML for View Architecture!')

any advice what's wrong here? maybe the xml?

0
Andreas Marpmann
On 2/11/14, 9:33 AM

<field name="name">New Sale Order field detail</field> <field name="detail"/>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 1/17/14, 6:41 AM
Seen: 800 times
Last updated: 3/16/15, 8:10 AM