[FIX] stock, barcodes: allow force detailed view of picking and rename barcode 'CANCEL' to 'DISCARD'

This commit is contained in:
Pierre Masereel
2017-09-27 09:21:17 +02:00
parent 55c0221e38
commit c493569866
3 changed files with 5 additions and 2 deletions
@@ -27,7 +27,7 @@ FormController.include({
form_view: {
commands: {
'O-CMD.EDIT': this._barcodeEdit.bind(this),
'O-CMD.CANCEL': this._barcodeDiscard.bind(this),
'O-CMD.DISCARD': this._barcodeDiscard.bind(this),
'O-CMD.SAVE': this._barcodeSave.bind(this),
'O-CMD.PAGER-PREV': this._barcodePagerPrevious.bind(this),
'O-CMD.PAGER-NEXT': this._barcodePagerNext.bind(this),
@@ -119,7 +119,7 @@ QUnit.test('edit, save and cancel buttons', function (assert) {
// dummy change to check that it correctly discards
form.$('.o_field_widget').val('test').trigger('input');
// O-CMD.CANCEL
_.each(["O","-","C","M","D",".","C","A","N","C","E","L","Enter"], triggerKeypressEvent);
_.each(["O","-","C","M","D",".","D","I","S","C","A","R","D","Enter"], triggerKeypressEvent);
assert.strictEqual(form.$(".o_form_readonly").length, 1,
"should have switched to 'readonly' mode");
assert.verifySteps(['save'], 'should not have saved');
+3
View File
@@ -297,6 +297,9 @@ class Picking(models.Model):
@api.depends('picking_type_id.show_operations')
def _compute_show_operations(self):
for picking in self:
if self.env.context.get('force_detailed_view'):
picking.show_operations = True
break
if picking.picking_type_id.show_operations:
if (picking.state == 'draft' and not self.env.context.get('planned_picking')) or picking.state != 'draft':
picking.show_operations = True