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 2 fields in column account_invoice_line ???

By
wizardz
on 12/4/15, 5:26 AM 353 views

How can I add 2 fields there?

I try this:

account_invoice.py

class account_invoice_line(osv.osv):

_inherit = 'account.invoice.line'

_columns = {
'product_position': fields.char('Position'),
'product_note': fields.text('Produkt Notiz'),
}

But how must look the -xml file ????


The best is to make 2 new columns there.. , I need really help please

You're about "Customer Invoice" or "Supplier Invoice"? each has it's own form! you'll need to inherit the right one in XML and add your columns in inherited record.

Temur
on 12/4/15, 8:23 AM
0
wizardz
On 12/4/15, 8:56 AM

I have the 2 fields in sale_order. How can I import that to the invoice fields, when I'm making a invoice from the sale_order?

I need to import the inside values from the fields from sale_order to account_invoice

0
HappyOdoo
On 12/4/15, 8:25 AM

wizardz,

it's possible.

follow the below code.

account_invoice.py file

from openerp.osv import fields, osv

from openerp import models,fields,api

class account_line(models.Model):

_inherit = ['account.invoice.line']

product_position = fields.Char('Position')

product_note = fields.Char('Produkt Notiz')

account_line()

Now goto the xml file.

<?xml version="1.0" encoding="UTF-8"?>

<openerp>

<data>

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

<field name="name">account.line.inherit.view</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_form"/>

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

<field name="discount" position="after">

<field name="product_position" />

<field name="product_note" />

</field>

</field>

</record>

</data>

</openerp>

you can see in print screen.



if you want that small module inform me.

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

1 follower(s)

Stats

Asked: 12/4/15, 5:26 AM
Seen: 353 times
Last updated: 12/4/15, 8:56 AM