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"
++ warning_msgs += _("Picking Information ! : \n") + warn_msg + "\n\n"
+
result['product_uom_qty'] = qty
uom2 = False
(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"
++ warning_msgs += _("Not enough stock ! : \n") + 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"
++ warning_msgs += _("No Pricelist ! : \n") + warn_msg + "\n\n"
else:
price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist],
product, qty or 1.0, partner_id, {
'uom': uom,
'date': date_order,
})[pricelist]
+ # at end, round price depending of 'Sale Unit' decimal precision
+ price_unit_precision = self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price')
+ price = rounding(price, 10**-price_unit_precision)
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"
++ warning_msgs += _("No valid pricelist line found ! : \n") + 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,