Merge lp:~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde into lp:~stock-logistic-core-editors/carriers-deliveries/7.0

Proposed by Romain Deheele - Camptocamp
Status: Merged
Merged at revision: 45
Proposed branch: lp:~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde
Merge into: lp:~stock-logistic-core-editors/carriers-deliveries/7.0
Diff against target: 53 lines (+20/-14)
2 files modified
base_delivery_carrier_files/stock.py (+14/-14)
base_delivery_carrier_files/test/carrier_file.yml (+6/-0)
To merge this branch: bzr merge lp:~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde
Reviewer Review Type Date Requested Status
Yannick Vaucher @ Camptocamp code review, no test Approve
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+212878@code.launchpad.net

Description of the change

Hi,

It :
- moves "def copy" overload from stock.picking object to stock.picking.out object.
This overload manages unchecking of carrier_file_generated checkbox when you copy a picking.
- adds a test to check stock.picking duplication and unchecking of carrier_file_generated checkbox.

Regards,

Romain

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

LGTM

review: Approve (code review, no test)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) 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_files/stock.py'
2--- base_delivery_carrier_files/stock.py 2014-03-24 10:53:06 +0000
3+++ base_delivery_carrier_files/stock.py 2014-03-26 15:48:36 +0000
4@@ -78,21 +78,21 @@
5 self.generate_carrier_files(cr, uid, ids, auto=True, context=context)
6 return result
7
8+
9+class stock_picking_out(orm.Model):
10+ _inherit = 'stock.picking.out'
11+
12+ _columns = {
13+ 'carrier_file_generated': fields.boolean('Carrier File Generated',
14+ readonly=True,
15+ help="The file for "
16+ "the delivery carrier "
17+ "has been generated."),
18+ }
19+
20 def copy(self, cr, uid, id, default=None, context=None):
21 if default is None:
22 default = {}
23 default.update({'carrier_file_generated': False})
24- return super(stock_picking, self).copy(cr, uid, id, default,
25- context=context)
26-
27-
28-class stock_picking_out(orm.Model):
29- _inherit = 'stock.picking.out'
30-
31- _columns = {
32- 'carrier_file_generated': fields.boolean('Carrier File Generated',
33- readonly=True,
34- help="The file for "
35- "the delivery carrier "
36- "has been generated."),
37- }
38+ return super(stock_picking_out, self).copy(cr, uid, id, default,
39+ context=context)
40
41=== modified file 'base_delivery_carrier_files/test/carrier_file.yml'
42--- base_delivery_carrier_files/test/carrier_file.yml 2014-03-18 17:19:02 +0000
43+++ base_delivery_carrier_files/test/carrier_file.yml 2014-03-26 15:48:36 +0000
44@@ -38,3 +38,9 @@
45 -
46 !assert {model: stock.picking.out, id: outgoing_shipment_carrier_file, string: Carrier file should be generated}:
47 - carrier_file_generated == True
48+-
49+ I check outgoing shipment copy, the carrier_file_generated field must be unchecked
50+-
51+ !python {model: stock.picking.out}: |
52+ new_id = self.copy(cr, uid, ref('outgoing_shipment_carrier_file'))
53+ assert self.read(cr, uid, new_id, ['carrier_file_generated'])['carrier_file_generated'] == False, "After duplication, the file generated checkbox is unchecked"

Subscribers

People subscribed via source and target branches