[FIX] Sale module: only the last warning is displayed
lp bug: https://launchpad.net/bugs/759444 fixed bzr revid: skh@tinyerp.com-20110502071207-youzwnm4gmv3wk9h
This commit is contained in:
parent
f0006cacc0
commit
a48ab0d779
|
@ -1052,11 +1052,7 @@ class sale_order_line(osv.osv):
|
||||||
"Here is a proposition of quantities according to the packaging:\n\n"
|
"Here is a proposition of quantities according to the packaging:\n\n"
|
||||||
"EAN: %s Quantity: %s Type of ul: %s") % \
|
"EAN: %s Quantity: %s Type of ul: %s") % \
|
||||||
(qty, ean, qty_pack, type_ul.name)
|
(qty, ean, qty_pack, type_ul.name)
|
||||||
warning = {
|
warning_msgs += "Picking Information ! : " + warn_msg + "\n"
|
||||||
'title': _('Picking Information !'),
|
|
||||||
'message': warn_msg
|
|
||||||
}
|
|
||||||
warning_msgs += warn_msg + "\n"
|
|
||||||
result['product_uom_qty'] = qty
|
result['product_uom_qty'] = qty
|
||||||
|
|
||||||
uom2 = False
|
uom2 = False
|
||||||
|
@ -1117,24 +1113,17 @@ class sale_order_line(osv.osv):
|
||||||
uom2 = product_obj.uom_id
|
uom2 = product_obj.uom_id
|
||||||
if (product_obj.type=='product') and (product_obj.virtual_available * uom2.factor < qty * product_obj.uom_id.factor) \
|
if (product_obj.type=='product') and (product_obj.virtual_available * uom2.factor < qty * product_obj.uom_id.factor) \
|
||||||
and (product_obj.procure_method=='make_to_stock'):
|
and (product_obj.procure_method=='make_to_stock'):
|
||||||
warning = {
|
warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \
|
||||||
'title': _('Not enough stock !'),
|
|
||||||
'message': _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') %
|
|
||||||
(qty, uom2 and uom2.name or product_obj.uom_id.name,
|
(qty, uom2 and uom2.name or product_obj.uom_id.name,
|
||||||
max(0,product_obj.virtual_available), product_obj.uom_id.name,
|
max(0,product_obj.virtual_available), product_obj.uom_id.name,
|
||||||
max(0,product_obj.qty_available), product_obj.uom_id.name)
|
max(0,product_obj.qty_available), product_obj.uom_id.name)
|
||||||
}
|
warning_msgs += "Not enough stock ! : " + warn_msg + "\n"
|
||||||
warning_msgs += warning['message']+"\n"
|
|
||||||
# get unit price
|
# get unit price
|
||||||
|
|
||||||
if not pricelist:
|
if not pricelist:
|
||||||
warning = {
|
warn_msg = _('You have to select a pricelist or a customer in the sales form !\n'
|
||||||
'title': 'No Pricelist !',
|
'Please set one before choosing a product.')
|
||||||
'message':
|
warning_msgs += "No Pricelist ! : " + warn_msg +"\n"
|
||||||
'You have to select a pricelist or a customer in the sales form !\n'
|
|
||||||
'Please set one before choosing a product.'
|
|
||||||
}
|
|
||||||
warning_msgs += warning['message'] +"\n"
|
|
||||||
else:
|
else:
|
||||||
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
|
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
|
||||||
product, qty or 1.0, partner_id, {
|
product, qty or 1.0, partner_id, {
|
||||||
|
@ -1142,21 +1131,17 @@ class sale_order_line(osv.osv):
|
||||||
'date': date_order,
|
'date': date_order,
|
||||||
})[pricelist]
|
})[pricelist]
|
||||||
if price is False:
|
if price is False:
|
||||||
warning = {
|
warn_msg = _("Couldn't find a pricelist line matching this product and quantity.\n"
|
||||||
'title': 'No valid pricelist line found !',
|
"You have to change either the product, the quantity or the pricelist.")
|
||||||
'message':
|
|
||||||
"Couldn't find a pricelist line matching this product and quantity.\n"
|
warning_msgs += "No valid pricelist line found ! :" + warn_msg +"\n"
|
||||||
"You have to change either the product, the quantity or the pricelist."
|
|
||||||
}
|
|
||||||
warning_msgs += warning['message'] +"\n"
|
|
||||||
else:
|
else:
|
||||||
result.update({'price_unit': price})
|
result.update({'price_unit': price})
|
||||||
if not warning_msgs:
|
if warning_msgs:
|
||||||
warning_msgs = False
|
warning = {
|
||||||
warning = {
|
'title': 'Wrong Configuration Error !',
|
||||||
'title': 'Wrong Configuration Error !',
|
'message' : warning_msgs
|
||||||
'message' : warning_msgs
|
}
|
||||||
}
|
|
||||||
return {'value': result, 'domain': domain, 'warning':warning}
|
return {'value': result, 'domain': domain, 'warning':warning}
|
||||||
|
|
||||||
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
|
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
|
||||||
|
|
Loading…
Reference in New Issue