[IMP] stock: picking: add button print; reload after done action

bzr revid: chm@openerp.com-20130708103400-lo6hlv0k796vpzwo
This commit is contained in:
Christophe Matthieu 2013-07-08 12:34:00 +02:00
parent 21064728a6
commit 5d9db60eb0
6 changed files with 57 additions and 4 deletions

View File

@ -0,0 +1,13 @@
<?xml version="1.0"?>
<document filename="Packing List.pdf">
<template pageSize="(595.0,842.0)" title="Packing List" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="0.0" y1="57.0" width="538" height="728"/>
</pageTemplate>
</template>
<story>
<pto>
<barCode code="code128" quiet="9" fontName="Times-Roman" fontSize="50" alignment="CENTER"> [[ packaging_id.product_id.ean13 ]] </barCode>
</pto>
</story>
</document>

View File

@ -82,6 +82,7 @@ function openerp_picking_widgets(instance){
this.$('.js_pack_row').each(function(){
var pack_id = parseInt($(this).attr('pack-id'));
$('.js_pack_print', this).click(function(){ model.print_package(pack_id); });
$('.js_pack_plus', this).click(function(){ model.copy_package(pack_id); });
$('.js_pack_minus', this).click(function(){ model.delete_package(pack_id); });
$('.js_pack_select', this).click(function(){
@ -229,7 +230,17 @@ function openerp_picking_widgets(instance){
.call('action_done_from_packing_ui',[self.picking.id])
.then(function(new_picking_id){
console.log('New picking id:',new_picking_id);
//return self.refresh_ui(new_picking_id);
return self.refresh_ui(new_picking_id);
});
},
print_package: function(package_id){
var self = this;
console.log('Print Package:',package_id);
new instance.web.Model('stock.quant.package')
.call('action_print',[[package_id]])
.then(function(action){
console.log('Print Package Repport Action:',action);
return self.do_action(action);
});
},
copy_package: function(package_id){

View File

@ -130,11 +130,12 @@
<col class='oe_pick_col_expand'></col>
<col class='oe_pick_col_small'></col>
<col class='oe_pick_col_small'></col>
<col class='oe_pick_col_small'></col>
</colgroup>
<thead>
<tr>
<th>Package</th> <th></th> <th></th>
<th>Package</th> <th></th> <th></th> <th></th>
</tr>
</thead>
@ -142,8 +143,9 @@
<t t-foreach="widget.get_rows()" t-as="row">
<tr t-att-class="'js_pack_row' + row.classes" t-att-pack-id="row.id">
<td class='js_pack_select'> <t t-esc="row.cols.pack" /> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_plus'>copy</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_minus'>delete</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_print'>Print</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_plus'>Copy</span> </td>
<td class='oe_centeralign'> <span class='oe_row_button js_pack_minus'>Delete</span> </td>
</tr>
</t>
</tbody>

View File

@ -3847,6 +3847,10 @@ class stock_picking_out(osv.osv):
# -------------------------
# Packaging related stuff
# -------------------------
from openerp.report import report_sxw
report_sxw.report_sxw('report.stock.quant.package.barcode', 'stock.quant.package', 'addons/stock/report/picking_barcode.rml')
class stock_package(osv.osv):
"""
These are the packages, it replaces the stock.tracking and are applied on quants instead of on moves
@ -3879,6 +3883,20 @@ class stock_package(osv.osv):
(_check_location, 'All quant inside a package should share the same location', ['location_id']),
]
def action_print(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {
'ids': context.get('active_id') and [context.get('active_id')] or ids,
'model': 'stock.quant.package',
'form': self.read(cr, uid, ids)[0]
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'report.stock.quant.package.barcode',
'datas': datas
}
def action_copy(self, cr, uid, ids, context=None):
quant_obj = self.pool.get('stock.quant')
stock_operation_obj = self.pool.get('stock.pack.operation')

View File

@ -3,6 +3,7 @@
<data>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Stock Level Forecast"/>
<report id="report_picking_list" model="stock.picking" name="stock.picking.list.internal" string="Picking Slip" rml="stock/report/picking_internal.rml"/>
<report id="report_quant_package_barcode" model="stock.quant.package" name="stock.quant.package.barcode" string="Picking BarCode" rml="stock/report/picking_barcode.rml"/>
<report id="report_picking_list_in" model="stock.picking.in" name="stock.picking.list" string="Receipt Slip" rml="stock/report/picking.rml"/>
<report id="report_picking_list_out" model="stock.picking.out" name="stock.picking.list" string="Delivery Slip" rml="stock/report/picking.rml"/>
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>

View File

@ -1434,6 +1434,14 @@
<menuitem action="action_move_form2" id="menu_action_move_form2" parent="menu_traceability" sequence="3" groups="stock.group_locations"/>
<record id="action_stock_stock_ui" model="ir.actions.client">
<field name="name">Stock picking</field>
<field name="tag">stock.ui</field>
<field name="res_model">stock</field>
</record>
<menuitem action="action_stock_stock_ui" id="menu_action_stock_stock_ui" parent="menu_stock_warehouse_mgmt" sequence="4"/>
<!--
Reception Picking (By Stock Move)
From stock_partial_move_view