Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

 3 Answer(s)

  • Hello Faisal,

    If you want to add fields in purchase.order.line then inherit this class purchase_order_line and add fields according your client requirment and use xpath in .xml file in your module .
    Exp- In .py file in your module

    class purchase_order_line(osv.osv):

    And then add same fields account.invoice.line to inherit account_invoice_line class form account module and also inherit the this function given below.

    class account_invoice_line(osv.osv):
    def _amount_line(self, cr, uid, ids, prop, unknow_none, unknow_dict):
            res = {}
            tax_obj = self.pool.get('')
            cur_obj = self.pool.get('res.currency')
            for line in self.browse(cr, uid, ids):
                price = line.price_unit * (1-( or 0.0)/100.0)
                taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, partner=line.invoice_id.partner_id)
                res[] = taxes['total'] + (line.quantity * line.cartage)
                print"==========Add here fields cartage ==========",res[]
                if line.invoice_id:
                    cur = line.invoice_id.currency_id
                    res[] = cur_obj.round(cr, uid, cur, res[])
            return res
  • If you want to Get custom field in invoice from purchase order in OpenERP (Odoo) follow the below mentioned steps:

    Step-1 Go to settings Menu and click it.
    Step-2 Go to sales -> sales form content -> custom fields-> PURCHASE ORDER.LINE all three available fields > After that click on done Button

    In Odoo/OpenERP-8 we can inherit product.template model or inherit the tree view of purchase.order.line and add the invoice filed .( by inheriting and using xpath in .xml file)

    For Example..

    field_name = field.Char(related="product_id.invoce_line", string="add_newfield") ,

  • yeah i want that in odoo v8 i inherited that field using xpath in purchase.order.line but i want that field also in invoice and i want to calculate totat and subtotal amount based on that field if price_unit field is empty or equal to 0

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: