openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03899
[Merge] lp:~camptocamp/carriers-deliveries/7.0-base_delivery_carrier_label-tracking_ids into lp:carriers-deliveries
Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/carriers-deliveries/7.0-base_delivery_carrier_label-tracking_ids into lp:carriers-deliveries.
Requested reviews:
Stock and Logistic Core Editors (stock-logistic-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-base_delivery_carrier_label-tracking_ids/+merge/207199
Adds a tracking_ids argument in the method that generate the labels, so the caller can choose to generate the label for only a selection of packs.
--
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-base_delivery_carrier_label-tracking_ids/+merge/207199
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/carriers-deliveries/7.0-base_delivery_carrier_label-tracking_ids into lp:carriers-deliveries.
=== modified file 'base_delivery_carrier_label/stock.py'
--- base_delivery_carrier_label/stock.py 2014-01-15 13:13:55 +0000
+++ base_delivery_carrier_label/stock.py 2014-02-19 14:09:49 +0000
@@ -53,9 +53,14 @@
string='Options'),
}
- def generate_default_label(self, cr, uid, ids, context=None):
+ def generate_default_label(self, cr, uid, ids, tracking_ids=None,
+ context=None):
""" Abstract method
+ :param tracking_ids: optional list of ``stock.tracking`` ids
+ only packs in this list will have their label
+ printed (all are generated when None)
+
:return: (file_binary, file_type)
"""
@@ -63,13 +68,18 @@
'Error',
'No label is configured for selected delivery method.')
- def generate_shipping_labels(self, cr, uid, ids, context=None):
+ def generate_shipping_labels(self, cr, uid, ids, tracking_ids=None,
+ context=None):
"""Generate a shipping label by default
This method can be inherited to create specific shipping labels
a list of label must be return as we can have multiple
stock.tracking for a single picking representing packs
+ :param tracking_ids: optional list of ``stock.tracking`` ids
+ only packs in this list will have their label
+ printed (all are generated when None)
+
:return: list of dict containing
name: name to give to the attachement
file: file as string
@@ -80,15 +90,18 @@
pack
"""
- return [self.generate_default_label(cr, uid, ids, context=None)]
+ return [self.generate_default_label(cr, uid, ids,
+ tracking_ids=tracking_ids,
+ context=None)]
- def action_generate_carrier_label(self, cr, uid, ids, context=None):
+ def action_generate_carrier_label(self, cr, uid, ids, tracking_ids=None,
+ context=None):
shipping_label_obj = self.pool.get('shipping.label')
pickings = self.browse(cr, uid, ids, context=context)
for pick in pickings:
- shipping_labels = pick.generate_shipping_labels()
+ shipping_labels = pick.generate_shipping_labels(tracking_ids=tracking_ids)
for label in shipping_labels:
# map types with models
types = {'in': 'stock.picking.in',
@@ -210,10 +223,11 @@
string='Options'),
}
- def action_generate_carrier_label(self, cr, uid, ids, context=None):
+ def action_generate_carrier_label(self, cr, uid, ids, tracking_ids=None,
+ context=None):
picking_obj = self.pool.get('stock.picking')
- return picking_obj.action_generate_carrier_label(cr, uid, ids,
- context=context)
+ return picking_obj.action_generate_carrier_label(
+ cr, uid, ids, tracking_ids=tracking_ids, context=context)
def carrier_id_change(self, cr, uid, ids, carrier_id, context=None):
""" Call stock.picking carrier_id_change """
@@ -259,10 +273,11 @@
string='Options'),
}
- def action_generate_carrier_label(self, cr, uid, ids, context=None):
+ def action_generate_carrier_label(self, cr, uid, ids, tracking_ids=None,
+ context=None):
picking_obj = self.pool.get('stock.picking')
- return picking_obj.action_generate_carrier_label(cr, uid, ids,
- context=context)
+ return picking_obj.action_generate_carrier_label(
+ cr, uid, ids, tracking_ids=tracking_ids, context=context)
def carrier_id_change(self, cr, uid, ids, carrier_id, context=None):
""" Inherit this method in your module """
Follow ups