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

Extending sale.order in v8.

By
Kit Sunde
on 8/22/14, 5:18 PM 769 views

I'm trying to extend the sale.order model to have a relation with an email chain model I've created in my custom module. So I created this:

 

    class sales_order_email_field(osv.Model):
        _name = 'sale.order'
        _inherit = 'sale.order'
        _columns = {
            'email_chain': fields.many2one(
                'sale.order_email.collection',
                'Email Chain',
                required=False
            )
        }

    sales_order_email_field()

and in my XML:

    <record id="view_res_sale_line_email_chain_form" model="ir.ui.view">
          <field name="name">sale.order.form.inherit</field>
          <field name="model">sale.order</field>
          <field name="type">form</field>
          <field name="priority" eval="8"/>
          <field name="inherit_id" ref="sale.view_order_form"/>
          <field name="arch" type="xml">
              <data>
                  <xpath expr="//field[@name='product_uom_qty']"
                         position="after">
                      <field name="email_chain"/>
                  </xpath>
              </data>
          </field>
      </record>

Buy I get an error message:

    Error details: Field `email_chain` does not exist

What am I doing wrong?

Hi, Just make sure that your .py file is imported into __init__.py file. And then just install / upgrade your custom module.

Emipro Technologies Pvt. Ltd.
on 8/23/14, 1:16 AM

The python file is loaded.

Kit Sunde
on 8/23/14, 12:55 PM
1

Gopakumar N G

--Gopakumar N G--
1198
| 5 3 7
Cochin, India
--Gopakumar N G--

Senior Software Engineer at BroadTech IT Solutions Pvt. Ltd.

Gopakumar N G
On 8/23/14, 1:28 AM

You have created the field email_chain in sale.order model and adding it in the sale.order.line models view. For using your new field in the sale order's product line it must be created in sale.orderl.line model.

Sry, but in this case the error message is why: Error details: Field `email_chain` does not exist? In my opinion this trouble is coming from lack the field, not?

klacus
on 8/23/14, 1:54 AM

Ah that makes a lot of sense, my xpath was targeting the Order Line that's inline of the sales order, so the active model wasn't actually the sale order. Thanks.

Kit Sunde
on 8/24/14, 5:54 AM
0
klacus
On 8/23/14, 1:10 AM

Please try to restart the server, and reinstall your custom modul. Your field is not exists in sale_order model.

I tried that, I'm getting the same error.

Kit Sunde
on 8/23/14, 12:54 PM

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

2 follower(s)

Stats

Asked: 8/22/14, 5:18 PM
Seen: 769 times
Last updated: 2/29/16, 2:41 AM