[IMP]: clean code in account_analytic_analysis, account_analytic_default and account_analytic_plans
bzr revid: pap@tinyerp.co.in-20100702140905-uud0pzhb88jmb48n
This commit is contained in:
parent
38738c887d
commit
d675363930
|
@ -21,7 +21,6 @@
|
|||
{
|
||||
"name" : "Accounting and Financial Management",
|
||||
"version" : "1.1",
|
||||
"depends" : ["product", "analytic", "process","board"],
|
||||
"author" : "Tiny",
|
||||
"category": 'Generic Modules/Accounting',
|
||||
"description": """Financial and accounting module that covers:
|
||||
|
@ -42,6 +41,7 @@ The processes like maintaining of general ledger is done through the defined fin
|
|||
grouping is maintained through journal) for a particular financial year and for preparation of vouchers there is a
|
||||
module named account_vouchers
|
||||
""",
|
||||
"depends" : ["product", "analytic", "process","board"],
|
||||
'website': 'http://www.openerp.com',
|
||||
'init_xml': [],
|
||||
'update_xml': [
|
||||
|
|
|
@ -207,7 +207,6 @@
|
|||
<field name="date" select="1"/>
|
||||
<field name="user_id" widget="selection"/>
|
||||
</group>
|
||||
<separator orientation="vertical"/>
|
||||
<newline/>
|
||||
<group string="Group By..." expand="0">
|
||||
<filter string="General Account" context="{'group_by':'general_account_id'}"/>
|
||||
|
@ -342,7 +341,6 @@
|
|||
<field name="res_model">account.analytic.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('journal_id','=',active_id)]</field>
|
||||
</record>
|
||||
<menuitem action="action_account_analytic_journal_open_form" id="account_analytic_journal_entries" parent="menu_finance_entries"/>
|
||||
<!-- <record id="action_account_analytic_journal_open_form" model="ir.actions.act_window">
|
||||
|
|
|
@ -21,32 +21,30 @@
|
|||
|
||||
|
||||
{
|
||||
'name': 'report_account_analytic',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/Accounting',
|
||||
'name' : 'report_account_analytic',
|
||||
'version' : '1.1',
|
||||
'category' : 'Generic Modules/Accounting',
|
||||
'description': """
|
||||
This module is for modifying account analytic view to show
|
||||
important data to project manager of services companies.
|
||||
Adds menu to show relevant information to each manager..
|
||||
This module is for modifying account analytic view to show
|
||||
important data to project manager of services companies.
|
||||
Adds menu to show relevant information to each manager..
|
||||
|
||||
You can also view the report of account analytic summary
|
||||
user-wise as well as month wise.
|
||||
You can also view the report of account analytic summary
|
||||
user-wise as well as month wise.
|
||||
""",
|
||||
"version" : "1.1",
|
||||
"author" : "Camptocamp",
|
||||
"category" : "Generic Modules/Accounting",
|
||||
"module": "",
|
||||
"website": "http://www.camptocamp.com/",
|
||||
"depends" : ["account","hr_timesheet","hr_timesheet_invoice","project"],
|
||||
"init_xml" : [],
|
||||
"update_xml" : [
|
||||
"security/ir.model.access.csv",
|
||||
"account_analytic_analysis_view.xml",
|
||||
"account_analytic_analysis_menu.xml",
|
||||
],
|
||||
'demo_xml': [],
|
||||
"author" : "Camptocamp",
|
||||
"website" : "http://www.camptocamp.com/",
|
||||
"depends" : ["hr_timesheet_invoice"],
|
||||
"init_xml" : [],
|
||||
"update_xml": [
|
||||
"security/ir.model.access.csv",
|
||||
"account_analytic_analysis_view.xml",
|
||||
"account_analytic_analysis_menu.xml",
|
||||
],
|
||||
'demo_xml' : [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'active' : False,
|
||||
'certificate': '0042927202589',
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,18 +19,16 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import operator
|
||||
from osv import osv, fields
|
||||
from osv.orm import intersect
|
||||
import tools.sql
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class account_analytic_account(osv.osv):
|
||||
_name = "account.analytic.account"
|
||||
_inherit = "account.analytic.account"
|
||||
|
||||
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _ca_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -46,7 +44,7 @@ class account_analytic_account(osv.osv):
|
|||
|
||||
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context)
|
||||
|
||||
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _ca_to_invoice_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
res2 = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
|
@ -92,7 +90,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context={}):
|
||||
def _hours_qtt_non_invoiced_calc (self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -117,7 +115,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _hours_quantity_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _hours_quantity_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -141,7 +139,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _total_cost_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _total_cost_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -158,7 +156,7 @@ class account_analytic_account(osv.osv):
|
|||
return self._compute_currency_for_level_tree(cr, uid, ids, parent_ids, res, context)
|
||||
|
||||
# TODO Take care of pricelist and purchase !
|
||||
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _ca_theorical_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
res2 = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
|
@ -202,7 +200,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2) + round(res2.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context={}):
|
||||
def _last_worked_date_calc (self, cr, uid, ids, name, arg, context = None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -223,7 +221,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = res.get(id, '')
|
||||
return res
|
||||
|
||||
def _last_invoice_date_calc (self, cr, uid, ids, name, arg, context={}):
|
||||
def _last_invoice_date_calc (self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -247,7 +245,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = res.get(id, '')
|
||||
return res
|
||||
|
||||
def _last_worked_invoiced_date_calc (self, cr, uid, ids, name, arg, context={}):
|
||||
def _last_worked_invoiced_date_calc (self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
parent_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
|
||||
if parent_ids:
|
||||
|
@ -268,7 +266,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = res.get(id, '')
|
||||
return res
|
||||
|
||||
def _remaining_hours_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _remaining_hours_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
if account.quantity_max != 0:
|
||||
|
@ -279,7 +277,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _hours_qtt_invoiced_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
res[account.id] = account.hours_quantity - account.hours_qtt_non_invoiced
|
||||
|
@ -289,7 +287,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _revenue_per_hour_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
if account.hours_qtt_invoiced == 0:
|
||||
|
@ -300,7 +298,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _real_margin_rate_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
if account.ca_invoiced == 0:
|
||||
|
@ -313,7 +311,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _remaining_ca_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _remaining_ca_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
if account.amount_max != 0:
|
||||
|
@ -324,7 +322,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _real_margin_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _real_margin_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
res[account.id] = account.ca_invoiced + account.total_cost
|
||||
|
@ -332,7 +330,7 @@ class account_analytic_account(osv.osv):
|
|||
res[id] = round(res.get(id, 0.0),2)
|
||||
return res
|
||||
|
||||
def _theorical_margin_calc(self, cr, uid, ids, name, arg, context={}):
|
||||
def _theorical_margin_calc(self, cr, uid, ids, name, arg, context=None):
|
||||
res = {}
|
||||
for account in self.browse(cr, uid, ids):
|
||||
res[account.id] = account.ca_theorical + account.total_cost
|
||||
|
@ -426,6 +424,7 @@ class account_analytic_account_summary_user(osv.osv):
|
|||
string='Total Time'),
|
||||
'user' : fields.many2one('res.users', 'User'),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user')
|
||||
cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \
|
||||
|
@ -731,6 +730,5 @@ class account_analytic_account_summary_month(osv.osv):
|
|||
|
||||
account_analytic_account_summary_month()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<menuitem icon="terp-project" id="base.menu_main_pm" name="Project" sequence="10"/>
|
||||
<!-- <menuitem id="next_id_71" name="Financial Project Management" parent="base.menu_main_pm" groups="account.group_account_invoice" sequence="20"/>-->
|
||||
<menuitem id="menu_invoicing" name="Billing" parent="base.menu_main_pm" sequence="4"/>
|
||||
|
||||
<record id="action_hr_tree_invoiced_all" model="ir.actions.act_window">
|
||||
|
@ -14,17 +13,6 @@
|
|||
</record>
|
||||
<menuitem action="action_hr_tree_invoiced_all" id="menu_action_hr_tree_invoiced_all" parent="menu_invoicing"/>
|
||||
|
||||
<record id="action_account_analytic_all" model="ir.actions.act_window">
|
||||
<field name="name">All Analytic Accounts</field>
|
||||
<field name="res_model">account.analytic.account</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
<field name="view_id" ref="account.view_account_analytic_account_list"/>
|
||||
<field name="search_view_id" ref="account.view_account_analytic_account_search"/>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
<!-- <menuitem name="Analytic Accounts" action="action_account_analytic_all" id="menu_action_account_analytic_all" parent="next_id_71"/>-->
|
||||
|
||||
<record id="action_account_analytic_managed_overpassed" model="ir.actions.act_window">
|
||||
<field name="name">Overpassed Accounts</field>
|
||||
<field name="res_model">account.analytic.account</field>
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<field name="ca_invoiced"/>
|
||||
<field name="ca_theorical"/>
|
||||
<newline/>
|
||||
<!-- <field name="old"/> -->
|
||||
<field name="hours_quantity"/>
|
||||
<field name="hours_qtt_invoiced"/>
|
||||
<field name="remaining_hours"/>
|
||||
|
@ -38,13 +37,12 @@
|
|||
<separator colspan="4" string="Key dates"/>
|
||||
|
||||
<field name="last_invoice_date"/>
|
||||
|
||||
<field name="last_worked_invoiced_date"/>
|
||||
<field name="last_worked_date"/>
|
||||
<separator colspan="4" string="To be invoiced"/>
|
||||
|
||||
<field name="hours_qtt_non_invoiced"/>
|
||||
<field name="ca_to_invoice"/>
|
||||
|
||||
</page>
|
||||
<page string="Stats by month">
|
||||
<field colspan="4" name="month_ids" nolabel="1">
|
||||
|
@ -81,20 +79,18 @@
|
|||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
|
||||
<field name="name">account.analytic.account.tree</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
<field name="inherit_id" ref="account.view_account_analytic_account_list"/>
|
||||
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date" position="before">
|
||||
<field name="last_invoice_date"/>
|
||||
<field name="ca_to_invoice"/>
|
||||
</field>
|
||||
|
||||
</field>
|
||||
|
||||
</record>
|
||||
|
||||
<record id="view_account_analytic_simplified" model="ir.ui.view">
|
||||
|
@ -110,7 +106,6 @@
|
|||
<field name="remaining_hours"/>
|
||||
<field name="ca_to_invoice"/>
|
||||
<field name="last_invoice_date"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -20,4 +20,5 @@
|
|||
##############################################################################
|
||||
|
||||
import account_analytic_default
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,11 +19,10 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Account Analytic Default',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/Accounting',
|
||||
'name' : 'Account Analytic Default',
|
||||
'version' : '1.0',
|
||||
'category' : 'Generic Modules/Accounting',
|
||||
'description': """
|
||||
Allows to automatically select analytic accounts based on criterions:
|
||||
* Product
|
||||
|
@ -32,14 +31,15 @@ Allows to automatically select analytic accounts based on criterions:
|
|||
* Company
|
||||
* Date
|
||||
""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['account', 'sale'],
|
||||
'init_xml': [],
|
||||
'author' : 'Tiny',
|
||||
'website' : 'http://www.openerp.com',
|
||||
'depends' : ['account', 'sale'],
|
||||
'init_xml' : [],
|
||||
'update_xml': ['security/ir.model.access.csv', 'account_analytic_default_view.xml'],
|
||||
'demo_xml': [],
|
||||
'demo_xml' : [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0074229833581',
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,10 +19,10 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
from osv import orm
|
||||
import time
|
||||
|
||||
from osv import fields,osv
|
||||
|
||||
class account_analytic_default(osv.osv):
|
||||
_name = 'account.analytic.default'
|
||||
_description = 'Analytic Distribution'
|
||||
|
@ -38,7 +38,7 @@ class account_analytic_default(osv.osv):
|
|||
'date_start': fields.date('Start Date'),
|
||||
'date_stop': fields.date('End Date'),
|
||||
}
|
||||
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context={}):
|
||||
def account_get(self, cr, uid, product_id=None, partner_id=None, user_id=None, date=None, context=None):
|
||||
domain = []
|
||||
if product_id:
|
||||
domain += ['|',('product_id','=',product_id)]
|
||||
|
@ -54,7 +54,9 @@ class account_analytic_default(osv.osv):
|
|||
domain += ['|',('date_stop','>=',date),('date_stop','=',False)]
|
||||
best_index = -1
|
||||
res = False
|
||||
print "domain---",domain
|
||||
for rec in self.browse(cr, uid, self.search(cr, uid, domain, context=context), context=context):
|
||||
print "innn for--",rec
|
||||
index = 0
|
||||
if rec.product_id: index+=1
|
||||
if rec.partner_id: index+=1
|
||||
|
@ -64,6 +66,7 @@ class account_analytic_default(osv.osv):
|
|||
if index>best_index:
|
||||
res = rec
|
||||
best_index = index
|
||||
print "res--",res
|
||||
return res
|
||||
account_analytic_default()
|
||||
|
||||
|
@ -71,7 +74,7 @@ class account_invoice_line(osv.osv):
|
|||
_inherit = 'account.invoice.line'
|
||||
_description = 'Invoice Line'
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, currency_id=False, context={}):
|
||||
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, currency_id=False, context=None):
|
||||
res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, currency_id=currency_id, context=context)
|
||||
rec = self.pool.get('account.analytic.default').account_get(cr, uid, product, partner_id, uid, time.strftime('%Y-%m-%d'), context)
|
||||
if rec:
|
||||
|
@ -101,7 +104,7 @@ class sale_order_line(osv.osv):
|
|||
_inherit = 'sale.order.line'
|
||||
|
||||
# Method overridden to set the analytic account by default on criterion match
|
||||
def invoice_line_create(self, cr, uid, ids, context={}):
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||
if not ids:
|
||||
return create_ids
|
||||
|
@ -117,6 +120,4 @@ class sale_order_line(osv.osv):
|
|||
|
||||
sale_order_line()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_analytic_default_form" model="ir.actions.act_window">
|
||||
<field name="name">Analytic Defaults</field>
|
||||
<field name="res_model">account.analytic.default</field>
|
||||
|
@ -59,10 +60,6 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_account_analytic_default_form_search"/>
|
||||
</record>
|
||||
<!-- <menuitem-->
|
||||
<!-- action="action_analytic_default_form"-->
|
||||
<!-- id="menu_analytic_defaul_form"-->
|
||||
<!-- parent="account.menu_analytic_accounting"/>-->
|
||||
|
||||
<act_window
|
||||
name="Entries"
|
||||
|
|
|
@ -22,5 +22,6 @@
|
|||
import account_analytic_plans
|
||||
import wizard
|
||||
import report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
|
||||
|
||||
{
|
||||
'name': 'Multiple-plans management in Analytic Accounting',
|
||||
'version': '1.0',
|
||||
'category': 'Generic Modules/Accounting',
|
||||
'name' : 'Multiple-plans management in Analytic Accounting',
|
||||
'version' : '1.0',
|
||||
'category' : 'Generic Modules/Accounting',
|
||||
'description': """This module allows to use several analytic plans, according to the general journal,
|
||||
so that multiple analytic lines are created when the invoice or the entries
|
||||
are confirmed.
|
||||
|
@ -54,10 +54,10 @@ for one account entry.
|
|||
The analytic plan validates the minimum and maximum percentage at the time of creation
|
||||
of distribution models.
|
||||
""",
|
||||
'author': 'Tiny',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['account', 'account_analytic_default'],
|
||||
'init_xml': [],
|
||||
'author' : 'Tiny',
|
||||
'website' : 'http://www.openerp.com',
|
||||
'depends' : ['account', 'account_analytic_default'],
|
||||
'init_xml' : [],
|
||||
'update_xml': [
|
||||
'security/ir.model.access.csv',
|
||||
'account_analytic_plans_view.xml',
|
||||
|
@ -65,9 +65,10 @@ of distribution models.
|
|||
'wizard/analytic_plan_create_model_view.xml',
|
||||
'wizard/account_crossovered_analytic_view.xml'
|
||||
],
|
||||
'demo_xml': [],
|
||||
'demo_xml' : [],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'active' : False,
|
||||
'certificate': '0036417675373',
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -19,15 +19,9 @@
|
|||
#
|
||||
##############################################################################
|
||||
from lxml import etree
|
||||
|
||||
from mx import DateTime
|
||||
from mx.DateTime import now
|
||||
import time
|
||||
|
||||
import netsvc
|
||||
from osv import fields, osv,orm
|
||||
import ir
|
||||
|
||||
from osv import fields, osv
|
||||
import tools
|
||||
from tools.translate import _
|
||||
|
||||
|
@ -64,6 +58,7 @@ account_analytic_plan()
|
|||
class account_analytic_plan_line(osv.osv):
|
||||
_name = "account.analytic.plan.line"
|
||||
_description = "Analytic Plan Line"
|
||||
_order = "sequence, id"
|
||||
_columns = {
|
||||
'plan_id':fields.many2one('account.analytic.plan','Analytic Plan'),
|
||||
'name': fields.char('Plan Name', size=64, required=True, select=True),
|
||||
|
@ -73,16 +68,15 @@ class account_analytic_plan_line(osv.osv):
|
|||
'max_required': fields.float('Maximum Allowed (%)'),
|
||||
}
|
||||
_defaults = {
|
||||
'min_required': lambda *args: 100.0,
|
||||
'max_required': lambda *args: 100.0,
|
||||
'min_required': 100.0,
|
||||
'max_required': 100.0,
|
||||
}
|
||||
_order = "sequence,id"
|
||||
account_analytic_plan_line()
|
||||
|
||||
class account_analytic_plan_instance(osv.osv):
|
||||
_name='account.analytic.plan.instance'
|
||||
_name = 'account.analytic.plan.instance'
|
||||
_description = 'Analytic Plan Instance'
|
||||
_columns={
|
||||
_columns = {
|
||||
'name':fields.char('Analytic Distribution', size=64),
|
||||
'code':fields.char('Distribution Code', size=16),
|
||||
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal' ),
|
||||
|
@ -116,7 +110,9 @@ class account_analytic_plan_instance(osv.osv):
|
|||
'account4_ids':False, 'account5_ids':False, 'account6_ids':False})
|
||||
return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def _default_journal(self, cr, uid, context={}):
|
||||
def _default_journal(self, cr, uid, context=None):
|
||||
if not context:
|
||||
context = {}
|
||||
if context.has_key('journal_id') and context['journal_id']:
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id'])
|
||||
if journal.analytic_journal_id:
|
||||
|
@ -124,10 +120,10 @@ class account_analytic_plan_instance(osv.osv):
|
|||
return False
|
||||
|
||||
_defaults = {
|
||||
'plan_id': lambda *args: False,
|
||||
'plan_id': False,
|
||||
'journal_id': _default_journal,
|
||||
}
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
res = []
|
||||
for inst in self.browse(cr, uid, ids, context):
|
||||
name = inst.name or '/'
|
||||
|
@ -207,7 +203,7 @@ class account_analytic_plan_instance(osv.osv):
|
|||
|
||||
return super(account_analytic_plan_instance, self).create(cr, uid, vals, context)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context={}, check=True, update_check=True):
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
this = self.browse(cr, uid, ids[0])
|
||||
if this.plan_id and not vals.has_key('plan_id'):
|
||||
#this instance is a model, so we have to create a new plan instance instead of modifying it
|
||||
|
@ -237,9 +233,9 @@ class account_analytic_plan_instance_line(osv.osv):
|
|||
'rate':fields.float('Rate (%)', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'rate': lambda *args: 100.0
|
||||
'rate': 100.0
|
||||
}
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
def name_get(self, cr, uid, ids, context=None):
|
||||
if not len(ids):
|
||||
return []
|
||||
reads = self.read(cr, uid, ids, ['analytic_account_id'], context)
|
||||
|
@ -297,7 +293,7 @@ class account_move_line(osv.osv):
|
|||
del(data['analytics_id'])
|
||||
return data
|
||||
|
||||
def create_analytic_lines(self, cr, uid, ids, context={}):
|
||||
def create_analytic_lines(self, cr, uid, ids, context=None):
|
||||
super(account_move_line, self).create_analytic_lines(cr, uid, ids, context)
|
||||
analytic_line_obj = self.pool.get('account.analytic.line')
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
|
@ -333,7 +329,7 @@ class account_invoice(osv.osv):
|
|||
_name = "account.invoice"
|
||||
_inherit="account.invoice"
|
||||
|
||||
def line_get_convert(self, cr, uid, x, part, date, context={}):
|
||||
def line_get_convert(self, cr, uid, x, part, date, context=None):
|
||||
res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context)
|
||||
res['analytics_id']=x.get('analytics_id',False)
|
||||
return res
|
||||
|
@ -399,7 +395,7 @@ class sale_order_line(osv.osv):
|
|||
_inherit = 'sale.order.line'
|
||||
|
||||
# Method overridden to set the analytic account by default on criterion match
|
||||
def invoice_line_create(self, cr, uid, ids, context={}):
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context)
|
||||
if ids:
|
||||
sale_line_obj = self.browse(cr, uid, ids[0], context)
|
||||
|
|
|
@ -11,13 +11,6 @@
|
|||
auto="False"
|
||||
menu="False"/>
|
||||
|
||||
<!--<wizard
|
||||
id="account_analytic_account_inverted_balance_report"
|
||||
string="Crossovered Analytic"
|
||||
model="account.analytic.account"
|
||||
name="wizard.crossovered.analytic"
|
||||
keyword="client_print_multi"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
|
@ -89,7 +89,11 @@
|
|||
<field name="code" select="1"/>
|
||||
<field name="plan_id" required="True"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="account_ids" string="Analytic Distribution" colspan="4">
|
||||
<field name="account_ids" nolabel="1" colspan="4">
|
||||
<form string="Analytic Distribution">
|
||||
<field name="rate"/>
|
||||
<field name="analytic_account_id"/>
|
||||
</form>
|
||||
<tree string="Analytic Distribution" editable="bottom">
|
||||
<field name="rate"/>
|
||||
<field name="analytic_account_id"/>
|
||||
|
@ -124,16 +128,11 @@
|
|||
|
||||
<act_window name="Distribution Models"
|
||||
domain="[('plan_id', '=', active_id),('plan_id','<>',False)]"
|
||||
context="{'plan_id': active_id}"
|
||||
context="{'plan_id':active_id}"
|
||||
res_model="account.analytic.plan.instance"
|
||||
src_model="account.analytic.plan"
|
||||
id="account_analytic_instance_model_open"/>
|
||||
|
||||
<!-- <menuitem-->
|
||||
<!-- name="Analytic Distribution's models" parent="account.account_def_analytic_journal"-->
|
||||
<!-- id="menu_account_analytic_plan_instance_action"-->
|
||||
<!-- action="account_analytic_plan_instance_action"/>-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="account_analytic_plan_instance_line_form">
|
||||
<field name="name">account.analytic.plan.instance.line.form</field>
|
||||
<field name="model">account.analytic.plan.instance.line</field>
|
||||
|
@ -234,7 +233,7 @@
|
|||
</field>
|
||||
</record>
|
||||
|
||||
<!-- add property field on product -->
|
||||
<!-- add property field on default analytic account-->
|
||||
|
||||
<record model="ir.ui.view" id="view_default_inherit_form">
|
||||
<field name="name">account.analytic.default.form.plans</field>
|
||||
|
|
|
@ -20,5 +20,6 @@
|
|||
##############################################################################
|
||||
|
||||
import crossovered_analytic
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -19,20 +19,20 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import pooler
|
||||
import time
|
||||
|
||||
from report import report_sxw
|
||||
|
||||
class crossovered_analytic(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(crossovered_analytic, self).__init__(cr, uid, name, context=context)
|
||||
super(crossovered_analytic, self).__init__(cr, uid, name, context = context)
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
'lines': self._lines,
|
||||
'ref_lines' : self._ref_lines,
|
||||
'find_children':self.find_children,
|
||||
})
|
||||
self.base_amount=0.00
|
||||
self.base_amount = 0.00
|
||||
|
||||
def find_children(self,ref_ids):
|
||||
to_return_ids = []
|
||||
|
@ -153,23 +153,23 @@ class crossovered_analytic(report_sxw.rml_parse):
|
|||
if not form['empty_line']:
|
||||
res.append(result)
|
||||
else:
|
||||
result={}
|
||||
res=[]
|
||||
result['id']=acc_id
|
||||
result = {}
|
||||
res = []
|
||||
result['id'] = acc_id
|
||||
data_account = acc_pool.browse(self.cr,self.uid,acc_id)
|
||||
result['acc_name']=data_account.name
|
||||
result['acc_name'] = data_account.name
|
||||
result['code'] = data_account.code
|
||||
result['amt']=result['qty']=result['perc']=0.00
|
||||
result['amt'] = result['qty'] = result['perc'] = 0.00
|
||||
if not form['empty_line']:
|
||||
res.append(result)
|
||||
|
||||
for item in res:
|
||||
obj_acc=acc_pool.name_get(self.cr,self.uid,[item['id']])
|
||||
item['acc_name']=obj_acc[0][1]
|
||||
obj_acc = acc_pool.name_get(self.cr,self.uid,[item['id']])
|
||||
item['acc_name'] = obj_acc[0][1]
|
||||
final.append(item)
|
||||
return final
|
||||
|
||||
report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic', 'account.analytic.account', 'addons/account_analytic_plans/report/crossovered_analytic.rml',parser=crossovered_analytic, header=False)
|
||||
report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic', 'account.analytic.account', 'addons/account_analytic_plans/report/crossovered_analytic.rml',parser = crossovered_analytic, header = False)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -21,5 +21,6 @@
|
|||
|
||||
import analytic_plan_create_model
|
||||
import account_crossovered_analytic
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -8,17 +8,19 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Crossovered Analytic">
|
||||
<group col="4" colspan="6">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="ref" colspan="4"/>
|
||||
<field name="journal_ids" colspan="4"/>
|
||||
<field name="empty_line"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
<group height="280" width="300">
|
||||
<group col="4" colspan="6">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
<field name="ref" colspan="4"/>
|
||||
<field name="journal_ids" colspan="4"/>
|
||||
<field name="empty_line"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
|
Loading…
Reference in New Issue