[MERGE] Forward-port of latest 7.0 bugfixes, up to rev. 10016 revid:dle@openerp.com...
authorDenis Ledoux <dle@openerp.com>
Fri, 25 Apr 2014 12:59:26 +0000 (14:59 +0200)
committerDenis Ledoux <dle@openerp.com>
Fri, 25 Apr 2014 12:59:26 +0000 (14:59 +0200)
bzr revid: dle@openerp.com-20140425125926-5nchz1tcq4fx18jx

1  2 
addons/hr_timesheet_sheet/hr_timesheet_sheet.py
addons/product/product.py
addons/sale_stock/sale_stock.py
addons/stock/stock_view.xml

@@@ -24,7 -24,9 +24,8 @@@ from datetime import datetim
  from dateutil.relativedelta import relativedelta
  
  from openerp.osv import fields, osv
+ from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
  from openerp.tools.translate import _
 -from openerp import netsvc
  
  class hr_timesheet_sheet(osv.osv):
      _name = "hr_timesheet_sheet.sheet"
@@@ -805,9 -702,9 +805,17 @@@ class product_product(osv.osv)
              price_type_currency_id = pricetype_obj.browse(cr,uid,price_type_id).currency_id.id
  
          res = {}
++        # standard_price field can only be seen by users in base.group_user
++        # Thus, in order to compute the sale price from the cost price for users not in this group
++        # We fetch the standard price as the superuser
++        for product in products:
++            if ptype != 'standard_price':
++                res[product.id] = product[ptype] or 0.0
++            else: 
++                res[product.id] = self.read(cr, SUPERUSER_ID, product.id, [ptype], context=context)[ptype] or 0.0
++
          product_uom_obj = self.pool.get('product.uom')
 -        for product in self.browse(cr, SUPERUSER_ID, ids, context=context):
 -            res[product.id] = product[ptype] or 0.0
 +        for product in products:
-             res[product.id] = product[ptype] or 0.0
              if ptype == 'list_price':
                  res[product.id] = (res[product.id] * (product.price_margin or 1.0)) + \
                          product.price_extra
Simple merge
Simple merge