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

**URL:** https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321
**Category:** Developer
**Created:** [March 20, 2017, 7:16am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321 "2017-03-20T07:16:59Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![piyush8191](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@piyush8191](https://discuss.tryton.org/u/piyush8191)
#### Post date: [March 20, 2017, 7:16am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/1 "2017-03-20T07:16:59Z")

</div>

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,

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 20, 2017, 8:28am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/2 "2017-03-20T08:28:01Z")

</div>

Just read/write the [taxes field](http://hg.tryton.org/modules/sale/file/4db6d17c8c28/sale.py#l1029) of the sale line to obtain/set the taxes of the sale line.

---

<div class="post-metadata">

### Author: ![piyush8191](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@piyush8191](https://discuss.tryton.org/u/piyush8191)
#### Post date: [March 20, 2017, 9:05am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/3 "2017-03-20T09:05:47Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 20, 2017, 9:20am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/4 "2017-03-20T09:20:49Z")

</div>

Just use the [read](http://doc.tryton.org/4.2/trytond/doc/ref/models/models.html?highlight=read#trytond.model.ModelStorage.read) endpoint to read the field or the [write](http://doc.tryton.org/4.2/trytond/doc/ref/models/models.html?highlight=read#trytond.model.ModelStorage.write) to write on it.

---

<div class="post-metadata">

### Author: ![piyush8191](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@piyush8191](https://discuss.tryton.org/u/piyush8191)
#### Post date: [March 20, 2017, 9:54am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/5 "2017-03-20T09:54:05Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 20, 2017, 10:28am UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/6 "2017-03-20T10:28:10Z")

</div>

> [@piyush8191](#):
>
> 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??

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](http://doc.tryton.org/4.2/trytond/doc/ref/models/fields.html#ref-models-fields)

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.

---

<div class="post-metadata">

### Author: ![piyush8191](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@piyush8191](https://discuss.tryton.org/u/piyush8191)
#### Post date: [March 20, 2017, 12:56pm UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/7 "2017-03-20T12:56:18Z")

</div>

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,

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 20, 2017, 1:24pm UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/8 "2017-03-20T13:24:55Z")

</div>

> [@piyush8191](#):
>
> 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.

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](http://hg.tryton.org/modules/sale/file/93468680f042/sale.py#l1179)

---

<div class="post-metadata">

### Author: ![piyush8191](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/p/f475e1/32.png) [@piyush8191](https://discuss.tryton.org/u/piyush8191)
#### Post date: [March 20, 2017, 1:39pm UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/9 "2017-03-20T13:39:32Z")

</div>

can you able to give me example for json?  
I am only lacking in on\_change\_product method.

Thank you,

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 20, 2017, 1:52pm UTC](https://discuss.tryton.org/t/how-to-get-tax-on-sale-line-while-creating-updation-sale-in-json/321/10 "2017-03-20T13:52:25Z")

</div>

> [@piyush8191](#):
>
> can you able to give me example for json?I am only lacking in on\_change\_product method.

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.
