[MERGE] trunk
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 24 Jun 2013 09:53:19 +0000 (11:53 +0200)
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>
Mon, 24 Jun 2013 09:53:19 +0000 (11:53 +0200)
bzr revid: qdp-launchpad@openerp.com-20130624095319-sqkrnk4r1mst8nvk

1  2 
addons/point_of_sale/point_of_sale_view.xml
addons/point_of_sale/security/ir.model.access.csv
addons/purchase/stock.py
addons/stock/product.py
addons/stock/stock.py
addons/stock/wizard/stock_partial_move.py
addons/stock/wizard/stock_partial_picking.py
addons/stock/wizard/stock_return_picking.py

@@@ -128,10 -128,8 +128,11 @@@ class stock_partial_picking(osv.osv_mem
      # incoming pickings.
      def _product_cost_for_average_update(self, cr, uid, move):
          if move.picking_id.purchase_id:
 -            return {'cost': move.purchase_line_id.price_unit,
 -                    'currency': move.picking_id.purchase_id.currency_id.id}
++            #always write the cost price of products in the company currency, for easiness in further computation
 +            currency_obj = self.pool.get("res.currency")
 +            new_price = currency_obj.compute(cr, uid, move.picking_id.purchase_id.pricelist_id.currency_id.id, move.company_id.currency_id.id, 
 +                                                 move.purchase_line_id.price_unit, round=False)
 +            return {'cost': new_price}
          return super(stock_partial_picking, self)._product_cost_for_average_update(cr, uid, move)
  
  # Redefinition of the new field in order to update the model stock.picking.in in the orm
Simple merge
@@@ -1843,7 -1637,7 +1844,7 @@@ class stock_move(osv.osv)
                         "* Waiting Availability: This state is reached when the procurement resolution is not straight forward. It may need the scheduler to run, a component to me manufactured...\n"\
                         "* Available: When products are reserved, it is set to \'Available\'.\n"\
                         "* Done: When the shipment is processed, the state is \'Done\'."),
-         'price_unit': fields.float('Unit Price', help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),
 -        'price_unit': fields.float('Unit Price', digits_compute= dp.get_precision('Product Price'), help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),
++        'price_unit': fields.float('Unit Price', help="Technical field used to record the product cost set by the user during a picking confirmation (when average price costing method is used)"),  # as it's a technical field, we intentionally don't provide the digits attribute
          'price_currency_id': fields.many2one('res.currency', 'Currency for average price', help="Technical field used to record the currency chosen by the user during a picking confirmation (when average price costing method is used)"),
          'company_id': fields.many2one('res.company', 'Company', required=True, select=True),
          'backorder_id': fields.related('picking_id','backorder_id',type='many2one', relation="stock.picking", string="Back Order of", select=True),
@@@ -191,8 -189,7 +191,8 @@@ class stock_partial_picking(osv.osv_mem
                  qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
                  without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
                  if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
-                     raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
 -                    raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only rounding of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
++                    raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" are accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
 +                stock_move.write(cr, uid, [move_id], {'price_unit': wizard_line.cost, 'price_currency_id': False})
              else:
                  seq_obj_name =  'stock.picking.' + picking_type
                  move_id = stock_move.create(cr,uid,{'name' : self.pool.get('ir.sequence').get(cr, uid, seq_obj_name),