Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-57677-ado into
lp:openobject-addons/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-57677-ado/+merge/103610
Hello,
"[FIX] onchange method in sale order line return only the last one warning
message if you have multiple"
The problem is that when onchange is call it only display the last one warning
message all other is override with last one warning.
Regards,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-57677-ado/+merge/103610
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-57677-ado.
=== modified file 'sale/sale.py'
--- sale/sale.py 2012-01-17 07:57:05 +0000
+++ sale/sale.py 2012-04-26 06:38:31 +0000
@@ -1015,6 +1015,7 @@
if not partner_id:
raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.'))
warning = {}
+ warning_msgs = ''
product_uom_obj = self.pool.get('product.uom')
partner_obj = self.pool.get('res.partner')
product_obj = self.pool.get('product.product')
@@ -1047,13 +1048,11 @@
type_ul = pack.ul
warn_msg = _("You selected a quantity of %d Units.\n"
"But it's not compatible with the selected packaging.\n"
- "Here is a proposition of quantities according to the packaging:\n\n"
+ "Here is a proposition of quantities according to the packaging:\n"
"EAN: %s Quantity: %s Type of ul: %s") % \
(qty, ean, qty_pack, type_ul.name)
- warning = {
- 'title': _('Picking Information !'),
- 'message': warn_msg
- }
+ warning_msgs += _("Picking Information ! :") + warn_msg + "\n\n"
+
result['product_uom_qty'] = qty
uom2 = False
@@ -1114,21 +1113,17 @@
uom2 = product_obj.uom_id
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'):
- warning = {
- '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)') %
+ warn_msg = _('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,
max(0,product_obj.virtual_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\n"
+
# get unit price
if not pricelist:
- warning = {
- 'title': 'No Pricelist !',
- 'message':
- 'You have to select a pricelist or a customer in the sales form !\n'
- 'Please set one before choosing a product.'
- }
+ warn_msg = _('You have to select a pricelist or a customer in the sales form !\n'
+ 'Please set one before choosing a product.')
+ warning_msgs += _("No Pricelist ! :") + warn_msg + "\n\n"
else:
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
product, qty or 1.0, partner_id, {
@@ -1136,14 +1131,17 @@
'date': date_order,
})[pricelist]
if price is False:
- warning = {
- 'title': 'No valid pricelist line found !',
- 'message':
- "Couldn't find a pricelist line matching this product and quantity.\n"
- "You have to change either the product, the quantity or the pricelist."
- }
+ warn_msg = _("Couldn't find a pricelist line matching this product and quantity.\n"
+ "You have to change either the product, the quantity or the pricelist.")
+ warning_msgs += _("No valid pricelist line found ! :") + warn_msg + "\n\n"
else:
result.update({'price_unit': price})
+
+ if warning_msgs:
+ warning = {
+ 'title': _('Configuration Error !'),
+ 'message' : warning_msgs
+ }
return {'value': result, 'domain': domain, 'warning': warning}
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp