[FIX] stock: Warehouse sequences with proper company

On a multi-company environment, as sequences are created with sudo,
if admin's company is different from the user creating the warehouse
one, then warehouse sequences are incorrectly assigned to the admin's
company
This commit is contained in:
Pedro M. Baeza
2018-07-23 10:47:07 +02:00
committed by Goffin Simon
parent 88ff6beb01
commit e91f10f14d
+25 -5
View File
@@ -695,11 +695,31 @@ class Warehouse(models.Model):
def _get_sequence_values(self):
return {
'in_type_id': {'name': self.name + ' ' + _('Sequence in'), 'prefix': self.code + '/IN/', 'padding': 5},
'out_type_id': {'name': self.name + ' ' + _('Sequence out'), 'prefix': self.code + '/OUT/', 'padding': 5},
'pack_type_id': {'name': self.name + ' ' + _('Sequence packing'), 'prefix': self.code + '/PACK/', 'padding': 5},
'pick_type_id': {'name': self.name + ' ' + _('Sequence picking'), 'prefix': self.code + '/PICK/', 'padding': 5},
'int_type_id': {'name': self.name + ' ' + _('Sequence internal'), 'prefix': self.code + '/INT/', 'padding': 5},
'in_type_id': {
'name': self.name + ' ' + _('Sequence in'),
'prefix': self.code + '/IN/', 'padding': 5,
'company_id': self.company_id.id,
},
'out_type_id': {
'name': self.name + ' ' + _('Sequence out'),
'prefix': self.code + '/OUT/', 'padding': 5,
'company_id': self.company_id.id,
},
'pack_type_id': {
'name': self.name + ' ' + _('Sequence packing'),
'prefix': self.code + '/PACK/', 'padding': 5,
'company_id': self.company_id.id,
},
'pick_type_id': {
'name': self.name + ' ' + _('Sequence picking'),
'prefix': self.code + '/PICK/', 'padding': 5,
'company_id': self.company_id.id,
},
'int_type_id': {
'name': self.name + ' ' + _('Sequence internal'),
'prefix': self.code + '/INT/', 'padding': 5,
'company_id': self.company_id.id,
},
}
def _format_rulename(self, from_loc, dest_loc, suffix):