Community mailing list archives

community@mail.odoo.com

Re: Price on sale order

by
kristian
- 11/01/2016 19:56:51
Dominique, Hi

Sorry, I was talking about account.invoice

But well, I don't know if that could apply, I don't think so

Don't be misled by the title, I made a mistake on it, it is account.invoice

But, if You say that this can work... I don't know, don't think so

On Tue, Nov 1, 2016 at 7:52 PM, Dominique KON SUN TACK <dominique.k@elico-corp.com.sg> wrote:

Hi,

I think when you write:
If self.amount_tax
Python evaluates the sale order, while what you want is evaluating the sale order line (line in self.order_line)


On Nov 2, 2016 04:07, "Kristian Koci" <kristian.koci@gmail.com> wrote:
Ron, thank you

Damn, I'm sorry, yes, the confusion is about sales

Because actually this is about account.invoice

It's my error, I'm so sorry

But again, it's just about how to sum up these quantities (product pridce + tax if applicable) in any case

That is what I don't seem to accomplish, I think there is something wrong with my conditionals

You have an invoice, 40 products on it, 30 are tax affected, 10 are not

These fields should calculate amount + tax, and only amount in case it doesn't apply

Product 1 - price - tax %
Product 2 - price - tax %
Product 3 - price - no tax

Field 1: (Product 1 + tax) + (Product 2 + tax)
Field 2: (Product 3)

On Tue, Nov 1, 2016 at 3:57 PM, Ronald Wopereis <woepwoep@gmail.com> wrote:
Kristian, perhaps the confusion is that you speak of sales order lines,
whereas i think you mean (select tax%, sum(...) from sales order lines where sales order number = ??? group by tax%) ?
thx Ron


2016-11-01 15:02 GMT+01:00 Kristian Koci <kristian.koci@gmail.com>:
Yes I'm sure, but I think my question isn't understood at all

This is not about showing not showing

Just two fields, before total_amount:

One sums all products with tax on the sale.order (if any)

The other sums all products without tax on the sale.order (if any)

If all products are tax affected, one of these fields won't sum anything, and viceversa

That's it

On Tue, Nov 1, 2016 at 9:52 AM, Dominique Chabord <dominique.chabord@sisalp.org> wrote:
Are you sure of your answer ? I understand that you consider that "no tax" is not equivalent to taxe=0%. Maybe a specific reason of your context, just explain why. And of course, taxes are always specified per line. 2016-11-01 14:37 GMT+01:00 Kristian Koci <kristian.koci@gmail.com>:
> ON the same sale order > > On Tue, Nov 1, 2016 at 9:31 AM, Kristian Koci <kristian.koci@gmail.com> > wrote: > > No > > It is a total amount, some sales have products with taxes, and products > without taxes > > On Tue, Nov 1, 2016 at 5:12 AM, Dominique Chabord > <dominique.chabord@sisalp.org> wrote: > > I guess you get it if you use a 0% tax rate. don't you ? > > 2016-11-01 2:12 GMT+01:00 Kristian Koci <kristian.koci@gmail.com
>: >> 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 >> Public repository: https://github.com/kkoci
>> >> >> >> >> _______________________________________________ >> Mailing-List: https://www.odoo.com/groups/community-59
> > > > -- > Dominique Chabord - SISalp > Logiciel libre pour l'entreprise Tryton et open-source Odoo, OpenERP > 18 avenue Beauregard 74960 Cran Gevrier > 145A rue Alexandre Borrely 83000 Toulon > tel(repondeur) +33(0)950274960 fax +33(0)955274960 mob +33(0)622616438 > http://sisalp.fr > http://openerp-online.fr > https://twitter.com/SISalp l'actualité de vos services en temps réel. > > _______________________________________________ > Mailing-List: https://www.odoo.com/groups/community-59 > Post to: mailto:community@mail.odoo.com > Unsubscribe: https://www.odoo.com/groups?unsubscribe > > > > > -- > Kristian Koci > Linux User #582221 > Public repository: https://github.com/kkoci > > > > > > > > -- > Kristian Koci > Linux User #582221 > Public repository: https://github.com/kkoci > > > > > _______________________________________________ > Mailing-List: https://www.odoo.com/groups/community-59 > Post to: mailto:community@mail.odoo.com > Unsubscribe: https://www.odoo.com/groups?unsubscribe
-- Dominique Chabord - SISalp Logiciel libre pour l'entreprise Tryton et open-source Odoo, OpenERP 18 avenue Beauregard 74960 Cran Gevrier 145A rue Alexandre Borrely 83000 Toulon tel(repondeur) +33(0)950274960 fax +33(0)955274960 mob +33(0)622616438 http://sisalp.fr http://openerp-online.fr https://twitter.com/SISalp l'actualité de vos services en temps réel.

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Kristian Koci
Linux User #582221

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe


_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Kristian Koci
Linux User #582221

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe

_______________________________________________
Mailing-List: https://www.odoo.com/groups/community-59
Post to: mailto:community@mail.odoo.com
Unsubscribe: https://www.odoo.com/groups?unsubscribe




--
Kristian Koci
Linux User #582221