[ADD] patch till 3528e804de50f0112315e23b65066ff752a3f7b2

This commit is contained in:
Parthiv 2018-07-23 17:44:20 +05:30
parent 973d6f5003
commit 48803ecd0e
2 changed files with 27 additions and 7 deletions

View File

@ -264,12 +264,12 @@ class StockQuant(models.Model):
# if we want to reserve
available_quantity = self._get_available_quantity(product_id, location_id, lot_id=lot_id, package_id=package_id, owner_id=owner_id, strict=strict)
if float_compare(quantity, available_quantity, precision_rounding=rounding) > 0:
raise UserError(_('It is not possible to reserve more products of %s than you have in stock.') % (', '.join(quants.mapped('product_id').mapped('display_name'))))
raise UserError(_('It is not possible to reserve more products of %s than you have in stock.') % product_id.display_name)
elif float_compare(quantity, 0, precision_rounding=rounding) < 0:
# if we want to unreserve
available_quantity = sum(quants.mapped('reserved_quantity'))
if float_compare(abs(quantity), available_quantity, precision_rounding=rounding) > 0:
raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.') % (', '.join(quants.mapped('product_id').mapped('display_name'))))
raise UserError(_('It is not possible to unreserve more products of %s than you have in stock.') % product_id.display_name)
else:
return reserved_quants

View File

@ -708,11 +708,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):