[IMP] Average price correction + Lot should be changeable in bar code interface

This commit is contained in:
Josse Colpaert 2014-08-05 10:08:52 +02:00
parent f43e349d85
commit e5a9bd536d
3 changed files with 9 additions and 7 deletions

View File

@ -162,8 +162,8 @@
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<t t-if="!row.cols.lot &amp;&amp; row.cols.product_id">
<li><a class="js_create_lot" href="#">Create Lot</a></li>
<t t-if="row.cols.product_id">
<li><a class="js_create_lot" href="#">Create &#47; Change Lot</a></li>
</t>
<t t-if="!row.cols.head_container &amp;&amp; !row.cols.container">
<li><a class="js_change_src" href="#">Change source location</a></li>

View File

@ -3815,10 +3815,9 @@ class stock_pack_operation(osv.osv):
new_lot_id = lots[0]
val.update({'name': name})
if not obj.lot_id:
if not new_lot_id:
new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, val, context=context)
self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context)
if not new_lot_id:
new_lot_id = self.pool.get('stock.production.lot').create(cr, uid, val, context=context)
self.write(cr, uid, id, {'lot_id': new_lot_id}, context=context)
def _search_and_increment(self, cr, uid, picking_id, domain, filter_visible=False, visible_op_ids=False, increment=True, context=None):
'''Search for an operation with given 'domain' in a picking, if it exists increment the qty (+1) otherwise create it

View File

@ -191,7 +191,10 @@ class stock_quant(osv.osv):
if context.get('force_valuation_amount'):
valuation_amount = context.get('force_valuation_amount')
else:
valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price
if move.product_id.cost_method == 'average':
valuation_amount = move.location_id.usage != 'internal' and move.location_dest_id.usage == 'internal' and cost or move.product_id.standard_price
else:
valuation_amount = move.product_id.cost_method == 'real' and cost or move.product_id.standard_price
#the standard_price of the product may be in another decimal precision, or not compatible with the coinage of
#the company currency... so we need to use round() before creating the accounting entries.
valuation_amount = currency_obj.round(cr, uid, move.company_id.currency_id, valuation_amount * qty)