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

how to add columns to account.invoice new API ?

By
Qamar Soft
on 1/10/15, 3:33 PM 1,496 views

I would like to add new column to the table account_invoice

I tried using:

from openerp import fields  as fieldss

    product_id= fieldss.related('order_line', 'product_id', type='many2one', relation='product.product', string='Product'),

the purpose:  add product in the view account invoice view search  <record id="view_account_invoice_filter" model="ir.ui.view">

 

There could be more than one product in the invoice line which product you want to store in the account.invoice. If you just want to search the product in accout.invoice then look in to sale.order model for reference, which includes product_id as a related field.

Emipro Technologies Pvt. Ltd.
on 1/11/15, 1:18 AM

Yes I want to search product on account.invoice but the the account module is writen in differnet APÏ

Qamar Soft
on 1/11/15, 7:12 AM

May I know, what you exactly want to get as value in that column "name_product"

Akhil P Sivan
on 1/11/15, 7:43 AM

I updated my question

Qamar Soft
on 1/11/15, 8:21 AM
1

Emipro Technologies Pvt. Ltd.

--Emipro Technologies Pvt. Ltd.--
Tiny ERP Pvt Ltd
http://www.odoo.com
5975
| 6 7 8
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Being an emerging leader in IT market since 2011, Emipro Technologies Pvt. Ltd. has been providing a wide range of business solutions in Odoo & Magento. We are pleased to have a large pool of contented customers with our meticulous work in the domain of ERP & e-Commerce. A ray of relief & satisfaction to  our customers heart by our successful deployment in their organization, purely represents our success in Odoo platform. Hence, we take pride for being an Odoo partner with a vision of expanding our strategic alliances with our customers to offer them high value-added, trustworthy & cost effective solutions.

 

Since establishment, our business has span across 11 countries of the world. Our customers are companies of all sizes ranging from start-ups to large enterprises, who realize that they need a professional business solutions to generate revenue streams, establish proper communication channels or streamline business operations. Standing with strong determination of customer satisfaction, observing each minute detail of their business processes, providing proper guidance and moving forth to develop product accordingly adds our value and reliability among our customers. 

 

We are blessed with efficient, passionate & eclectic young developers who have come across almost all kinds of business profiles, working with full dedication, applying creativity & new features in existing modules and completing customer's projects successfully on predefined target. Our in-depth knowledge while giving business solutions in Odoo allows us to offer following services to our customers :

 

  • Consulting
  • Installation, Configuration & Customization
  • Training & Support
  • Maintenance
  • Upgradation
  • Documentation
  • Crafting community modules
  • Drafting videos on demand
  • Smart Apps development

We will be :) to welcome you @ www.emiprotechnologies.com to solve any kind of your business needs around Odoo. However we are just an inch away from you by email info@emiprotechnologies.com or a tweet to @EmiproTech

Emipro Technologies Pvt. Ltd.
On 1/11/15, 8:25 AM

Try this

from openerp import models,fields,api

class account_invoice_ext(models.Model):
        _inherit = 'account.invoice'

product_id=fields.Many2one("product.product",related="invoice_line.product_id",string="Product")
    
 

Your xml file

 

        <record id="view_account_invoice_filter_inherit" model="ir.ui.view">
            <field name="name">account.invoice.inherit.select</field>
            <field name="model">account.invoice</field>
            <field name="inherit_id" ref="account.view_account_invoice_filter"/>
            <field name="arch" type="xml">
                <field name="period_id" position="after">
                    <field name="product_id"/>
                </field>
             </field>
         </record>

Hope this helps !!.

I got : File "/opt/odoo/odoo/openerp/models.py", line 1276, in _validate_fields raise ValidationError('\n'.join(errors)) ParseError: "ValidateError Field(s) `arch` failed against a constraint: Invalid view definition Error details: Field `product_id` does not exist

Qamar Soft
on 1/11/15, 9:10 AM

I tried it in different DB same result

Qamar Soft
on 1/11/15, 9:22 AM

Did you updated the module? I have tried this, it working perfectly. Did you restarted the server and updated the module?

Emipro Technologies Pvt. Ltd.
on 1/11/15, 10:04 AM

your code apair perfect, I update & unistalled & installed the module I get that error. The field doesn't create a column in the DataBase !!!!!

Qamar Soft
on 1/11/15, 12:09 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

4 follower(s)

Stats

Asked: 1/10/15, 3:33 PM
Seen: 1496 times
Last updated: 3/16/15, 8:10 AM