Community mailing list archives
Re: Price on sale orderby
NoIt 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 <firstname.lastname@example.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 <email@example.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/-- 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. community-59> Post to: mailto:firstname.lastname@example.org > Unsubscribe: https://www.odoo.com/groups? unsubscribe