[IMP] stock : Improved the code to readonly all the fields in 'cancel' state.
authorDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Tue, 20 Mar 2012 08:55:25 +0000 (14:25 +0530)
committerDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Tue, 20 Mar 2012 08:55:25 +0000 (14:25 +0530)
bzr revid: mdi@tinyerp.com-20120320085525-gouio6mdgupsj3em

addons/stock/stock.py

index e80635c..2e54365 100644 (file)
@@ -621,17 +621,17 @@ class stock_picking(osv.osv):
         return new_id
 
     _columns = {
-        'name': fields.char('Reference', size=64, select=True, states={'done': [('readonly', True)]}),
-        'origin': fields.char('Origin', size=64, states={'done': [('readonly', True)]}, help="Reference of the document that produced this picking.", select=True),
-        'backorder_id': fields.many2one('stock.picking', 'Back Order of', states={'done': [('readonly', True)]}, help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True),
-        'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, states={'done': [('readonly', True)]}, help="Shipping type specify, goods coming in or going out."),
-        'note': fields.text('Notes', states={'done': [('readonly', True)]}),
-        'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done': [('readonly', True)]}),
-        'location_id': fields.many2one('stock.location', 'Location', states={'done': [('readonly', True)]}, help="Keep empty if you produce at the location where the finished products are needed." \
+        'name': fields.char('Reference', size=64, select=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
+        'origin': fields.char('Origin', size=64, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="Reference of the document that produced this picking.", select=True),
+        'backorder_id': fields.many2one('stock.picking', 'Back Order of', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="If this picking was split this field links to the picking that contains the other part that has been processed already.", select=True),
+        'type': fields.selection([('out', 'Sending Goods'), ('in', 'Getting Goods'), ('internal', 'Internal')], 'Shipping Type', required=True, select=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="Shipping type specify, goods coming in or going out."),
+        'note': fields.text('Notes', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
+        'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
+        'location_id': fields.many2one('stock.location', 'Location', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="Keep empty if you produce at the location where the finished products are needed." \
                 "Set a location if you produce at a fixed location. This can be a partner location " \
                 "if you subcontract the manufacturing operations.", select=True),
-        'location_dest_id': fields.many2one('stock.location', 'Dest. Location', states={'done': [('readonly', True)]}, help="Location where the system will stock the finished products.", select=True),
-        'move_type': fields.selection([('direct', 'Partial Delivery'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done': [('readonly', True)]}, help="It specifies goods to be delivered all at once or by direct delivery"),
+        'location_dest_id': fields.many2one('stock.location', 'Dest. Location', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="Location where the system will stock the finished products.", select=True),
+        'move_type': fields.selection([('direct', 'Partial Delivery'), ('one', 'All at once')], 'Delivery Method', required=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="It specifies goods to be delivered all at once or by direct delivery"),
         'state': fields.selection([
             ('draft', 'New'),
             ('auto', 'Waiting Another Operation'),
@@ -648,20 +648,20 @@ class stock_picking(osv.osv):
                  "* Cancelled: has been cancelled, can't be confirmed anymore"),
         'min_date': fields.function(get_min_max_date, fnct_inv=_set_minimum_date, multi="min_max_date",
                  store=True, type='datetime', string='Expected Date', select=1, help="Expected date for the picking to be processed"),
-        'date': fields.datetime('Order Date', help="Date of Order", select=True, states={'done': [('readonly', True)]}),
-        'date_done': fields.datetime('Date Done', help="Date of Completion", states={'done': [('readonly', True)]}),
+        'date': fields.datetime('Order Date', help="Date of Order", select=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
+        'date_done': fields.datetime('Date Done', help="Date of Completion", states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
         'max_date': fields.function(get_min_max_date, fnct_inv=_set_maximum_date, multi="min_max_date",
                  store=True, type='datetime', string='Max. Expected Date', select=2),
         'move_lines': fields.one2many('stock.move', 'picking_id', 'Internal Moves', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
-        'auto_picking': fields.boolean('Auto-Picking', states={'done': [('readonly', True)]}),
-        'address_id': fields.many2one('res.partner.address', 'Address', states={'done': [('readonly', True)]}, help="Address of partner"),
+        'auto_picking': fields.boolean('Auto-Picking', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
+        'address_id': fields.many2one('res.partner.address', 'Address', states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}, help="Address of partner"),
         'partner_id': fields.related('address_id','partner_id',type='many2one',relation='res.partner',string='Partner',store=True),
         'invoice_state': fields.selection([
             ("invoiced", "Invoiced"),
             ("2binvoiced", "To Be Invoiced"),
             ("none", "Not Applicable")], "Invoice Control",
             select=True, required=True, readonly=True, states={'draft': [('readonly', False)]}),
-        'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done': [('readonly', True)]}),
+        'company_id': fields.many2one('res.company', 'Company', required=True, select=True, states={'done': [('readonly', True)], 'cancel':[('readonly',True)]}),
     }
     _defaults = {
         'name': lambda self, cr, uid, context: '/',