openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03827
[Merge] lp:~camptocamp/stock-logistic-flows/7.0-picking_dispatch-user-optional into lp:stock-logistic-flows
Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/stock-logistic-flows/7.0-picking_dispatch-user-optional into lp:stock-logistic-flows.
Commit message:
[IMP] the user is no longer mandatory when we create a picking dispatch, but becomes required for states 'assigned' and upper.
A user may want to prepare a dispatch without knowing yet who is the picker.
Requested reviews:
Stock and Logistic Core Editors (stock-logistic-core-editors)
For more details, see:
https://code.launchpad.net/~camptocamp/stock-logistic-flows/7.0-picking_dispatch-user-optional/+merge/206868
A user may want to prepare a dispatch without knowing yet who is the picker.
So this is a proposal for this change: the user is no longer mandatory when we create a picking dispatch, but becomes required for states 'assigned' and upper.
--
https://code.launchpad.net/~camptocamp/stock-logistic-flows/7.0-picking_dispatch-user-optional/+merge/206868
Your team Stock and Logistic Core Editors is requested to review the proposed merge of lp:~camptocamp/stock-logistic-flows/7.0-picking_dispatch-user-optional into lp:stock-logistic-flows.
=== modified file 'picking_dispatch/picking_dispatch.py'
--- picking_dispatch/picking_dispatch.py 2012-12-10 10:51:23 +0000
+++ picking_dispatch/picking_dispatch.py 2014-02-18 09:04:30 +0000
@@ -61,9 +61,9 @@
states={'draft': [('readonly', False)],
'assigned': [('readonly', False)]},
help='date on which the picking dispatched is to be processed'),
- 'picker_id': fields.many2one('res.users', 'Picker', readonly=True, required=True,
+ 'picker_id': fields.many2one('res.users', 'Picker', readonly=True,
states={'draft': [('readonly', False)],
- 'assigned': [('readonly', False)]},
+ 'assigned': [('required', True)]},
select=True,
help='the user to which the pickings are assigned'),
'move_ids': fields.one2many('stock.move', 'dispatch_id', 'Moves',
@@ -91,6 +91,17 @@
'state': 'draft'
}
+ def _check_picker_assigned(self, cr, uid, ids, context=None):
+ for dispatch in self.browse(cr, uid, ids, context=context):
+ if (dispatch.state in ('assigned', 'progress', 'done') and
+ not dispatch.picker_id):
+ return False
+ return True
+
+ _constraints = [
+ (_check_picker_assigned, 'Please select a picker.', ['picker_id'])
+ ]
+
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
Follow ups