summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2010-09-28 14:29:49 +0200
committerOlivier Dony <odo@openerp.com>2010-09-28 14:29:49 +0200
commit21fa7436db78dbeaf068f40468fbd84b2af28c69 (patch)
treeeaab2536eac0c9c73b580010e7dc3c4fc9a4a5b0
parentfc2d8254e0bd1cad4bfda6bac2a259fe42e39497 (diff)
[IMP] stock: code/labels cleanup
bzr revid: odo@openerp.com-20100928122949-hpbm9di13qmpvhhn
-rw-r--r--addons/stock/stock.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index bba58b1c77c..d1007375385 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1459,8 +1459,8 @@ class stock_move(osv.osv):
'name': fields.char('Name', size=64, required=True, select=True),
'priority': fields.selection([('0', 'Not urgent'), ('1', 'Urgent')], 'Priority'),
'create_date': fields.datetime('Creation Date', readonly=True),
- 'date': fields.datetime('Date ', required=True, help="Scheduled date for the movement of the products or real date if the move is done."),
- 'date_expected': fields.datetime('Date Expected', readonly=True,required=True, help="Scheduled date for the movement of the products"),
+ 'date': fields.datetime('Date', required=True, help="Scheduled date for the movement of the products or real date if the move is done.", readonly=True),
+ 'date_expected': fields.datetime('Date Expected', required=True, help="Scheduled date for the movement of the products"),
'product_id': fields.many2one('product.product', 'Product', required=True, select=True, domain=[('type','<>','service')]),
'product_qty': fields.float('Quantity', digits_compute=dp.get_precision('Product UoM'), required=True),
@@ -1547,9 +1547,9 @@ class stock_move(osv.osv):
def write(self, cr, uid, ids, vals, context=None):
if uid != 1:
+ frozen_fields = set(['product_qty', 'product_uom', 'product_uos_qty', 'product_uos', 'location_id', 'location_dest_id', 'product_id'])
for move in self.browse(cr, uid, ids):
if move.state == 'done':
- frozen_fields = set(['product_qty', 'product_uom', 'product_uos_qty', 'product_uos', 'location_id', 'location_dest_id', 'product_id'])
if frozen_fields.intersection(vals):
raise osv.except_osv(_('Operation forbidden'),
_('Quantities, UoMs, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator)'))
@@ -2305,8 +2305,7 @@ class stock_move(osv.osv):
user = users_obj.browse(cr, uid, uid)
context['currency_id'] = move.company_id.currency_id.id
qty = uom_obj._compute_qty(cr, uid, product_uom, product_qty, product.uom_id.id)
- pricetype = 'standard_price'
- if pricetype and qty > 0:
+ if qty > 0:
new_price = currency_obj.compute(cr, uid, product_currency,
user.company_id.currency_id.id, product_price)
new_price = uom_obj._compute_price(cr, uid, product_uom, new_price,
@@ -2315,11 +2314,11 @@ class stock_move(osv.osv):
new_std_price = new_price
else:
# Get the standard price
- amount_unit = product.price_get(pricetype, context)[product.id]
+ amount_unit = product.price_get('standard_price', context)[product.id]
new_std_price = ((amount_unit * product.qty_available)\
+ (new_price * qty))/(product.qty_available + qty)
- product_obj.write(cr, uid, [product.id],{pricetype: new_std_price})
+ product_obj.write(cr, uid, [product.id],{'standard_price': new_std_price})
# Record the values that were chosen in the wizard, so they can be
# used for inventory valuation if real-time valuation is enabled.