Merge lp:~akretion-team/carriers-deliveries/base-deliv-carr-label--improve-file_type-inheritance-shipping-label-dbl into lp:~stock-logistic-core-editors/carriers-deliveries/7.0

Proposed by David BEAL (ak)
Status: Merged
Approved by: Yannick Vaucher @ Camptocamp
Approved revision: 26
Merged at revision: 28
Proposed branch: lp:~akretion-team/carriers-deliveries/base-deliv-carr-label--improve-file_type-inheritance-shipping-label-dbl
Merge into: lp:~stock-logistic-core-editors/carriers-deliveries/7.0
Diff against target: 21 lines (+8/-1)
1 file modified
base_delivery_carrier_label/stock.py (+8/-1)
To merge this branch: bzr merge lp:~akretion-team/carriers-deliveries/base-deliv-carr-label--improve-file_type-inheritance-shipping-label-dbl
Reviewer Review Type Date Requested Status
Sandy Carter (http://www.savoirfairelinux.com) code review, no test Approve
Pedro Manuel Baeza code review Approve
Yannick Vaucher @ Camptocamp code review Approve
Review via email: mp+211287@code.launchpad.net

Description of the change

Improve file_type field inheritance in shipping.label

To post a comment you must log in.
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Indeed I forgot this one in my previous MP

Thanks!

I'll make the change in delivery_carrier_label_postlogistics

review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) :
review: Approve (code review)
26. By David BEAL (ak)

[IMP] add field selection sort

Revision history for this message
David BEAL (ak) (davidbeal) wrote :

rev 26 move sort from postlogistics to the root function of the file_type field

Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) wrote :

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'base_delivery_carrier_label/stock.py'
2--- base_delivery_carrier_label/stock.py 2014-01-15 13:13:55 +0000
3+++ base_delivery_carrier_label/stock.py 2014-03-18 14:13:15 +0000
4@@ -283,10 +283,17 @@
5 _description = "Shipping Label"
6
7 def _get_file_type_selection(self, cr, uid, context=None):
8+ """ To inherit to add file type """
9 return [('pdf', 'PDF')]
10
11+ def __get_file_type_selection(self, cr, uid, context=None):
12+ file_types = self._get_file_type_selection(cr, uid, context=context)
13+ file_types = list(set(file_types))
14+ file_types.sort(key=lambda t: t[0])
15+ return file_types
16+
17 _columns = {
18- 'file_type': fields.selection(_get_file_type_selection, 'File type'),
19+ 'file_type': fields.selection(__get_file_type_selection, 'File type'),
20 'tracking_id': fields.many2one('stock.tracking', 'Pack'),
21 }
22

Subscribers

People subscribed via source and target branches