Created
October 28, 2014 12:43
-
-
Save Altreus/4c8e20bb43b9b37f131f to your computer and use it in GitHub Desktop.
The best thing about python is how it forces you to write readable code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return reduce(lambda x,y: x+y, [ l.product_id.categ_id.name <> 'Margin' and l.price_subtotal or (l.price_unit * (l.product_uos and l.product_uos_qty or l.product_uom_qty)) for l in o.order_line ]) - (reduce(lambda x,y: x+y, [ reduce(lambda x, o: x + o.price_subtotal, i.invoice_line, 0) for i in o.invoice_ids if i.name and i.comment == 'PX' and i.state != 'cancel']) if [i for i in o.invoice_ids if i.name and i.comment == 'PX' and i.state != 'cancel'] else 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment