Odoo Help

Welcome!

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.

0

I want to genarate a report from sale order line without any categorywise of product list pls help-- [Closed]

By
Odoo
on 4/3/14, 3:51 AM 539 views

The Question has been closed for reason: duplicate question

by
Odoo
on 07/22/2014 23:51:46

This is my code

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

How to change this code for a all product printing a sale report ..from sale order line,currently it is selecting from a wizard ,there i hv to select the category,frm date and to date.. Nw i want to generate report fromdate to todate without any category and print all products which is saleable from sale order line

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

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