This question has been flagged
3 Replies
4183 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

Avatar
Discard

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.

Author Best Answer

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

Avatar
Discard
Best Answer

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.

Avatar
Discard