[MERGE] lp: 759444 (+improved translatability)
bzr revid: qdp-launchpad@openerp.com-20110504094934-gqhto5wimzjrbft3
This commit is contained in:
commit
e67b8761cd
|
@ -1017,6 +1017,7 @@ class sale_order_line(osv.osv):
|
|||
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')
|
||||
|
@ -1036,7 +1037,7 @@ class sale_order_line(osv.osv):
|
|||
if not packaging and product_obj.packaging:
|
||||
packaging = product_obj.packaging[0].id
|
||||
result['product_packaging'] = packaging
|
||||
|
||||
|
||||
if packaging:
|
||||
default_uom = product_obj.uom_id and product_obj.uom_id.id
|
||||
pack = self.pool.get('product.packaging').browse(cr, uid, packaging, context=context)
|
||||
|
@ -1048,13 +1049,10 @@ class sale_order_line(osv.osv):
|
|||
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
|
||||
|
@ -1115,21 +1113,17 @@ class sale_order_line(osv.osv):
|
|||
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, {
|
||||
|
@ -1137,14 +1131,17 @@ class sale_order_line(osv.osv):
|
|||
'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,
|
||||
|
|
Loading…
Reference in New Issue