Skip to Content
Menu
This question has been flagged
3 Replies
5424 Views

how can i get product quantity for a particular date based on stock.move in odoo 11 community version

please help

thanks in advance

Avatar
Discard
Best Answer

I think this can help you without any customisation

Inventory --> Reporting --> Product Moves   after that set group by Product, measures as Done and Pivot view.  From here we can download as XLS file also.

You can add multiple filters as per your need


Avatar
Discard
Best Answer

HI,

@api.multi

def count_product_qty(self):

stock_move= self.env['stock.move'].search([

                                                                              ('product_id', '=', <your_product_id>), 
                                                                              ('date', '>=', <your date>), 
                                                                              ('date', '<=', <your date>),
                                                                              ('state', '=', 'done')])

qty = sum(move.qty_done for move in stock_move if move)

i hope it will helpful.

Thank you. 

Avatar
Discard
Best Answer

Hi Mr.Stephen,

Yeah, we can get the value via self.env with  search date.

@api.multi

def generate_record(self):

stock_obj= self.env['stock.picking'].search([('date','>=',self.date),('date','<=',self.date)])

if stock_obj:           
            for record in stock_obj:
                for line in record.move_lines:
                    qty =[]
                    if line.state =='done' and line.product_id.id:
                           qty += line.quantity

I hope my answer will for you...

Thank You.

Avatar
Discard