[IMP]mrp: avoid adding account rights to users and create lines with superuser_id

bzr revid: mat@openerp.com-20130514132629-91qrc32j04a1t5he
This commit is contained in:
Martin Trigaux 2013-05-14 15:26:29 +02:00
parent bdc2be1aa4
commit c697009dea
4 changed files with 14 additions and 5 deletions

View File

@ -27,7 +27,7 @@ from openerp.osv import fields, osv
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP
from openerp.tools import float_compare
from openerp.tools.translate import _
from openerp import tools
from openerp import tools, SUPERUSER_ID
#----------------------------------------------------------
# Work Centers
@ -803,7 +803,10 @@ class mrp_production(osv.osv):
account = wc.costs_hour_account_id.id
if value and account:
amount += value
analytic_line_obj.create(cr, uid, {
# we user SUPERUSER_ID as we do not garantee an mrp user
# has access to account analytic lines but still should be
# able to produce orders
analytic_line_obj.create(cr, SUPERUSER_ID, {
'name': wc_line.name + ' (H)',
'amount': value,
'account_id': account,
@ -819,7 +822,7 @@ class mrp_production(osv.osv):
account = wc.costs_cycle_account_id.id
if value and account:
amount += value
analytic_line_obj.create(cr, uid, {
analytic_line_obj.create(cr, SUPERUSER_ID, {
'name': wc_line.name+' (C)',
'amount': value,
'account_id': account,

View File

@ -1,5 +1,4 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_analytic_line_user,account.analytic.line,account.model_account_analytic_line,group_mrp_user,1,1,1,0
access_mrp_workcenter,mrp.workcenter,model_mrp_workcenter,mrp.group_mrp_user,1,0,0,0
access_mrp_routing,mrp.routing,model_mrp_routing,mrp.group_mrp_user,1,0,0,0
access_mrp_routing_workcenter,mrp.routing.workcenter,model_mrp_routing_workcenter,mrp.group_mrp_user,1,0,0,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
access_account_analytic_line_user account.analytic.line account.model_account_analytic_line group_mrp_user 1 1 1 0
2 access_mrp_workcenter mrp.workcenter model_mrp_workcenter mrp.group_mrp_user 1 0 0 0
3 access_mrp_routing mrp.routing model_mrp_routing mrp.group_mrp_user 1 0 0 0
4 access_mrp_routing_workcenter mrp.routing.workcenter model_mrp_routing_workcenter mrp.group_mrp_user 1 0 0 0

View File

@ -13,6 +13,7 @@
!record {model: res.users, id: res_users_mrp_manager}:
groups_id:
- mrp.group_mrp_manager
- account.group_account_user
-
Create a user as 'MRP User'
-

View File

@ -183,7 +183,10 @@
order = self.browse(cr, uid, ref("mrp_production_test1"))
assert order.state == 'done', "Production order should be closed."
-
I check Total Costs at End of Production.
I check Total Costs at End of Production as a manager.
-
!context
uid: 'res_users_mrp_manager'
-
!python {model: mrp.production}: |
order = self.browse(cr, uid, ref("mrp_production_test1"))
@ -217,6 +220,9 @@
assert line.product_uom_id.id == wc.product_id.uom_id.id, "UOM is not correspond."
-
I print a "BOM Structure".
-
!context
uid: 'res_users_mrp_user'
-
!python {model: mrp.production}: |
import os