How to get Tax on sale line while creating/updation sale in JSON


(Piyush Agrawal) #1

We are unable to get/identify taxes on Sale line.
Can I know the API request/method for it?

I am tryting to make json api request.

Thank you,


(Sergi Almacellas Abellana) #2

Just read/write the taxes field of the sale line to obtain/set the taxes of the sale line.


(Piyush Agrawal) #3

Thank you for your answer
but still I am not clear with the what parameter/s is/are need to send with API request.

Can you give me an example for JSON?


(Sergi Almacellas Abellana) #4

Just use the read endpoint to read the field or the write to write on it.


(Piyush Agrawal) #5

I am not able to understand the params which need to send.

taxes = fields.Many2Many(‘sale.line-account.tax’, ‘line’, ‘tax’, ‘Taxes’,

what values need for line,tax,Taxes??

Thank you


(Sergi Almacellas Abellana) #6

You don’t need to send anything about this values. This is the field definition and all the possible values are explained on the docs

The API is exactly the same for all the tryton models, you only have to understand how the modules you are working on are structured and then interact with the data.


(Piyush Agrawal) #7

I think we miss something!
I need to know the taxes applied on particular product while product is attach with sale line.

So, I want to know the taxes for creating/editing sale line.

Thank you,


(Sergi Almacellas Abellana) #8

This is automatically managed by the client using the on_change_product method (which sets the taxes when the user selects a product). Here is the code


(Piyush Agrawal) #9

can you able to give me example for json?
I am only lacking in on_change_product method.

Thank you,


(Sergi Almacellas Abellana) #10

Indeed is not as simple, you have to read the product taxes, and then apply the tax rules (if any). That’s why I refered to the code where everything is explained.