Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilità
- Magazzino
- PoS
- Progetti
- MRP
La domanda è stata contrassegnata
Hello,
Please try this code,
@api.depends('product_uom_qty', 'discount', 'price_unit', 'tax_id','receive_in_advance')
def _compute_amount(self):
"""Compute the amounts of the SO line."""
for line in self:
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
if line.product_uom_qty and line.receive_in_advance:
price = price - (line.receive_in_advance/line.product_uom_qty)
taxes = line.tax_id.compute_all(price, line.order_id.currency_id, line.product_uom_qty, product=line.product_id, partner=line.order_id.partner_shipping_id)
line.update({
'price_tax': sum(t.get('amount', 0.0) for t in taxes.get('taxes', [])),
'price_total': taxes['total_included'],
'price_subtotal': taxes['total_excluded'],
})
If you use UOM, then please change the code accordingly.
Hope this will help you,
Thanks
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
Registrati| Post correlati | Risposte | Visualizzazioni | Attività | |
|---|---|---|---|---|
|
How to add a sequence a field?
Risolto
|
|
2
dic 24
|
22330 | |
|
|
0
set 24
|
1561 | ||
|
|
3
ago 24
|
3079 | ||
|
|
0
feb 24
|
2251 | ||
|
|
0
feb 24
|
1632 |
how you calculate tax amount?is it tax of subtotal-received in advance?