Odoo Help


I want to genearte a report [Closed]

on 4/3/14, 3:44 AM 847 views

The Question has been closed for reason: duplicate question

on 06/26/2014 08:00:46

def _get_prdouct_details(self, category_id): product_ids = self.pool.get('product.product').search(self.cr, self.uid, [('categ_id','=',category_id)]) lines = [] self.res[category_id]={} self.res[category_id]['total_qty']=0.00 self.res[category_id]['total_amt']=0.00

for product_id in product_ids: line = {} product=self.pool.get('product.product').browse(self.cr, self.uid, [product_id] )[0] line['product_name'] = product.name sale_line_ids = self.pool.get('sale.order.line').search(self.cr, self.uid, [('product_id','=',product.id),('state','not in',['cancel','draft'])]) qty=0.00 amount=0.00 for sale_line_id in sale_line_ids: sale_line = self.pool.get('sale.order.line').browse(self.cr, self.uid, [sale_line_id])[0] amount+=sale_line.price_subtotal qty+=sale_line.product_uom_qty average=0.00 if qty: average=amount/qty line['category_id'] = category_id line['product_id'] = product_id line['average']=average line['amount']=amount line['qty']=qty line['percentage']=0.00 if self.total_amount and amount: line['percentage'] = (amount / self.total_amount) * 100 self.res[category_id]['total_qty']+=qty self.res[category_id]['total_amt']+=amount lines.append(line) return lines

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


Asked: 4/3/14, 3:44 AM
Seen: 847 times
Last updated: 3/16/15, 8:10 AM