Forward-port of latest 7.0, up to rev. 10046 (rev-id: launchpad_translations_on_behalf_of_openerp-20140514062049-vjclnuxlkbto0tsj)

This commit is contained in:
Martin Trigaux 2014-05-14 10:04:16 +02:00
commit 8ea4f581ed
5 changed files with 15 additions and 14 deletions

View File

@ -219,7 +219,7 @@ class account_analytic_account(osv.osv):
res['value']['description'] = template.description
return res
def on_change_partner_id(self, cr, uid, ids,partner_id, name, context={}):
def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None):
res={}
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)

View File

@ -90,6 +90,11 @@ class hr_holidays_status(osv.osv):
}
def name_get(self, cr, uid, ids, context=None):
if not context.get('employee_id',False):
# leave counts is based on employee_id, would be inaccurate if not based on correct employee
return super(hr_holidays_status, self).name_get(cr, uid, ids, context=context)
res = []
for record in self.browse(cr, uid, ids, context=context):
name = record.name

View File

@ -83,7 +83,7 @@
</div>
</group>
<group>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('type', '=', 'remove'),('state','!=','draft')]}" string="Mode" groups="base.group_hr_user"/>
<field name="holiday_type" on_change="onchange_type(holiday_type)" attrs="{'readonly':[('type', '=', 'remove'),('state','!=','draft')]}" string="Mode" groups="base.group_hr_user" context="{'employee_id':employee_id}" />
<field name="employee_id" attrs="{'required':[('holiday_type','=','employee')],'invisible':[('holiday_type','=','category')]}" on_change="onchange_employee(employee_id)" groups="base.group_hr_user"/>
<field name="category_id" attrs="{'required':[('holiday_type','=','category')], 'readonly': [('type', '=', 'remove'),('state','!=','draft'), ('state','!=','confirm')], 'invisible':[('holiday_type','=','employee')]}"/>
<field name="department_id" attrs="{'readonly':['|', ('type','=','add'),('holiday_type','=','category')],'invisible':[('holiday_type','=','category')]}" groups="base.group_hr_user"/>

View File

@ -833,14 +833,10 @@ class product_product(osv.osv):
return res
def copy(self, cr, uid, id, default=None, context=None):
context = context or {}
default = dict(default or {})
if context is None:
context={}
# Craft our own `<name> (copy)` in en_US (self.copy_translation()
# will do the other languages).
context_wo_lang = dict(context or {})
context_wo_lang.pop('lang', None)
product = self.browse(cr, uid, id, context_wo_lang)
product = self.browse(cr, uid, id, context)
if context.get('variant'):
# if we copy a variant or create one, we keep the same template
default['product_tmpl_id'] = product.product_tmpl_id.id

View File

@ -622,13 +622,13 @@ class sale_order_line(osv.osv):
res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
res['value'].update(res_packing.get('value', {}))
warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or ''
compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
compare_qty = float_compare(product_obj.virtual_available, qty, precision_rounding=uom2.rounding)
if (product_obj.type=='product') and int(compare_qty) == -1 \
and (product_obj.procure_method=='make_to_stock'):
and (product_obj.procure_method=='make_to_stock'):
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)
(qty, uom2.name,
max(0,product_obj.virtual_available), uom2.name,
max(0,product_obj.qty_available), uom2.name)
warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
#update of warning messages