*renamed account.budget.post

*view improvement

bzr revid: qdp-launchpad@tinyerp.com-20081112135409-1bdo88p7q9jkteo1
This commit is contained in:
qdp 2008-11-12 14:54:09 +01:00
parent fe332c55dd
commit 22ae9e34bb
2 changed files with 25 additions and 120 deletions

View File

@ -30,17 +30,17 @@ import datetime
def strToDate(dt):
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
return dt_date
#moved from account/account.py
# ---------------------------------------------------------
# Budgets
# ---------------------------------------------------------
class account_budget_post(osv.osv):
_name = 'account.budget.post'
_description = 'Budget item'
_description = 'Budgetary Position'
_columns = {
'code': fields.char('Code', size=64, required=True),
'name': fields.char('Name', size=256, required=True),
'dotation_ids': fields.one2many('account.budget.post.dotation', 'post_id', 'Expenses'),
'dotation_ids': fields.one2many('account.budget.post.dotation', 'post_id', 'Spreading'),
'account_ids': fields.many2many('account.account', 'account_budget_rel', 'budget_id', 'account_id', 'Accounts'),
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'general_budget_id', 'Budget Lines'),
}
@ -88,22 +88,20 @@ class account_budget_post_dotation(osv.osv):
return res
_name = 'account.budget.post.dotation'
_description = "Budget item endowment"
_description = "Budget Dotation"
_columns = {
'name': fields.char('Name', size=64),
'post_id': fields.many2one('account.budget.post', 'Item', select=True),
'period_id': fields.many2one('account.period', 'Period'),
# 'quantity': fields.float('Quantity', digits=(16,2)),
'amount': fields.float('Amount', digits=(16,2)),
'tot_planned':fields.function(_tot_planned,method=True, string='Total Planned Amount',type='float',store=True),
}
account_budget_post_dotation()
#===
class crossovered_budget(osv.osv):
_name = "crossovered.budget"
_description = "Crossovered Budget"
_description = "Budget"
_columns = {
'name': fields.char('Name', size=50, required=True,states={'done':[('readonly',True)]}),
@ -227,11 +225,11 @@ class crossovered_budget_lines(osv.osv):
res[line.id]=0.00
return res
_name="crossovered.budget.lines"
_description = "Crossovered Budget Lines"
_description = "Budget Lines"
_columns = {
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget Ref', ondelete='cascade', select=True, required=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account Ref',required=True),
'general_budget_id': fields.many2one('account.budget.post', 'Master Budget Ref',required=True),
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget', ondelete='cascade', select=True, required=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account',required=True),
'general_budget_id': fields.many2one('account.budget.post', 'Budgetary Position',required=True),
'date_from': fields.date('Start Date',required=True),
'date_to': fields.date('End Date',required=True),
'paid_date': fields.date('Paid Date'),
@ -252,52 +250,5 @@ class account_analytic_account(osv.osv):
account_analytic_account()
#--------------------------------------------------------------
# moved from account/project/project.py
# ---------------------------------------------------------
# Budgets.
# ---------------------------------------------------------
#class account_analytic_budget_post(osv.osv):
# _name = 'account.analytic.budget.post'
# _description = 'Budget item'
# _columns = {
# 'code': fields.char('Code', size=64, required=True),
# 'name': fields.char('Name', size=256, required=True),
# 'sens': fields.selection( [('charge','Charge'), ('produit','Product')], 'Direction', required=True),
# 'dotation_ids': fields.one2many('account.analytic.budget.post.dotation', 'post_id', 'Expenses'),
# 'account_ids': fields.many2many('account.analytic.account', 'account_analytic_budget_rel', 'budget_id', 'account_id', 'Accounts'),
# }
# _defaults = {
# 'sens': lambda *a: 'produit',
# }
#
# def spread(self, cr, uid, ids, fiscalyear_id=False, quantity=0.0, amount=0.0):
#
# dobj = self.pool.get('account.analytic.budget.post.dotation')
# for o in self.browse(cr, uid, ids):
# # delete dotations for this post
# dobj.unlink(cr, uid, dobj.search(cr, uid, [('post_id','=',o.id)]))
#
# # create one dotation per period in the fiscal year, and spread the total amount/quantity over those dotations
# fy = self.pool.get('account.fiscalyear').browse(cr, uid, [fiscalyear_id])[0]
# num = len(fy.period_ids)
# for p in fy.period_ids:
# dobj.create(cr, uid, {'post_id': o.id, 'period_id': p.id, 'quantity': quantity/num, 'amount': amount/num})
# return True
#account_analytic_budget_post()
#
#class account_analytic_budget_post_dotation(osv.osv):
# _name = 'account.analytic.budget.post.dotation'
# _description = "Budget item endowment"
# _columns = {
# 'name': fields.char('Name', size=64),
# 'post_id': fields.many2one('account.analytic.budget.post', 'Item', select=True),
# 'period_id': fields.many2one('account.period', 'Period'),
# 'quantity': fields.float('Quantity', digits=(16,2)),
# 'amount': fields.float('Amount', digits=(16,2)),
# }
#account_analytic_budget_post_dotation()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -12,34 +12,13 @@
<!--
Budgets
-->
<!--<record id="view_budget_post_form" model="ir.ui.view">
<field name="name">account.budget.post.form</field>
<field name="model">account.budget.post</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget">
<notebook>
<page string="Definition">
<field name="code" select="1"/>
<field name="name" select="1"/>
</page>
<page string="Dotations">
<button name="%(wizard_budget_spread)d" string="Spread" type="action"/>
<field colspan="4" name="dotation_ids" nolabel="1"/>
</page>
<page string="Accounts">
<field colspan="4" name="account_ids" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>-->
<record id="view_budget_post_tree" model="ir.ui.view">
<field name="name">account.budget.post.tree</field>
<field name="model">account.budget.post</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Master Budget">
<tree string="Budgetary Position">
<field name="code"/>
<field name="name"/>
</tree>
@ -50,7 +29,7 @@
<field name="model">account.budget.post.dotation</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget Expenses">
<form string="Budget Dotation">
<field name="period_id"/>
<field name="amount"/>
<field name="tot_planned" />
@ -62,7 +41,7 @@
<field name="model">account.budget.post.dotation</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Master Budget Expenses">
<tree string="Budget Dotations">
<field name="period_id"/>
<field name="amount"/>
<field name="tot_planned" />
@ -71,59 +50,34 @@
</record>
<record id="open_budget_post_form" model="ir.actions.act_window">
<field name="name">Master Budgets</field>
<field name="name">Budgetary Positions</field>
<field name="res_model">account.budget.post</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_budget_post_tree"/>
</record>
<menuitem id="next_id_31" name="Budgets" parent="account.menu_finance"/><menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/>
<menuitem id="next_id_31" name="Budgets" parent="account.menu_finance"/>
<menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/>
<!-- ******************************************************************************************************** -->
<!--<record model="ir.ui.view" id="view_budget_post_dotation_form_inherit">
<field name="name">account.budget.post.dotation.form.inherit</field>
<field name="type">form</field>
<field name="model">account.budget.post.dotation</field>
<field name="inherit_id" ref="account.view_budget_post_dotation_form"/>
<field name="arch" type="xml">
<field name="period_id" position="after">
<field name="tot_planned" />
</field>
</field>
</record>-->
<!--<record model="ir.ui.view" id="view_budget_post_dotation_tree_inherit">
<field name="name">account.budget.post.dotation.tree.inherit</field>
<field name="model">account.budget.post.dotation</field>
<field name="type">tree</field>
<field name="inherit_id" ref="account.view_budget_post_dotation_tree"/>
<field name="arch" type="xml">
<field name="amount" position="after">
<field name="tot_planned" />
</field>
</field>
</record>-->
<!--<record model="ir.ui.view" id="account.view_budget_post_form">-->
<record model="ir.ui.view" id="view_budget_post_form">
<field name="name">account.budget.post.form.inherit</field>
<field name="model">account.budget.post</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget">
<notebook>
<page string="Definition">
<field name="code" select="1"/>
<field name="name" select="1"/>
<form string="Budgetary Position">
<field name="name" select="1"/>
<field name="code" select="1"/>
<notebook colspan="4">
<page string="Accounts">
<field name="account_ids" colspan="4" nolabel="1"/>
</page>
<page string="Dotations">
<button string="Spread" name="%(wizard_budget_spread)d" type="action"/>
<field name="dotation_ids" colspan="4" nolabel="1"/>
</page>
<page string="Accounts">
<field name="account_ids" colspan="4" nolabel="1"/>
</page>
<page string="Budget Lines">
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree,graph">
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="graph,tree">
<graph type="bar" string="Lines">
<field name="analytic_account_id" />
<field name="general_budget_id" operator="+" />
@ -158,7 +112,7 @@
</form>
</field>
</record>
<!-- =================== -->
<record model="ir.ui.view" id="crossovered_budget_view_form">
<field name="name">crossovered.budget.view.form</field>
<field name="model">crossovered.budget</field>