Odoo Help


This community 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.


I want to genearte a report [Closed]

on 4/3/14, 3:44 AM 589 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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)


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