[FIX] access rights + merged the branch of psi with fixes related to the last merge with trunk

bzr revid: qdp-launchpad@openerp.com-20131014151721-9xwj0keiw4oav8mq
This commit is contained in:
Quentin (OpenERP) 2013-10-14 17:17:21 +02:00
commit a44996f5a7
3 changed files with 18 additions and 25 deletions

View File

@ -20,7 +20,7 @@
I make the production order using BoM having one service type product and one consumable product.
-
!record {model: mrp.production, id: mrp_production_servicetype_mo1}:
product_id: product.product_product_5
product_id: product.product_product_3
product_qty: 1.0
bom_id: mrp_bom_test1
date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')
@ -36,21 +36,13 @@
-
!workflow {model: mrp.production, action: button_confirm, ref: mrp_production_servicetype_mo1}
-
I confirm the Consume Products.
I reserved the product.
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
assert order.state == 'confirmed', "Production order should be confirmed."
for move_line in order.move_lines:
move_line.action_consume(move_line.product_qty)
-
I processed the Product Entirely.
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp_production_servicetype_mo1"))
assert order.state == 'in_production', 'Production order should be in production State.'
for move_created in order.move_created_ids:
move_created.action_done()
self.force_production(cr, uid, [order.id])
-
I produce product.
-
@ -90,7 +82,7 @@
I make the production order using BoM having two service type products.
-
!record {model: mrp.production, id: mrp_production_servicetype_2}:
product_id: product.product_product_5
product_id: product.product_product_3
product_qty: 1.0
bom_id: mrp_bom_test_2
date_planned: !eval time.strftime('%Y-%m-%d %H:%M:%S')

View File

@ -217,7 +217,7 @@ class stock_quant(osv.osv):
if not quant: continue
self._quant_split(cr, uid, quant, qty, context=context)
toreserve.append(quant.id)
return self.write(cr, uid, toreserve, {'reservation_id': move.id}, context=context)
return self.write(cr, SUPERUSER_ID, toreserve, {'reservation_id': move.id}, context=context)
# add location_dest_id in parameters (False=use the destination of the move)
def quants_move(self, cr, uid, quants, move, lot_id = False, owner_id = False, package_id = False, context=None):
@ -238,7 +238,7 @@ class stock_quant(osv.osv):
self._quant_split(cr, uid, quant, qty, context=context)
# FP Note: improve this using preferred locations
location_to = self.check_preferred_location(cr, uid, move, context=context)
self.write(cr, uid, [quant.id], {
self.write(cr, SUPERUSER_ID, [quant.id], {
'location_id': location_to.id,
#'reservation_id': move.move_dest_id and move.move_dest_id.id or False,
'history_ids': [(4, move.id)]
@ -316,7 +316,7 @@ class stock_quant(osv.osv):
if (quant.qty > 0 and quant.qty <= qty) or (quant.qty <= 0 and quant.qty >= qty):
return False
new_quant = self.copy(cr, SUPERUSER_ID, quant.id, default={'qty': quant.qty - qty}, context=context)
self.write(cr, uid, quant.id, {'qty': qty}, context=context)
self.write(cr, SUPERUSER_ID, quant.id, {'qty': qty}, context=context)
quant.refresh()
return self.browse(cr, uid, new_quant, context=context)
@ -348,7 +348,7 @@ class stock_quant(osv.osv):
path = []
for move in solving_quant.history_ids:
path.append((4, move.id))
self.write(cr, uid, solved_quant_ids, {'history_ids': path}, context=context)
self.write(cr, SUPERUSER_ID, solved_quant_ids, {'history_ids': path}, context=context)
def _quant_reconcile_negative(self, cr, uid, quant, context=None):
"""
@ -384,7 +384,7 @@ class stock_quant(osv.osv):
if remaining_neg_quant:
remaining_to_solve_quant_ids = self.search(cr, uid, [('propagated_from_id', '=', quant_neg.id), ('id', 'not in', solved_quant_ids)], context=context)
if remaining_to_solve_quant_ids:
self.write(cr, uid, remaining_to_solve_quant_ids, {'propagated_from_id': remaining_neg_quant.id}, context=context)
self.write(cr, SUPERUSER_ID, remaining_to_solve_quant_ids, {'propagated_from_id': remaining_neg_quant.id}, context=context)
#delete the reconciled quants, as it is replaced by the solved quants
self.unlink(cr, SUPERUSER_ID, [quant_neg.id], context=context)
#price update + accounting entries adjustments
@ -397,7 +397,7 @@ class stock_quant(osv.osv):
#solving_quant, dummy = self._reconcile_single_negative_quant(cr, uid, to_solve_quant, solving_quant, quant_neg, qty, context=context)
def _price_update(self, cr, uid, ids, newprice, context=None):
self.write(cr, uid, ids, {'cost': newprice}, context=context)
self.write(cr, SUPERSER_ID, ids, {'cost': newprice}, context=context)
def write(self, cr, uid, ids, vals, context=None):
#We want to trigger the move with nothing on reserved_quant_ids for the store of the remaining quantity
@ -408,13 +408,13 @@ class stock_quant(osv.osv):
if reser.reservation_id:
moves_to_warn.add(reser.reservation_id.id)
self.pool.get('stock.move').write(cr, uid, list(moves_to_warn), {'reserved_quant_ids': []}, context=context)
return super(stock_quant, self).write(cr, uid, ids, vals, context=context)
return super(stock_quant, self).write(cr, SUPERUSER_ID, ids, vals, context=context)
def quants_unreserve(self, cr, uid, move, context=None):
#cr.execute('update stock_quant set reservation_id=NULL where reservation_id=%s', (move.id,))
#need write for related store of remaining qty
related_quants = [x.id for x in move.reserved_quant_ids]
self.write(cr, uid, related_quants, {'reservation_id': False, 'reservation_op_id': False}, context=context)
self.write(cr, SUPERUSER_ID, related_quants, {'reservation_id': False, 'reservation_op_id': False}, context=context)
return True
#
@ -840,8 +840,8 @@ class stock_picking(osv.osv):
for picking in self.browse(cr, uid, picking_ids, context=context):
for move in picking.move_lines:
ids_to_free += [quant.id for quant in move.reserved_quant_ids]
if ids_to_free:
quant_obj.write(cr, uid, ids_to_free, {'reservation_id' : False, 'reservation_op_id': False }, context = context)
if ids_to_free:
quant_obj.write(cr, SUPERUSER_ID, ids_to_free, {'reservation_id' : False, 'reservation_op_id': False }, context = context)
def _reserve_quants_ops_move(self, cr, uid, ops, move, qty, create=False, context=None):
"""
@ -867,7 +867,7 @@ class stock_picking(osv.osv):
if quant[0]: #If quant can be reserved
res_qty -= quant[1]
quant_obj.quants_reserve(cr, uid, quants, move, context=context)
quant_obj.write(cr, uid, [x[0].id for x in quants if x[0]], {'reservation_op_id': ops.id}, context=context)
quant_obj.write(cr, SUPERUSER_ID, [x[0].id for x in quants if x[0]], {'reservation_op_id': ops.id}, context=context)
return res_qty

View File

@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import fields, osv
from openerp import SUPERUSER_ID
from datetime import *
from dateutil.relativedelta import relativedelta
from openerp.tools.translate import _
@ -823,7 +824,7 @@ class stock_move(osv.osv):
# Should call different methods here in later versions
# TODO: take care of lots
if putaway.method == 'fixed' and putaway.location_spec_id:
moveputaway_obj.create(cr, uid, {'move_id': move.id,
moveputaway_obj.create(cr, SUPERUSER_ID, {'move_id': move.id,
'location_id': putaway.location_spec_id.id,
'quantity': move.product_uom_qty}, context=context)
return True