From be905c9432b2987fff7da3434a114286ffa774b7 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 6 Mar 2014 11:41:43 +0100 Subject: [PATCH 01/20] [ADD] Start report picking bzr revid: jco@openerp.com-20140306104143-8lmnpk006v1cr6xf --- addons/stock/__openerp__.py | 1 + addons/stock/stock_report.xml | 9 +++++++ addons/stock/views/report_stockpicking.xml | 29 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 addons/stock/views/report_stockpicking.xml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 20a6ee1ccfd..dee989c88ba 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -88,6 +88,7 @@ Dashboard / Reports for Warehouse Management will include: 'report/report_stock_view.xml', 'board_warehouse_view.xml', 'res_config_view.xml', + 'views/report_stockpicking.xml', ], 'test': [ 'test/inventory.yml', diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml index d5a78efa370..08f1720d9a0 100644 --- a/addons/stock/stock_report.xml +++ b/addons/stock/stock_report.xml @@ -1,6 +1,15 @@ + + diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml new file mode 100644 index 00000000000..7f193fe4e0f --- /dev/null +++ b/addons/stock/views/report_stockpicking.xml @@ -0,0 +1,29 @@ + + + + + + From b3c7fd4332137fd377aeb3458e9ce665ce1503b6 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 7 Mar 2014 18:28:03 +0100 Subject: [PATCH 02/20] [IMP] Improve picking report with moves, barcode and picking type name + addresses bzr revid: jco@openerp.com-20140307172803-x2x99msrs44ws32a --- addons/stock/views/report_stockpicking.xml | 56 ++++++++++++++++------ 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml index 7f193fe4e0f..6839485e287 100644 --- a/addons/stock/views/report_stockpicking.xml +++ b/addons/stock/views/report_stockpicking.xml @@ -6,20 +6,48 @@
-
- - - - - - - - - - - -
-
+
+ +
+
+ Supplier Address: +
+
+ Warehouse Address: +
+
+ Customer Address: +
+
+
+

VAT:

+
+ +

+ : + +

+

Quantities Demanded

+ + + + + + + +
+

Quantities Chosen

+ + + + + + + + + +
From a8ce48719134467c3524789c1affddcbf4f3bb25 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 10 Mar 2014 10:44:43 +0100 Subject: [PATCH 03/20] [IMP] Adapt report with package and lot + uom security bzr revid: jco@openerp.com-20140310094443-4yapquz3kgi6ekm0 --- addons/stock/views/report_stockpicking.xml | 41 ++++++++++++++++++---- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml index 6839485e287..551ada4422f 100644 --- a/addons/stock/views/report_stockpicking.xml +++ b/addons/stock/views/report_stockpicking.xml @@ -28,26 +28,55 @@ : + + + + + + + + + + + + + + +
Order (Origin)Scheduled Date
+ + + +
+ +

Quantities Demanded

- +
+

Quantities Chosen

- - - - - + + +
+ : + + : + + + : + +
+
From 34b0a0dcb86af45507cc9b06c8a3c02d9f261834 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 12 Mar 2014 12:01:25 +0100 Subject: [PATCH 04/20] [IMP] Remove rml report links bzr revid: jco@openerp.com-20140312110125-jq051j81frkx3eyx --- addons/stock/stock_report.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/addons/stock/stock_report.xml b/addons/stock/stock_report.xml index 08f1720d9a0..ecb313b449f 100644 --- a/addons/stock/stock_report.xml +++ b/addons/stock/stock_report.xml @@ -11,10 +11,7 @@ file="stock.report_picking" /> - - - From 04115a42d3a3623545d9343c21119e6c70ea01d6 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 12 Mar 2014 21:41:25 +0100 Subject: [PATCH 05/20] [WIP] Inventory value in stock valuation report bzr revid: jco@openerp.com-20140312204125-qolc6yisb0rw6zfr --- .../stock_account/wizard/stock_valuation_history.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 7657ac53b4b..92d7b4f6633 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -74,7 +74,8 @@ class stock_history(osv.osv): 'date': fields.datetime('Operation Date'), 'price_unit_on_quant': fields.float('Value'), 'cost_method': fields.char('Cost Method'), - 'inventory_value': fields.function(_get_inventory_value, string="Inventory Value", type='float', readonly=True), + 'inventory_value': fields.float('Inventory val'), + #'inventory_value': fields.function(_get_inventory_value, string="Inventory Value", type='float', readonly=True), } def init(self, cr): @@ -90,7 +91,8 @@ class stock_history(osv.osv): quant.qty AS quantity, stock_move.date AS date, ir_property.value_text AS cost_method, - quant.cost as price_unit_on_quant + quant.cost as price_unit_on_quant, + rel.cost as inventory_value FROM stock_move LEFT JOIN @@ -103,6 +105,9 @@ class stock_history(osv.osv): product_template ON product_template.id = product_product.product_tmpl_id LEFT JOIN ir_property ON (ir_property.name = 'cost_method' and ir_property.res_id = 'product.template,' || product_template.id::text) + LEFT JOIN + (select p.cost as cost, p.product_template_id as tmpl from prices_history as p, (select max(datetime) as datetime, product_template_id from prices_history group by company_id, product_template_id, datetime) as b where b.product_template_id = p.product_template_id and p.datetime = b.datetime) rel + ON rel.tmpl = product_template.id WHERE stock_move.state = 'done' AND location.usage = 'internal' ) UNION (SELECT @@ -114,7 +119,8 @@ class stock_history(osv.osv): - quant.qty AS quantity, stock_move.date AS date, ir_property.value_text AS cost_method, - quant.cost as price_unit_on_quant + quant.cost as price_unit_on_quant, + 0.0 as inventory_value FROM stock_move LEFT JOIN From fd5f6e7ccd57de1e55c1b74bcb194c259bd0f43a Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 13 Mar 2014 09:19:04 +0100 Subject: [PATCH 06/20] [IMP] Testing report bzr revid: jco@openerp.com-20140313081904-jzf1oiixe0nz7v2g --- .../wizard/stock_valuation_history.py | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 92d7b4f6633..d711697287b 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -41,27 +41,27 @@ class stock_history(osv.osv): _auto = False _order = 'date asc' - def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): - res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) - if 'inventory_value' in fields: - for line in res: - if '__domain' in line: - lines = self.search(cr, uid, line['__domain'], context=context) - inv_value = 0.0 - for line2 in self.browse(cr, uid, lines, context=context): - inv_value += line2.inventory_value - line['inventory_value'] = inv_value - return res - - def _get_inventory_value(self, cr, uid, ids, name, attr, context=None): - product_obj = self.pool.get("product.product") - res = {} - for line in self.browse(cr, uid, ids, context=context): - if line.product_id.cost_method == 'real': - res[line.id] = line.quantity * line.price_unit_on_quant - else: - res[line.id] = line.quantity * product_obj.get_history_price(cr, uid, line.product_id.id, line.company_id.id, context=context) - return res +# def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): +# res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) +# if 'inventory_value' in fields: +# for line in res: +# if '__domain' in line: +# lines = self.search(cr, uid, line['__domain'], context=context) +# inv_value = 0.0 +# for line2 in self.browse(cr, uid, lines, context=context): +# inv_value += line2.inventory_value +# line['inventory_value'] = inv_value +# return res +# +# def _get_inventory_value(self, cr, uid, ids, name, attr, context=None): +# product_obj = self.pool.get("product.product") +# res = {} +# for line in self.browse(cr, uid, ids, context=context): +# if line.product_id.cost_method == 'real': +# res[line.id] = line.quantity * line.price_unit_on_quant +# else: +# res[line.id] = line.quantity * product_obj.get_history_price(cr, uid, line.product_id.id, line.company_id.id, context=context) +# return res _columns = { 'move_id': fields.many2one('stock.move', 'Stock Move', required=True), From 13566b866ec050a4d9f6c2f78c51e16be760bcf4 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Thu, 13 Mar 2014 18:42:44 +0100 Subject: [PATCH 07/20] [IMP] Fasten up stock valuation report bzr revid: jco@openerp.com-20140313174244-c7dg2thz6r7d5fek --- .../wizard/stock_valuation_history.py | 73 +++++++++---------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index d711697287b..b46a215b957 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -41,27 +41,32 @@ class stock_history(osv.osv): _auto = False _order = 'date asc' -# def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): -# res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) -# if 'inventory_value' in fields: -# for line in res: -# if '__domain' in line: -# lines = self.search(cr, uid, line['__domain'], context=context) -# inv_value = 0.0 -# for line2 in self.browse(cr, uid, lines, context=context): -# inv_value += line2.inventory_value -# line['inventory_value'] = inv_value -# return res -# -# def _get_inventory_value(self, cr, uid, ids, name, attr, context=None): -# product_obj = self.pool.get("product.product") -# res = {} -# for line in self.browse(cr, uid, ids, context=context): -# if line.product_id.cost_method == 'real': -# res[line.id] = line.quantity * line.price_unit_on_quant -# else: -# res[line.id] = line.quantity * product_obj.get_history_price(cr, uid, line.product_id.id, line.company_id.id, context=context) -# return res + def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): + res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) + import time + if 'inventory_value' in fields: + for line in res: + if '__domain' in line: + lines = self.search(cr, uid, line['__domain'], context=context) + inv_value = 0.0 + product_obj = self.pool.get("product.product") + print time.time() + for line_rec in self.browse(cr, uid, lines, context=context): + inv_value += line_rec.quantity * product_obj.get_history_price(cr, uid, line_rec.product_id.id, line_rec.company_id.id, context=context) + line['inventory_value'] = inv_value + print "end", time.time() + return res + + def _get_inventory_value(self, cr, uid, ids, name, attr, context=None): + print "pass" + product_obj = self.pool.get("product.product") + res = {} + for line in self.browse(cr, uid, ids, context=context): + if line.product_id.cost_method == 'real': + res[line.id] = line.quantity * line.price_unit_on_quant + else: + res[line.id] = line.quantity * product_obj.get_history_price(cr, uid, line.product_id.id, line.company_id.id, context=context) + return res _columns = { 'move_id': fields.many2one('stock.move', 'Stock Move', required=True), @@ -74,8 +79,7 @@ class stock_history(osv.osv): 'date': fields.datetime('Operation Date'), 'price_unit_on_quant': fields.float('Value'), 'cost_method': fields.char('Cost Method'), - 'inventory_value': fields.float('Inventory val'), - #'inventory_value': fields.function(_get_inventory_value, string="Inventory Value", type='float', readonly=True), + 'inventory_value': fields.function(_get_inventory_value, string="Inventory Value", type='float', readonly=True), } def init(self, cr): @@ -91,12 +95,9 @@ class stock_history(osv.osv): quant.qty AS quantity, stock_move.date AS date, ir_property.value_text AS cost_method, - quant.cost as price_unit_on_quant, - rel.cost as inventory_value + quant.cost as price_unit_on_quant FROM - stock_move - LEFT JOIN - stock_quant quant ON quant.id IN (SELECT quant_id FROM stock_quant_move_rel WHERE move_id = stock_move.id) + stock_quant as quant, stock_quant_move_rel, stock_move LEFT JOIN stock_location location ON stock_move.location_dest_id = location.id LEFT JOIN @@ -105,10 +106,8 @@ class stock_history(osv.osv): product_template ON product_template.id = product_product.product_tmpl_id LEFT JOIN ir_property ON (ir_property.name = 'cost_method' and ir_property.res_id = 'product.template,' || product_template.id::text) - LEFT JOIN - (select p.cost as cost, p.product_template_id as tmpl from prices_history as p, (select max(datetime) as datetime, product_template_id from prices_history group by company_id, product_template_id, datetime) as b where b.product_template_id = p.product_template_id and p.datetime = b.datetime) rel - ON rel.tmpl = product_template.id - WHERE stock_move.state = 'done' AND location.usage = 'internal' + WHERE stock_move.state = 'done' AND location.usage = 'internal' AND stock_quant_move_rel.quant_id = quant.id + AND stock_quant_move_rel.move_id = stock_move.id ) UNION (SELECT '-' || stock_move.id::text || '-' || quant.id::text AS id, @@ -119,12 +118,9 @@ class stock_history(osv.osv): - quant.qty AS quantity, stock_move.date AS date, ir_property.value_text AS cost_method, - quant.cost as price_unit_on_quant, - 0.0 as inventory_value + quant.cost as price_unit_on_quant FROM - stock_move - LEFT JOIN - stock_quant quant ON quant.id IN (SELECT quant_id FROM stock_quant_move_rel WHERE move_id = stock_move.id) + stock_quant as quant, stock_quant_move_rel, stock_move LEFT JOIN stock_location location ON stock_move.location_id = location.id LEFT JOIN @@ -133,6 +129,7 @@ class stock_history(osv.osv): product_template ON product_template.id = product_product.product_tmpl_id LEFT JOIN ir_property ON (ir_property.name = 'cost_method' and ir_property.res_id = 'product.template,' || product_template.id::text) - WHERE stock_move.state = 'done' AND location.usage = 'internal' + WHERE stock_move.state = 'done' AND location.usage = 'internal' AND stock_quant_move_rel.quant_id = quant.id + AND stock_quant_move_rel.move_id = stock_move.id ) )""") From 06455974383ad26114fceaae3e5e30961b2d89a3 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 14 Mar 2014 12:16:32 +0100 Subject: [PATCH 08/20] [IMP] Optimize stock valuation report more bzr revid: jco@openerp.com-20140314111632-59lzfrboz6kpd94y --- addons/product/product.py | 2 ++ .../wizard/stock_valuation_history.py | 17 +++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 9169ec99ead..18c5ecb4c9b 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -574,6 +574,8 @@ class product_product(osv.osv): return _('Products: ') + self.pool.get('product.category').browse(cr, uid, context['categ_id'], context=context).name return res + + def get_history_price(self, cr, uid, product_id, company_id, context=None): if context is None: context = {} diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index b46a215b957..8e92f8b8e33 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -36,6 +36,7 @@ class wizard_valuation_history(osv.osv_memory): } + class stock_history(osv.osv): _name = 'stock.history' _auto = False @@ -43,22 +44,26 @@ class stock_history(osv.osv): def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False): res = super(stock_history, self).read_group(cr, uid, domain, fields, groupby, offset=offset, limit=limit, context=context, orderby=orderby) - import time + prod_dict= {} if 'inventory_value' in fields: for line in res: if '__domain' in line: lines = self.search(cr, uid, line['__domain'], context=context) inv_value = 0.0 product_obj = self.pool.get("product.product") - print time.time() - for line_rec in self.browse(cr, uid, lines, context=context): - inv_value += line_rec.quantity * product_obj.get_history_price(cr, uid, line_rec.product_id.id, line_rec.company_id.id, context=context) + lines_rec = self.browse(cr, uid, lines, context=context) + for line_rec in lines_rec: + if not line_rec.product_id.id in prod_dict: + if line_rec.product_id.cost_method == 'real': + prod_dict[line_rec.product_id.id] = line_rec.price_unit_on_quant + else: + prod_dict[line_rec.product_id.id] = product_obj.get_history_price(cr, uid, line_rec.product_id.id, line_rec.company_id.id, context=context) + inv_value += prod_dict[line_rec.product_id.id] line['inventory_value'] = inv_value - print "end", time.time() return res + def _get_inventory_value(self, cr, uid, ids, name, attr, context=None): - print "pass" product_obj = self.pool.get("product.product") res = {} for line in self.browse(cr, uid, ids, context=context): From 6dbb3a86db841138c22b7c315288c6d93dfbbf5a Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Fri, 14 Mar 2014 16:13:20 +0100 Subject: [PATCH 09/20] [IMP] Picking wave report controller for calling report for pickings bzr revid: jco@openerp.com-20140314151320-0e33my2ux3mfj1p2 --- addons/report/models/report.py | 1 + addons/stock/stock.py | 3 ++- addons/stock/stock_view.xml | 2 +- .../wizard/stock_valuation_history_view.xml | 4 ++-- addons/stock_picking_wave/__init__.py | 1 + addons/stock_picking_wave/__openerp__.py | 1 + .../stock_picking_wave/controllers/__init__.py | 1 + addons/stock_picking_wave/controllers/main.py | 16 ++++++++++++++++ .../stock_picking_wave/stock_picking_wave.py | 18 ++---------------- .../stock_picking_wave_reports.xml | 12 ++++++++++++ 10 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 addons/stock_picking_wave/controllers/__init__.py create mode 100644 addons/stock_picking_wave/controllers/main.py create mode 100644 addons/stock_picking_wave/stock_picking_wave_reports.xml diff --git a/addons/report/models/report.py b/addons/report/models/report.py index 8a2bc21b3b0..cbcbabcde35 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -239,6 +239,7 @@ class report(osv.Model): action = { 'type': 'ir.actions.report.xml', + 'ids': ids, 'report_name': report.report_name, 'report_type': report.report_type, 'report_file': report.report_file, diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 7f103929a85..133d33e471d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -787,7 +787,8 @@ class stock_picking(osv.osv): 'model': 'stock.picking', 'ids': ids, } - return {'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list', 'datas': datas, 'nodestroy': True} + return self.get_action(cr, uid, ids, context=context) + #{'type': 'ir.actions.report.xml', 'report_name': 'stock.picking.list', 'datas': datas, 'nodestroy': True} def do_print_picking(self, cr, uid, ids, context=None): '''This function prints the picking list''' diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index ede38e6058a..5a344536645 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -2145,7 +2145,7 @@ stock.picking form tree,form - [('group_id','=',active_id)] + [('group_id','=',active_id)] procurement.group.form.herited diff --git a/addons/stock_account/wizard/stock_valuation_history_view.xml b/addons/stock_account/wizard/stock_valuation_history_view.xml index ea8b983f13e..83d58133de2 100644 --- a/addons/stock_account/wizard/stock_valuation_history_view.xml +++ b/addons/stock_account/wizard/stock_valuation_history_view.xml @@ -8,7 +8,7 @@

- Choose the date for wich you want to get the stock valuation of your products. + Choose the date for which you want to get the stock valuation of your products. This will filter the stock operation that weren't done at the selected date, to retreive the quantity you had, and gives you the inventory value according to the standard price used at that time. @@ -49,7 +49,7 @@ - + diff --git a/addons/stock_picking_wave/__init__.py b/addons/stock_picking_wave/__init__.py index 59d0d9f72d0..4a3f27b2ebd 100644 --- a/addons/stock_picking_wave/__init__.py +++ b/addons/stock_picking_wave/__init__.py @@ -21,5 +21,6 @@ import stock_picking_wave import wizard +import controllers # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock_picking_wave/__openerp__.py b/addons/stock_picking_wave/__openerp__.py index e5882dfcad2..ca64a7141ad 100644 --- a/addons/stock_picking_wave/__openerp__.py +++ b/addons/stock_picking_wave/__openerp__.py @@ -34,6 +34,7 @@ This module adds the picking wave option in warehouse management. 'stock_picking_wave_view.xml', 'stock_picking_wave_sequence.xml', 'wizard/picking_to_wave_view.xml', + 'stock_picking_wave_reports.xml', ], 'demo': [ 'stock_picking_wave_demo.xml', diff --git a/addons/stock_picking_wave/controllers/__init__.py b/addons/stock_picking_wave/controllers/__init__.py new file mode 100644 index 00000000000..039d9715fab --- /dev/null +++ b/addons/stock_picking_wave/controllers/__init__.py @@ -0,0 +1 @@ +import main \ No newline at end of file diff --git a/addons/stock_picking_wave/controllers/main.py b/addons/stock_picking_wave/controllers/main.py new file mode 100644 index 00000000000..9de14934828 --- /dev/null +++ b/addons/stock_picking_wave/controllers/main.py @@ -0,0 +1,16 @@ +from openerp.addons.web import http +from openerp.addons.web.http import request + + +class picking_wave_report(http.Controller): + @http.route('/report/stock_picking_wave.report_pickingwave/', type='http', auth='user', + website=True, multilang=True) + def report_picking_wave(self, ids): + self.cr, self.uid, self.pool = request.cr, request.uid, request.registry + ids = [int(i) for i in ids.split(',')] + picking_wave_obj = self.pool["stock.picking.wave"] + wave = picking_wave_obj.browse(self.cr, self.uid, ids[0]) + docargs = { + 'docs': wave.picking_ids, + } + return request.registry['report'].render(self.cr, self.uid, [], 'stock.report_picking', docargs) diff --git a/addons/stock_picking_wave/stock_picking_wave.py b/addons/stock_picking_wave/stock_picking_wave.py index c5e3377b023..40c1fa051ed 100644 --- a/addons/stock_picking_wave/stock_picking_wave.py +++ b/addons/stock_picking_wave/stock_picking_wave.py @@ -31,22 +31,8 @@ class stock_picking_wave(osv.osv): ''' This function print the report for all picking_ids associated to the picking wave ''' - picking_ids = [] - for wave in self.browse(cr, uid, ids, context=context): - picking_ids += [picking.id for picking in wave.picking_ids] - if not picking_ids: - raise osv.except_osv(_('Error!'), _('Nothing to print.')) - datas = { - 'ids': picking_ids, - 'model': 'stock.picking', - 'form': self.read(cr, uid, picking_ids, context=context) - } - return { - 'type': 'ir.actions.report.xml', - 'report_name': context.get('report', 'stock.picking.list'), - 'datas': datas, - 'nodestroy': True - } + context = context or {} + return self.pool.get("report").get_action(cr, uid, [], 'stock_picking_wave.report_pickingwave', context=context) def create(self, cr, uid, vals, context=None): if vals.get('name', '/') == '/': diff --git a/addons/stock_picking_wave/stock_picking_wave_reports.xml b/addons/stock_picking_wave/stock_picking_wave_reports.xml new file mode 100644 index 00000000000..7dc854a8a40 --- /dev/null +++ b/addons/stock_picking_wave/stock_picking_wave_reports.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file From 3791a376467c7972331909cb9d7f9134425fbc83 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 17 Mar 2014 11:01:15 +0100 Subject: [PATCH 10/20] [IMP] Improve report with bar codes and only moves or pack ops visible bzr revid: jco@openerp.com-20140317100115-lbey08ms0480px2x --- addons/report/controllers/main.py | 2 +- addons/report/models/report.py | 1 - addons/stock/views/report_stockpicking.xml | 39 +++++++++++++++------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/addons/report/controllers/main.py b/addons/report/controllers/main.py index 1a839fc2c1f..ab9814a3f35 100644 --- a/addons/report/controllers/main.py +++ b/addons/report/controllers/main.py @@ -480,7 +480,7 @@ class Report(http.Controller): try: width, height = int(width), int(height) barcode = createBarcodeDrawing( - type, value=value, format='png', width=width, height=height + type, value=value, format='png', width=width, height=height, humanReadable=True ) barcode = barcode.asString('png') except (ValueError, AttributeError): diff --git a/addons/report/models/report.py b/addons/report/models/report.py index cbcbabcde35..8a2bc21b3b0 100644 --- a/addons/report/models/report.py +++ b/addons/report/models/report.py @@ -239,7 +239,6 @@ class report(osv.Model): action = { 'type': 'ir.actions.report.xml', - 'ids': ids, 'report_name': report.report_name, 'report_type': report.report_type, 'report_file': report.report_file, diff --git a/addons/stock/views/report_stockpicking.xml b/addons/stock/views/report_stockpicking.xml index 551ada4422f..dae1fa8eab9 100644 --- a/addons/stock/views/report_stockpicking.xml +++ b/addons/stock/views/report_stockpicking.xml @@ -1,7 +1,7 @@ -