Skip to Content
Menu
This question has been flagged
1186 Views
























Product Size Opening Qty. Received Qty. Issue Qty. Adjustment Qty. Balance Qty.


















model:

from odoo import models, fields, api, _ 



class InventoryReport(models.TransientModel):
_name = 'inventory.valuation.wizard'
_description = "Print Inventory Valuation"

date_form = fields.Datetime('From', default=lambda self: fields .datetime.now(), required=True)
date_to = fields.Datetime('To', default=lambda self: fields.datetime.now(), required=True)
product_group = fields.Many2one('product.group', string='Product Group')

def print_action_report(self):
domain = []
product_group = self.product_group
if product_group:
domain += [('product_group', '=', product_group.id)]

products = self.env['product.template'].search_read(domain)

data = {
'form_data': self.read()[0],
'products': products
}
return self.env.ref('custom_valuation_report.action_Inventory_report_valuation ').report_action(self, data=data)


here when i select product group its show group wise product in report. but how can i show all products in report when i not select any product group 


Avatar
Discard

Your code looks good and it should work if you not select any product group because the domain variable will not have any filters []. What the result you are getting?

Author

I fix it. Thank you