← Back to team overview

openerp-community-reviewer team mailing list archive

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

 

You have been requested to review the proposed merge of lp:~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde into lp:carriers-deliveries.

For more details, see:
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde/+merge/212878

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

-- 
https://code.launchpad.net/~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde/+merge/212878
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/carriers-deliveries/7.0-stock-picking-duplication-fix-regression-from-v7port-and-add-a-test_rde into lp:carriers-deliveries.
=== modified file 'base_delivery_carrier_files/stock.py'
--- base_delivery_carrier_files/stock.py	2014-03-24 10:53:06 +0000
+++ base_delivery_carrier_files/stock.py	2014-03-26 15:48:36 +0000
@@ -78,21 +78,21 @@
         self.generate_carrier_files(cr, uid, ids, auto=True, context=context)
         return result
 
+
+class stock_picking_out(orm.Model):
+    _inherit = 'stock.picking.out'
+
+    _columns = {
+        'carrier_file_generated': fields.boolean('Carrier File Generated',
+                                                 readonly=True,
+                                                 help="The file for "
+                                                 "the delivery carrier "
+                                                 "has been generated."),
+    }
+
     def copy(self, cr, uid, id, default=None, context=None):
         if default is None:
             default = {}
         default.update({'carrier_file_generated': False})
-        return super(stock_picking, self).copy(cr, uid, id, default,
-                                               context=context)
-
-
-class stock_picking_out(orm.Model):
-    _inherit = 'stock.picking.out'
-
-    _columns = {
-        'carrier_file_generated': fields.boolean('Carrier File Generated',
-                                                 readonly=True,
-                                                 help="The file for "
-                                                 "the delivery carrier "
-                                                 "has been generated."),
-    }
+        return super(stock_picking_out, self).copy(cr, uid, id, default,
+                                                   context=context)

=== modified file 'base_delivery_carrier_files/test/carrier_file.yml'
--- base_delivery_carrier_files/test/carrier_file.yml	2014-03-18 17:19:02 +0000
+++ base_delivery_carrier_files/test/carrier_file.yml	2014-03-26 15:48:36 +0000
@@ -38,3 +38,9 @@
 -
   !assert {model: stock.picking.out, id: outgoing_shipment_carrier_file, string: Carrier file should be generated}:
     - carrier_file_generated == True
+-
+  I check outgoing shipment copy, the carrier_file_generated field must be unchecked
+-
+  !python {model: stock.picking.out}: |
+    new_id = self.copy(cr, uid, ref('outgoing_shipment_carrier_file'))
+    assert self.read(cr, uid, new_id, ['carrier_file_generated'])['carrier_file_generated'] == False, "After duplication, the file generated checkbox is unchecked"


References