From d992852189a85e7e46cdbacf7a57062bc77ad66f Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Mon, 27 Sep 2010 14:49:07 +0530 Subject: [PATCH] [ADD] Account: Budget and budget lines => Add company_id field and record rules for multicompany bzr revid: mra@mra-laptop-20100927091907-47m590b2mvgb2169 --- addons/account_budget/crossovered_budget.py | 5 ++- .../crossovered_budget_view.xml | 8 +++-- .../security/account_budget_security.xml | 33 ++++++++++++++----- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/addons/account_budget/crossovered_budget.py b/addons/account_budget/crossovered_budget.py index 52645bf28af..e0e1be5e2a2 100644 --- a/addons/account_budget/crossovered_budget.py +++ b/addons/account_budget/crossovered_budget.py @@ -113,12 +113,14 @@ class crossovered_budget(osv.osv): 'date_from': fields.date('Start Date', required=True, states={'done':[('readonly',True)]}), 'date_to': fields.date('End Date', required=True, states={'done':[('readonly',True)]}), 'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'Status', select=True, required=True, readonly=True), - 'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines', states={'done':[('readonly',True)]} ), + 'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines', states={'done':[('readonly',True)]}), + 'company_id': fields.many2one('res.company', 'Company', required=True), } _defaults = { 'state': 'draft', 'creating_user_id': lambda self,cr,uid,context: uid, + 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c) } def budget_confirm(self, cr, uid, ids, *args): @@ -244,6 +246,7 @@ class crossovered_budget_lines(osv.osv): 'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)), 'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)), 'percentage':fields.function(_perc, method=True, string='Percentage', type='float'), + 'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True) } crossovered_budget_lines() diff --git a/addons/account_budget/crossovered_budget_view.xml b/addons/account_budget/crossovered_budget_view.xml index b863979ad92..263dee3f686 100644 --- a/addons/account_budget/crossovered_budget_view.xml +++ b/addons/account_budget/crossovered_budget_view.xml @@ -21,7 +21,7 @@ - + @@ -69,7 +69,7 @@
- + @@ -122,6 +122,7 @@ + @@ -141,6 +142,7 @@ + @@ -166,6 +168,7 @@ + @@ -238,6 +241,7 @@ + diff --git a/addons/account_budget/security/account_budget_security.xml b/addons/account_budget/security/account_budget_security.xml index 13ad6b34289..ec075205f68 100644 --- a/addons/account_budget/security/account_budget_security.xml +++ b/addons/account_budget/security/account_budget_security.xml @@ -1,10 +1,27 @@ - + + + - - Budget post multi-company - - - ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] - + + Budget post multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + - + + Budget multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + + Budget lines multi-company + + + ['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] + + + +