[IMP] Picking wave report controller for calling report for pickings

bzr revid: jco@openerp.com-20140314151320-0e33my2ux3mfj1p2
This commit is contained in:
Josse Colpaert 2014-03-14 16:13:20 +01:00
parent 0645597438
commit 6dbb3a86db
10 changed files with 39 additions and 20 deletions

View File

@ -239,6 +239,7 @@ class report(osv.Model):
action = { action = {
'type': 'ir.actions.report.xml', 'type': 'ir.actions.report.xml',
'ids': ids,
'report_name': report.report_name, 'report_name': report.report_name,
'report_type': report.report_type, 'report_type': report.report_type,
'report_file': report.report_file, 'report_file': report.report_file,

View File

@ -787,7 +787,8 @@ class stock_picking(osv.osv):
'model': 'stock.picking', 'model': 'stock.picking',
'ids': ids, '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): def do_print_picking(self, cr, uid, ids, context=None):
'''This function prints the picking list''' '''This function prints the picking list'''

View File

@ -2145,7 +2145,7 @@
<field name="res_model">stock.picking</field> <field name="res_model">stock.picking</field>
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_mode">tree,form</field> <field name="view_mode">tree,form</field>
<field name="domain">[('group_id','=',active_id)]</field> <field name="domain">[('group_id','=',active_id)]</field>
</record> </record>
<record id="procurement_group_form_view_herited" model="ir.ui.view"> <record id="procurement_group_form_view_herited" model="ir.ui.view">
<field name="name">procurement.group.form.herited</field> <field name="name">procurement.group.form.herited</field>

View File

@ -8,7 +8,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Choose your date" version="7.0"> <form string="Choose your date" version="7.0">
<p class="oe_gray" attrs="{'invisible': [('choose_date', '=', False)]}"> <p class="oe_gray" attrs="{'invisible': [('choose_date', '=', False)]}">
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 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. you had, and gives you the inventory value according to the standard price used at that time.
@ -49,7 +49,7 @@
<field name="company_id" groups="base.group_multi_company"/> <field name="company_id" groups="base.group_multi_company"/>
<field name="date"/> <field name="date"/>
<field name="quantity" sum="# of Products "/> <field name="quantity" sum="# of Products "/>
<field name="inventory_value"/> <field name="inventory_value" sum="Total Value"/>
</tree> </tree>
</field> </field>
</record> </record>

View File

@ -21,5 +21,6 @@
import stock_picking_wave import stock_picking_wave
import wizard import wizard
import controllers
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -34,6 +34,7 @@ This module adds the picking wave option in warehouse management.
'stock_picking_wave_view.xml', 'stock_picking_wave_view.xml',
'stock_picking_wave_sequence.xml', 'stock_picking_wave_sequence.xml',
'wizard/picking_to_wave_view.xml', 'wizard/picking_to_wave_view.xml',
'stock_picking_wave_reports.xml',
], ],
'demo': [ 'demo': [
'stock_picking_wave_demo.xml', 'stock_picking_wave_demo.xml',

View File

@ -0,0 +1 @@
import main

View File

@ -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/<ids>', 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)

View File

@ -31,22 +31,8 @@ class stock_picking_wave(osv.osv):
''' '''
This function print the report for all picking_ids associated to the picking wave This function print the report for all picking_ids associated to the picking wave
''' '''
picking_ids = [] context = context or {}
for wave in self.browse(cr, uid, ids, context=context): return self.pool.get("report").get_action(cr, uid, [], 'stock_picking_wave.report_pickingwave', 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
}
def create(self, cr, uid, vals, context=None): def create(self, cr, uid, vals, context=None):
if vals.get('name', '/') == '/': if vals.get('name', '/') == '/':

View File

@ -0,0 +1,12 @@
<openerp>
<data>
<report
id="action_report_print_picking_wave"
model="stock.picking.wave"
report_type="qweb-pdf"
string="Associated pickings"
name="stock_picking_wave.report_pickingwave"
file="stock_picking_wave.report_pickingwave"
/>
</data>
</openerp>