Community mailing list archives

community@mail.odoo.com

Price on sale order

by
kristian
- 10/31/2016 21:09:44
Hi

I'm going to explain what I'm trying to accomplish, so hopefuly somebody can help me.

On sales lines, You got the total amount_untaxed and amount_tax

These are self explanatory.

However, I've added to fields to this form, which should take, total price sum of all products on sales line which are tax affected, and total price sum of all products on sales line which aren't tax affected.

For example, I have 50 products on a sale.order, from these 50 products

40 are tax affected
10 aren't tax affected

So these fields, should sum and show me,

1) The total sum of 40 tax affected products (with taxes included)
2) The total sum of 10 tax unaffected products

So far I've tried with this method:

    @api.one
    @api.depends('invoice_line.price_subtotal', 'tax_line.amount')
    def extras(self):
        self.impo = sum(line.price_subtotal for line in self.invoice_line) if self.amount_tax and self.amount_tax > 0 else 0
        self.exe = sum(line.price_subtotal for line in self.invoice_line) if not self.amount_tax or self.amount_tax == 0 else 0

    rec=0

'impo' should sum all tax affected, while 'exe' should sum all tax unaffected products.

But so far this isn't showing me the expected results.

Actually only 'exe' is working, but it takes all lines with taxes and sum the up, like the amount_total field.

How can I accomplish this?

I hope I've explained myself

Thank You

--
Kristian Koci
Linux User #582221