[ADD] Account: Budget and budget lines => Add company_id field and record rules for multicompany
bzr revid: mra@mra-laptop-20100927091907-47m590b2mvgb2169
This commit is contained in:
parent
3ec65305c6
commit
d992852189
|
@ -113,12 +113,14 @@ class crossovered_budget(osv.osv):
|
||||||
'date_from': fields.date('Start Date', required=True, states={'done':[('readonly',True)]}),
|
'date_from': fields.date('Start Date', required=True, states={'done':[('readonly',True)]}),
|
||||||
'date_to': fields.date('End 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),
|
'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 = {
|
_defaults = {
|
||||||
'state': 'draft',
|
'state': 'draft',
|
||||||
'creating_user_id': lambda self,cr,uid,context: uid,
|
'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):
|
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)),
|
'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)),
|
'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'),
|
'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()
|
crossovered_budget_lines()
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<tree string="Budgetary Position">
|
<tree string="Budgetary Position">
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
<form string="Budgetary Position">
|
<form string="Budgetary Position">
|
||||||
<field name="name" select="1"/>
|
<field name="name" select="1"/>
|
||||||
<field name="code" select="1"/>
|
<field name="code" select="1"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||||
<notebook colspan="4">
|
<notebook colspan="4">
|
||||||
<page string="Accounts">
|
<page string="Accounts">
|
||||||
<field name="account_ids" colspan="4" nolabel="1"/>
|
<field name="account_ids" colspan="4" nolabel="1"/>
|
||||||
|
@ -122,6 +122,7 @@
|
||||||
<field name="validating_user_id" readonly="True" attrs="{'readonly':[('state','!=','draft')]}"/>
|
<field name="validating_user_id" readonly="True" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||||
<field name="date_from" attrs="{'readonly':[('state','!=','draft')]}"/>
|
<field name="date_from" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||||
<field name="date_to" attrs="{'readonly':[('state','!=','draft')]}"/>
|
<field name="date_to" attrs="{'readonly':[('state','!=','draft')]}"/>
|
||||||
|
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||||
<field name="crossovered_budget_line" colspan="4" nolabel="1" attrs="{'readonly':[('state','!=','draft')]}">
|
<field name="crossovered_budget_line" colspan="4" nolabel="1" attrs="{'readonly':[('state','!=','draft')]}">
|
||||||
<tree string="Budget Lines">
|
<tree string="Budget Lines">
|
||||||
<field name="analytic_account_id" groups="base.group_extended"/>
|
<field name="analytic_account_id" groups="base.group_extended"/>
|
||||||
|
@ -141,6 +142,7 @@
|
||||||
<field name="date_to"/>
|
<field name="date_to"/>
|
||||||
<field name="paid_date" select="1"/>
|
<field name="paid_date" select="1"/>
|
||||||
<field name="planned_amount" select="1"/>
|
<field name="planned_amount" select="1"/>
|
||||||
|
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
<field name="state" select="1"/>
|
<field name="state" select="1"/>
|
||||||
|
@ -166,6 +168,7 @@
|
||||||
<field name="code" colspan="1"/>
|
<field name="code" colspan="1"/>
|
||||||
<field name="date_from"/>
|
<field name="date_from"/>
|
||||||
<field name="date_to"/>
|
<field name="date_to"/>
|
||||||
|
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||||
<field name="creating_user_id"/>
|
<field name="creating_user_id"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
@ -238,6 +241,7 @@
|
||||||
<field name="practical_amount" select="1"/>
|
<field name="practical_amount" select="1"/>
|
||||||
<field name="theoritical_amount"/>
|
<field name="theoritical_amount"/>
|
||||||
<field name="percentage"/>
|
<field name="percentage"/>
|
||||||
|
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?><openerp><data noupdate="0">
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="0">
|
||||||
|
|
||||||
<record id="budget_post_comp_rule" model="ir.rule">
|
<record id="budget_post_comp_rule" model="ir.rule">
|
||||||
<field name="name">Budget post multi-company</field>
|
<field name="name">Budget post multi-company</field>
|
||||||
<field name="model_id" ref="model_account_budget_post"/>
|
<field name="model_id" ref="model_account_budget_post"/>
|
||||||
<field eval="True" name="global"/>
|
<field eval="True" name="global"/>
|
||||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data></openerp>
|
<record id="budget_comp_rule" model="ir.rule">
|
||||||
|
<field name="name">Budget multi-company</field>
|
||||||
|
<field name="model_id" ref="model_crossovered_budget"/>
|
||||||
|
<field eval="True" name="global"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="budget_lines_comp_rule" model="ir.rule">
|
||||||
|
<field name="name">Budget lines multi-company</field>
|
||||||
|
<field name="model_id" ref="model_crossovered_budget_lines"/>
|
||||||
|
<field eval="True" name="global"/>
|
||||||
|
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
|
|
Loading…
Reference in New Issue