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 customize account invice line ,using onchange of tax field without click on update button? Need A help...

By
Odoo
on 6/25/14, 2:27 PM 580 views

This is a one2many line from invoice line -Here i mentioned an example of sample product as service...

Product Service

Description xx

Account xx

Quantity- 1

Unit Price -10

Gross Amount -10(10*1)                             #This is a my own custom field[quantity*unitprice]

Taxes - 2

Amount  12(10+2)                               [Gross Amount+Taxes]

 

Above field values are from  customer invoice line from accounting  ,here I need one customization on invoice line  when onchage of taxes is change Amount should be changed ie(tax+gross amount) should populate in the Amount Field without pressing the update button .I need to change using tab (onchange of tax).How it is possible...Please need a help..........

Here I attached my code -----Please check

 

class account_new(osv.osv):
    _inherit="account.invoice.line"

    def onchange_schemid(self,cr,uid,ids,price_unit,quantity,context=None):
            if price_unit:
                amount_new=price_unit*quantity
                return {'value':{'new_total':amount_new}}
            return {}
        
    def onchange_tax_id(self,cr,uid,ids,new_total,invoice_line_tax_id,context=None):
        a=self.pool.get('account.invoice.line').read(cr,uid,invoice_line_tax_id)
        if invoice_line_tax_id:
                amount_with_tax=new_total+invoice_line_tax_id
                return {'value':{'new_with_tax':amount_with_tax}}
        return {}
        
    _columns={
              'new_total': fields.float('Gross Amount', required=True),
              'new_with_tax':fields.float('Amount')
              }
    
    
account_new()

0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 6/26/14, 1:28 AM

Hi

Refer following link may help you

http://stackoverflow.com/questions/15608710/how-to-load-one-to-many-children-on-onchange-event

http://stackoverflow.com/questions/20954412/create-and-edit-items-of-a-one2many-field-through-on-change-method

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: 6/25/14, 2:27 PM
Seen: 580 times
Last updated: 3/16/15, 8:10 AM