[MOVE] account: moved account/project files to analytic or account, depending on...
authorcod-odoo <cod@openerp.com>
Wed, 25 Jun 2014 06:07:30 +0000 (11:37 +0530)
committerThibault Delavallée <tde@openerp.com>
Mon, 4 Aug 2014 11:23:46 +0000 (13:23 +0200)
119 files changed:
addons/account/__init__.py
addons/account/__openerp__.py
addons/account/account.py
addons/account/account_analytic_line.py
addons/account/account_analytic_view.xml [new file with mode: 0644]
addons/account/demo/account_minimal.xml
addons/account/partner_view.xml
addons/account/project/__init__.py [deleted file]
addons/account/project/analytic_account_demo.xml [deleted file]
addons/account/project/project.py [deleted file]
addons/account/project/project_demo.xml [deleted file]
addons/account/project/project_report.xml [deleted file]
addons/account/project/project_view.xml [deleted file]
addons/account/project/report/__init__.py [deleted file]
addons/account/project/report/analytic_balance.py [deleted file]
addons/account/project/report/analytic_journal.py [deleted file]
addons/account/project/report/cost_ledger.py [deleted file]
addons/account/project/report/inverted_analytic_balance.py [deleted file]
addons/account/project/report/quantity_cost_ledger.py [deleted file]
addons/account/project/views/report_analyticbalance.xml [deleted file]
addons/account/project/views/report_analyticcostledger.xml [deleted file]
addons/account/project/views/report_analyticcostledgerquantity.xml [deleted file]
addons/account/project/views/report_analyticjournal.xml [deleted file]
addons/account/project/views/report_invertedanalyticbalance.xml [deleted file]
addons/account/project/wizard/__init__.py [deleted file]
addons/account/project/wizard/account_analytic_balance_report.py [deleted file]
addons/account/project/wizard/account_analytic_balance_report_view.xml [deleted file]
addons/account/project/wizard/account_analytic_chart.py [deleted file]
addons/account/project/wizard/account_analytic_chart_view.xml [deleted file]
addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py [deleted file]
addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml [deleted file]
addons/account/project/wizard/account_analytic_cost_ledger_report.py [deleted file]
addons/account/project/wizard/account_analytic_cost_ledger_view.xml [deleted file]
addons/account/project/wizard/account_analytic_inverted_balance_report.py [deleted file]
addons/account/project/wizard/account_analytic_inverted_balance_report.xml [deleted file]
addons/account/project/wizard/account_analytic_journal_report.py [deleted file]
addons/account/project/wizard/account_analytic_journal_report_view.xml [deleted file]
addons/account/project/wizard/project_account_analytic_line.py [deleted file]
addons/account/project/wizard/project_account_analytic_line_view.xml [deleted file]
addons/account/report/account_analytic_entries_report.py
addons/account/report/account_analytic_entries_report_view.xml
addons/account/security/account_security.xml
addons/account/security/ir.model.access.csv
addons/account/test/account_fiscalyear_close.yml
addons/account/test/account_report.yml
addons/account_analytic_analysis/account_analytic_analysis_view.xml
addons/account_analytic_analysis/analytic_account_demo.xml
addons/account_analytic_plans/test/acount_analytic_plans_report.yml
addons/account_budget/account_budget_demo.xml
addons/account_budget/test/account_budget.yml
addons/account_budget/test/account_budget_report.yml
addons/account_voucher/test/case1_usd_usd.yml
addons/account_voucher/test/case1_usd_usd_payment_rate.yml
addons/account_voucher/test/case2_usd_eur_debtor_in_eur.yml
addons/account_voucher/test/case2_usd_eur_debtor_in_usd.yml
addons/account_voucher/test/case3_eur_eur.yml
addons/account_voucher/test/case4_cad_chf.yml
addons/account_voucher/test/case5_suppl_usd_usd.yml
addons/account_voucher/test/case_eur_usd.yml
addons/analytic/__init__.py
addons/analytic/__openerp__.py
addons/analytic/analytic.py [deleted file]
addons/analytic/analytic_data.xml [deleted file]
addons/analytic/analytic_report.xml [new file with mode: 0644]
addons/analytic/analytic_sequence.xml [deleted file]
addons/analytic/analytic_view.xml [deleted file]
addons/analytic/data/analytic_account_demo.xml [new file with mode: 0644]
addons/analytic/data/analytic_data.xml [new file with mode: 0644]
addons/analytic/data/analytic_demo.xml [new file with mode: 0644]
addons/analytic/data/analytic_sequence.xml [new file with mode: 0644]
addons/analytic/models/__init__.py [new file with mode: 0644]
addons/analytic/models/analytic.py [new file with mode: 0644]
addons/analytic/report/__init__.py [new file with mode: 0644]
addons/analytic/report/analytic_balance.py [new file with mode: 0644]
addons/analytic/report/analytic_cost_ledger.py [new file with mode: 0644]
addons/analytic/report/analytic_inverted_balance.py [new file with mode: 0644]
addons/analytic/report/analytic_journal.py [new file with mode: 0644]
addons/analytic/report/analytic_quantity_cost_ledger.py [new file with mode: 0644]
addons/analytic/security/analytic_security.xml
addons/analytic/views/analytic_view.xml [new file with mode: 0644]
addons/analytic/views/report_analyticbalance.xml [new file with mode: 0644]
addons/analytic/views/report_analyticcostledger.xml [new file with mode: 0644]
addons/analytic/views/report_analyticcostledgerquantity.xml [new file with mode: 0644]
addons/analytic/views/report_analyticjournal.xml [new file with mode: 0644]
addons/analytic/views/report_invertedanalyticbalance.xml [new file with mode: 0644]
addons/analytic/wizard/__init__.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_balance_report.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_balance_report_view.xml [new file with mode: 0644]
addons/analytic/wizard/account_analytic_chart.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_chart_view.xml [new file with mode: 0644]
addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report_view.xml [new file with mode: 0644]
addons/analytic/wizard/account_analytic_cost_ledger_report.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_cost_ledger_view.xml [new file with mode: 0644]
addons/analytic/wizard/account_analytic_inverted_balance_report.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_inverted_balance_report.xml [new file with mode: 0644]
addons/analytic/wizard/account_analytic_journal_report.py [new file with mode: 0644]
addons/analytic/wizard/account_analytic_journal_report_view.xml [new file with mode: 0644]
addons/hr_expense/hr_expense.py
addons/hr_expense/hr_expense_demo.xml
addons/hr_expense/hr_expense_view.xml
addons/hr_expense/hr_expense_workflow.xml
addons/hr_expense/security/ir.model.access.csv
addons/hr_timesheet/hr_timesheet_demo.xml
addons/hr_timesheet/security/ir.model.access.csv
addons/hr_timesheet/test/hr_timesheet_demo.yml
addons/hr_timesheet/test/test_hr_timesheet.yml
addons/hr_timesheet_invoice/hr_timesheet_invoice_demo.xml
addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml
addons/hr_timesheet_invoice/report/hr_timesheet_invoice_report.py
addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice.yml
addons/hr_timesheet_invoice/test/test_hr_timesheet_invoice_no_prod_tax.yml
addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
addons/mrp/security/ir.model.access.csv
addons/multi_company/multi_company_demo.xml
addons/project/project.py
addons/project_issue/project_issue.py
addons/project_issue_sheet/security/ir.model.access.csv
addons/project_timesheet/project_timesheet_view.xml

index bc27e14..3d6f606 100644 (file)
@@ -22,7 +22,6 @@
 import partner
 import account
 import installer
-import project
 import account_invoice
 import account_bank_statement
 import account_bank
index b5aa1cb..42cb8c8 100644 (file)
@@ -97,24 +97,16 @@ for a particular financial year and for preparation of vouchers there is a modul
         'wizard/account_automatic_reconcile_view.xml',
         'wizard/account_financial_report_view.xml',
         'wizard/pos_box.xml',
-        'project/wizard/project_account_analytic_line_view.xml',
         'account_end_fy.xml',
         'account_invoice_view.xml',
         'data/account_data.xml',
         'data/data_account_type.xml',
         'data/configurable_account_chart.xml',
         'account_invoice_workflow.xml',
-        'project/project_view.xml',
-        'project/project_report.xml',
-        'project/wizard/account_analytic_balance_report_view.xml',
-        'project/wizard/account_analytic_cost_ledger_view.xml',
-        'project/wizard/account_analytic_inverted_balance_report.xml',
-        'project/wizard/account_analytic_journal_report_view.xml',
-        'project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml',
-        'project/wizard/account_analytic_chart_view.xml',
         'partner_view.xml',
         'product_view.xml',
         'account_assert_test.xml',
+        'account_analytic_view.xml',
         'ir_sequence_view.xml',
         'company_view.xml',
         'edi/invoice_action_data.xml',
@@ -135,11 +127,6 @@ for a particular financial year and for preparation of vouchers there is a modul
         'views/report_partnerledgerother.xml',
         'views/report_financial.xml',
         'views/report_generalledger.xml',
-        'project/views/report_analyticbalance.xml',
-        'project/views/report_analyticjournal.xml',
-        'project/views/report_analyticcostledgerquantity.xml',
-        'project/views/report_analyticcostledger.xml',
-        'project/views/report_invertedanalyticbalance.xml',
         'views/account.xml',
     ],
     'qweb' : [
@@ -149,8 +136,6 @@ for a particular financial year and for preparation of vouchers there is a modul
     ],
     'demo': [
         'demo/account_demo.xml',
-        'project/project_demo.xml',
-        'project/analytic_account_demo.xml',
         'demo/account_minimal.xml',
         'demo/account_invoice_demo.xml',
         'demo/account_bank_statement.xml',
index ac70559..19576d1 100644 (file)
@@ -738,6 +738,7 @@ class account_journal(osv.osv):
         'loss_account_id' : fields.many2one('account.account', 'Loss Account'),
         'internal_account_id' : fields.many2one('account.account', 'Internal Transfers Account', select=1),
         'cash_control' : fields.boolean('Cash Control', help='If you want the journal should be control at opening/closing, check this option'),
+        'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal', help="Journal for analytic entries"),
     }
 
     _defaults = {
index 0c122b2..641cd59 100644 (file)
@@ -29,13 +29,14 @@ class account_analytic_line(osv.osv):
     _columns = {
         'product_uom_id': fields.many2one('product.uom', 'Unit of Measure'),
         'product_id': fields.many2one('product.product', 'Product'),
-        'general_account_id': fields.many2one('account.account', 'General Account', required=True, ondelete='restrict'),
+        'general_account_id': fields.many2one('account.account', 'Financial Account', required=True, ondelete='restrict'),
         'move_id': fields.many2one('account.move.line', 'Move Line', ondelete='cascade', select=True),
         'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='restrict', select=True),
         'code': fields.char('Code', size=8),
         'ref': fields.char('Ref.'),
         'currency_id': fields.related('move_id', 'currency_id', type='many2one', relation='res.currency', string='Account Currency', store=True, help="The related account currency if not equal to the company one.", readonly=True),
         'amount_currency': fields.related('move_id', 'amount_currency', type='float', string='Amount Currency', store=True, help="The amount expressed in the related account currency if not equal to the company one.", readonly=True),
+        'partner_id': fields.related('account_id', 'partner_id', type='many2one', relation='res.partner', string='Partner', store=True),
     }
 
     _defaults = {
diff --git a/addons/account/account_analytic_view.xml b/addons/account/account_analytic_view.xml
new file mode 100644 (file)
index 0000000..c73e0cb
--- /dev/null
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="view_account_analytic_line_form_inherit_account" model="ir.ui.view">
+            <field name="name">account.analytic.line.form.inherit.account</field>
+            <field name="model">account.analytic.line</field>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_form"/>
+            <field name="arch" type="xml">
+                <data>
+                    <xpath expr="//field[@name='account_id']" position="after">
+                        <field name="journal_id"/>
+                    </xpath>
+                    <xpath expr="//field[@name='date']" position="after">
+                        <field name="ref"/>
+                    </xpath>
+                    <xpath expr="//field[@name='company_id']" position="after">
+                        <field name="partner_id"/>
+                    </xpath>
+                    <xpath expr="//field[@name='amount']" position="after">
+                        <label for="amount_currency" groups="base.group_multi_currency"/>
+                        <div groups="base.group_multi_currency">
+                            <field name="amount_currency" class="oe_inline"/>
+                            <field name="currency_id" class="oe_inline"/>
+                        </div>
+                        <field invisible="1" name="general_account_id"/>
+                    </xpath>
+                    <xpath expr="//label[@for='unit_amount']" position="before">
+                        <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
+                    </xpath>
+                    <xpath expr="//field[@name='unit_amount']" position="after">
+                        <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
+                    </xpath>
+                    <xpath expr="//group[@name='product_info']" position="after">
+                        <group string="General Accounting">
+                            <field name="general_account_id"/>
+                            <field name="move_id" readonly="1"/>
+                        </group>
+                    </xpath>
+                </data>
+            </field>
+        </record>
+        <record id="view_account_analytic_line_tree_inherit_account" model="ir.ui.view">
+            <field name="name">account.analytic.line.tree.inherit.account</field>
+            <field name="model">account.analytic.line</field>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_tree"/>
+            <field name="arch" type="xml">
+                <data>
+                    <xpath expr="//field[@name='date']" position="after">
+                        <field name="ref" invisible="context.get('to_invoice', False)"/>
+                    </xpath>
+                    <xpath expr="//field[@name='user_id']" position="after">
+                        <field name="partner_id"/>
+                        <field name="journal_id" invisible="context.get('to_invoice', False)"/>
+                    </xpath>
+                    <xpath expr="//field[@name='amount']" position="after">
+                        <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)" invisible="not context.get('to_invoice', False)"/>
+                    </xpath>
+                    <xpath expr="//field[@name='unit_amount']" position="after">
+                        <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/>
+                    </xpath>
+                    <xpath expr="//field[@name='account_id']" position="after">
+                        <field name="general_account_id" invisible="context.get('to_invoice', False)"/>
+                    </xpath>
+                </data>
+            </field>
+        </record>
+        <record id="view_account_analytic_line_filter_inherit_account" model="ir.ui.view">
+            <field name="name">account.analytic.line.select.inherit.account</field>
+            <field name="model">account.analytic.line</field>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_filter"/>
+            <field name="arch" type="xml">
+                <data>
+                    <xpath expr="//field[@name='date']" position="after">
+                        <field name="product_id"/>
+                        <filter name="sales" string="Sales" domain="[('journal_id.type','=','sale')]" help="Analytic Journal Items related to a sale journal."/>
+                        <filter name="purchases" string="Purchases" domain="[('journal_id.type','=','purchase')]" help="Analytic Journal Items related to a purchase journal."/>
+                        <filter name="others" string="Others" domain="[('journal_id.type','in',('cash','general','situation'))]"/>
+                    </xpath>
+                    <xpath expr="//field[@name='account_id']" position="after">
+                        <field name="partner_id" filter_domain="[('partner_id','child_of',self)]"/>
+                    </xpath>
+                    <xpath expr="//filter[@name='user_id']" position="after">
+                        <filter string="Financial Account" context="{'group_by':'general_account_id'}"/>
+                        <filter string="Journal" context="{'group_by':'journal_id'}" name="group_journal"/>
+                        <filter string="Product" context="{'group_by':'product_id'}"/>
+                        <filter string="Partner" context="{'group_by':'partner_id'}"/>
+                    </xpath>
+                </data>
+            </field>
+        </record>
+        
+        <menuitem groups="analytic.group_analytic_accounting"
+            action="analytic.action_account_analytic_journal_open_form"
+            id="account_analytic_journal_entries"
+            parent="menu_finance_entries"/>
+            
+        <record id="view_account_journal_1" model="ir.ui.view">
+            <field name="name">account.journal.form.1</field>
+            <field name="model">account.journal</field>
+            <field name="inherit_id" ref="account.view_account_journal_form"/>
+            <field name="arch" type="xml">
+                <field name="type" position="after">
+                    <field name="analytic_journal_id" groups="analytic.group_analytic_accounting"/>
+                </field>
+            </field>
+        </record>
+        
+        <menuitem groups="analytic.group_analytic_accounting" id="next_id_40"
+            name="Analytic" parent="account.menu_finance_generic_reporting"
+            sequence="4"/>
+        <menuitem groups="analytic.group_analytic_accounting"
+            action="analytic.action_account_analytic_journal"
+            id="account_analytic_journal_print" parent="account.next_id_40"/>
+        <menuitem
+            name="Chart of Analytic Accounts"
+            parent="account.menu_finance_charts"
+            action="analytic.action_account_analytic_chart"
+            id="menu_action_analytic_account_tree2"
+            icon="STOCK_INDENT"
+            groups="analytic.group_analytic_accounting"/>
+        <menuitem action="analytic.action_account_analytic_account_form" id="account_analytic_def_account"
+            parent="menu_analytic_accounting"
+            groups="analytic.group_analytic_accounting"/>
+            
+        <menuitem groups="analytic.group_analytic_accounting" action="analytic.action_account_analytic_journal_form" id="account_def_analytic_journal" parent="menu_analytic_accounting" sequence="5"/>
+    </data>
+</openerp>
index 7e6b127..54ced46 100644 (file)
             <field name="sequence_id" ref="sequence_sale_journal"/>
             <field name="default_credit_account_id" ref="a_sale"/>
             <field name="default_debit_account_id" ref="a_sale"/>
-            <field name="analytic_journal_id" ref="cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
         <record id="refund_sales_journal" model="account.journal">
             <field name="sequence_id" ref="sequence_refund_sales_journal"/>
             <field name="default_credit_account_id" ref="a_sale"/>
             <field name="default_debit_account_id" ref="a_sale"/>
-            <field name="analytic_journal_id" ref="cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
 
             <field name="sequence_id" ref="sequence_bank_journal"/>
             <field name="default_debit_account_id" ref="bnk"/>
             <field name="default_credit_account_id" ref="bnk"/>
-            <field name="analytic_journal_id" ref="sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
         <record id="check_journal" model="account.journal">
             <field name="sequence_id" ref="sequence_check_journal"/>
             <field name="default_debit_account_id" ref="cash"/>
             <field name="default_credit_account_id" ref="cash"/>
-            <field name="analytic_journal_id" ref="sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
         <record id="cash_journal" model="account.journal">
             <field name="sequence_id" ref="sequence_cash_journal"/>
             <field name="default_debit_account_id" ref="cash"/>
             <field name="default_credit_account_id" ref="cash"/>
-            <field name="analytic_journal_id" ref="sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
         <record id="miscellaneous_journal" model="account.journal">
             <field name="code">TMIS</field>
             <field name="type">general</field>
             <field name="sequence_id" ref="sequence_miscellaneous_journal"/>
-            <field name="analytic_journal_id" ref="sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
         </record>
         <record id="opening_journal" model="account.journal">
index 36aa1ed..679baa8 100644 (file)
@@ -62,8 +62,8 @@
             <field name="context">{'search_default_partner_id': [active_id], 'default_partner_id': active_id}</field>
             <field name="name">Contracts/Analytic Accounts</field>
             <field name="res_model">account.analytic.account</field>
-            <field name="view_id" ref="view_account_analytic_account_tree"/>
-            <field name="search_view_id" ref="view_account_analytic_account_search"/>
+            <field name="view_id" ref="analytic.view_account_analytic_account_tree"/>
+            <field name="search_view_id" ref="analytic.view_account_analytic_account_search"/>
         </record>
         <record model="ir.ui.view" id="partner_view_buttons">
             <field name="name">partner.view.buttons</field>
diff --git a/addons/account/project/__init__.py b/addons/account/project/__init__.py
deleted file mode 100644 (file)
index b0d01bb..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
-#
-##############################################################################
-
-import project
-import report
-import wizard
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/project/analytic_account_demo.xml b/addons/account/project/analytic_account_demo.xml
deleted file mode 100644 (file)
index 2c4acc6..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="1">
-        <record id="analytic_root" model="account.analytic.account">
-            <field name="name" model="res.company" use="name" search="[]"/>
-        </record>
-        <record id="analytic_absences" model="account.analytic.account">
-            <field name="name">Leaves</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_root"/>
-        </record>
-        <record id="analytic_internal" model="account.analytic.account">
-            <field name="name">Internal</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_root"/>
-        </record>
-        <record id="analytic_our_super_product" model="account.analytic.account">
-            <field name="name">Our Super Product</field>
-            <field name="state">open</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_root"/>
-        </record>
-        <record id="analytic_project_1" model="account.analytic.account">
-            <field name="name">Project 1</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_root"/>
-        </record>
-        <record id="analytic_project_2" model="account.analytic.account">
-            <field name="name">Project 2</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_root"/>
-        </record>
-        <record id="analytic_journal_trainings" model="account.analytic.account">
-            <field name="name">Training</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_internal"/>
-        </record>
-        <record id="analytic_in_house" model="account.analytic.account">
-            <field name="name">In House</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_journal_trainings"/>
-        </record>
-        <record id="analytic_online" model="account.analytic.account">
-            <field name="name">Online</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_journal_trainings"/>
-        </record>
-        <record id="analytic_support" model="account.analytic.account">
-            <field name="name">Support</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_our_super_product"/>
-        </record>
-        <record id="analytic_partners" model="account.analytic.account">
-            <field name="name">Partners</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_support"/>
-        </record>
-        <record id="analytic_customers" model="account.analytic.account">
-            <field name="name">Customers</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_support"/>
-        </record>
-        <record id="analytic_support_internal" model="account.analytic.account">
-            <field name="name">Internal</field>
-            <field name="type">contract</field>
-            <field name="parent_id" ref="analytic_support"/>
-        </record>
-        <record id="analytic_integration" model="account.analytic.account">
-            <field name="name">Integration</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_our_super_product"/>
-        </record>
-        <record id="analytic_consultancy" model="account.analytic.account">
-            <field name="name">Consultancy</field>
-            <field name="type">contract</field>
-            <field name="parent_id" ref="analytic_our_super_product"/>
-        </record>
-        <record id="analytic_super_product_trainings" model="account.analytic.account">
-            <field name="name">Training</field>
-            <field name="type">contract</field>
-            <field name="parent_id" ref="analytic_our_super_product"/>
-        </record>
-        <record id="analytic_seagate_p1" model="account.analytic.account">
-            <field name="name">Seagate P1</field>
-            <field name="parent_id" ref="analytic_integration"/>
-            <field name="type">normal</field>
-            <field name="state">open</field>
-            <field name="partner_id" ref="base.res_partner_19"/>
-        </record>
-        <record id="analytic_seagate_p2" model="account.analytic.account">
-            <field name="name">Seagate P2</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_integration"/>
-            <field name="state">open</field>
-            <field name="partner_id" ref="base.res_partner_19"/>
-        </record>
-        <record id="analytic_millennium_industries" model="account.analytic.account">
-            <field name="name">Millennium Industries</field>
-            <field name="parent_id" ref="analytic_integration"/>
-            <field name="type">normal</field>
-            <field name="partner_id" ref="base.res_partner_15"/>
-        </record>
-        <record id="analytic_integration_c2c" model="account.analytic.account">
-            <field name="name">CampToCamp</field>
-            <field name="type">normal</field>
-            <field eval="str(time.localtime()[0] - 1) + '-08-07'" name="date_start"/>
-            <field eval="time.strftime('%Y-12-31')" name="date"/>
-            <field name="parent_id" ref="analytic_integration"/>
-            <field name="partner_id" ref="base.res_partner_12"/>
-            <field name="state">open</field>
-        </record>
-        <record id="analytic_agrolait" model="account.analytic.account">
-            <field name="name">Agrolait</field>
-            <field name="parent_id" ref="analytic_customers"/>
-            <field name="type">normal</field>
-            <field name="partner_id" ref="base.res_partner_2"/>
-        </record>
-        <record id="analytic_asustek" model="account.analytic.account">
-            <field name="name">Asustek</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_customers"/>
-            <field name="partner_id" ref="base.res_partner_1"/>
-        </record>
-        <record id="analytic_deltapc" model="account.analytic.account">
-            <field name="name">Delta PC</field>
-            <field name="parent_id" ref="analytic_customers"/>
-            <field name="type">normal</field>
-            <field name="partner_id" ref="base.res_partner_4"/>
-        </record>
-        <record id="analytic_spark" model="account.analytic.account">
-            <field name="name">Spark Systems</field>
-            <field eval="str(time.localtime()[0] - 1) + '-05-09'" name="date_start"/>
-            <field eval="time.strftime('%Y-05-08')" name="date"/>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="type">normal</field>
-            <field name="partner_id" ref="base.res_partner_16"/>
-            <field name="state">open</field>
-        </record>
-        <record id="analytic_nebula" model="account.analytic.account">
-            <field name="name">Nebula</field>
-            <field eval="time.strftime('%Y-02-01')" name="date_start"/>
-            <field eval="time.strftime('%Y-07-01')" name="date"/>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="partner_id" ref="base.res_partner_17"/>
-            <field name="state">open</field>
-        </record>
-        <record id="analytic_luminous_technologies" model="account.analytic.account">
-            <field name="name">Luminous Technologies</field>
-            <field eval="time.strftime('%Y-04-24')" name="date_start"/>
-            <field eval="str(time.localtime()[0] + 1) + '-04-24'" name="date"/>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="partner_id" ref="base.res_partner_11"/>
-        </record>
-        <record id="analytic_desertic_hispafuentes" model="account.analytic.account">
-            <field name="name">Desertic - Hispafuentes</field>
-            <field eval="time.strftime('%Y-02-01')" name="date_start"/>
-            <field eval="str(time.localtime()[0] + 1) + '-02-01'" name="date"/>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="partner_id" ref="base.res_partner_12"/>
-        </record>
-        <record id="analytic_think_big_systems" model="account.analytic.account">
-            <field name="name">Think Big Systems</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="partner_id" ref="base.res_partner_18"/>
-        </record>
-        <record id="analytic_partners_camp_to_camp" model="account.analytic.account">
-            <field name="name">Camp to Camp</field>
-            <field eval="time.strftime('%Y-%m-%d', time.localtime(time.time() - 365 * 86400))" name="date_start"/>
-            <field eval="time.strftime('%Y-%m-%d')" name="date"/>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_partners"/>
-            <field name="partner_id" ref="base.res_partner_12"/>
-            <field name="state">open</field>
-        </record>
-        <record id="analytic_project_2_support" model="account.analytic.account">
-            <field name="name">Support</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_project_2"/>
-        </record>
-        <record id="analytic_project_2_development" model="account.analytic.account">
-            <field name="name">Development</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_project_2"/>
-        </record>
-        <record id="analytic_project_1_trainings" model="account.analytic.account">
-            <field name="name">Training</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_project_1"/>
-        </record>
-        <record id="analytic_project_1_development" model="account.analytic.account">
-            <field name="name">Development</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_project_1"/>
-        </record>
-        <record id="analytic_administratif" model="account.analytic.account">
-            <field name="name">Administrative</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_internal"/>
-        </record>
-        <record id="analytic_commercial_marketing" model="account.analytic.account">
-            <field name="name">Commercial &amp; Marketing</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_internal"/>
-        </record>
-        <record id="analytic_our_super_product_development" model="account.analytic.account">
-            <field name="name">Our Super Product Development</field>
-            <field name="type">view</field>
-            <field name="parent_id" ref="analytic_internal"/>
-        </record>
-        <record id="analytic_stable" model="account.analytic.account">
-            <field name="name">Stable</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_our_super_product_development"/>
-        </record>
-        <record id="analytic_trunk" model="account.analytic.account">
-            <field name="name">Trunk</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_our_super_product_development"/>
-        </record>
-        <record id="analytic_paid" model="account.analytic.account">
-            <field name="name">Paid</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_absences"/>
-        </record>
-        <record id="analytic_unpaid" model="account.analytic.account">
-            <field name="name">Unpaid</field>
-            <field name="type">normal</field>
-            <field name="parent_id" ref="analytic_absences"/>
-        </record>
-    </data>
-</openerp>
diff --git a/addons/account/project/project.py b/addons/account/project/project.py
deleted file mode 100644 (file)
index a1fac18..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-from openerp.osv import fields, osv
-
-class account_analytic_journal(osv.osv):
-    _name = 'account.analytic.journal'
-    _description = 'Analytic Journal'
-    _columns = {
-        'name': fields.char('Journal Name', required=True),
-        'code': fields.char('Journal Code', size=8),
-        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the analytic journal without removing it."),
-        'type': fields.selection([('sale','Sale'), ('purchase','Purchase'), ('cash','Cash'), ('general','General'), ('situation','Situation')], 'Type', required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, Odoo will look for a matching journal of the same type."),
-        'line_ids': fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
-        'company_id': fields.many2one('res.company', 'Company', required=True),
-    }
-    _defaults = {
-        'active': True,
-        'type': 'general',
-        'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
-    }
-
-
-class account_journal(osv.osv):
-    _inherit="account.journal"
-
-    _columns = {
-        'analytic_journal_id':fields.many2one('account.analytic.journal','Analytic Journal', help="Journal for analytic entries"),
-    }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/project_demo.xml b/addons/account/project/project_demo.xml
deleted file mode 100644 (file)
index 5ce3452..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="1">
-        <record id="cose_journal_sale" model="account.analytic.journal">
-            <field name="code">SAL</field>
-            <field name="name">Sales</field>
-            <field name="type">sale</field>
-        </record>
-        <record id="sit" model="account.analytic.journal">
-            <field name="code">START</field>
-            <field name="name">Miscellaneous Operation</field>
-            <field name="type">situation</field>
-        </record>
-    </data>
-</openerp>
diff --git a/addons/account/project/project_report.xml b/addons/account/project/project_report.xml
deleted file mode 100644 (file)
index de2e2fe..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-        <report 
-            id="action_account_analytic_account_inverted_balance"
-            model="account.analytic.account"
-            string="Inverted Analytic Balance"
-            report_type="qweb-pdf"
-            name="account.report_invertedanalyticbalance"
-            file="account.report_invertedanalyticbalance"
-            menu="False"
-        />
-
-        <report 
-            id="action_report_analytic_journal"
-            model="account.analytic.journal"
-            string="Analytic Journal"
-            report_type="qweb-pdf"
-            name="account.report_analyticjournal"
-            file="account.report_analyticjournal"
-            menu="False"
-        />
-
-         <report
-            id="action_report_analytic_balance"
-            model="account.analytic.account"
-            string="Analytic Balance"
-            report_type="qweb-pdf"
-            name="account.report_analyticbalance"
-            file="account.report_analyticbalance"
-            menu="False"
-        />
-
-        <report
-            id="action_report_cost_ledger"
-            model="account.analytic.account"
-            report_type="qweb-pdf"
-            string="Cost Ledger"
-            name="account.report_analyticcostledger"
-            file="account.report_analyticcostledger"
-            menu="False"
-        />
-
-        <report
-            id="action_report_cost_ledgerquantity"
-            model="account.analytic.account"
-            report_type="qweb-pdf"
-            string="Cost Ledger (Only quantities)"
-            name="account.report_analyticcostledgerquantity"
-            file="account.report_analyticcostledgerquantity"
-            menu="False"
-        />
-    </data>
-</openerp>
diff --git a/addons/account/project/project_view.xml b/addons/account/project/project_view.xml
deleted file mode 100644 (file)
index 878b8ef..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="view_account_analytic_account_list" model="ir.ui.view">
-            <field name="name">account.analytic.account.list</field>
-            <field name="model">account.analytic.account</field>
-            <field eval="8" name="priority"/>
-            <field name="arch" type="xml">
-                <tree toolbar="1" colors="red:state=='pending';grey:state in ('cancelled','close');blue:type=='view'" string="Analytic Accounts">
-                    <field name="complete_name"/>
-                    <field name="partner_id"/>
-                    <field name="code"/>
-                    <field name="date_start"/>
-                    <field name="date"/>
-                    <field name="user_id" invisible="1"/>
-                    <field name="manager_id"/>
-                    <field name="parent_id" invisible="1"/>
-                    <field name="state" invisible="1"/>
-                    <field name="type" invisible="1"/>
-                    <field name="template_id" invisible="1"/>
-                    <field name="company_id" groups="base.group_multi_company"/>
-                </tree>
-            </field>
-        </record>
-
-        <record id="view_account_analytic_account_search" model="ir.ui.view">
-            <field name="name">account.analytic.account.search</field>
-            <field name="model">account.analytic.account</field>
-            <field name="arch" type="xml">
-                <search string="Analytic Account">
-                    <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>
-                    <field name="date"/>
-                    <field name="partner_id" operator="child_of"/>
-                    <field name="manager_id"/>
-                    <field name="parent_id"/>
-                    <field name="user_id"/>
-                    <filter string="Open" domain="[('state','=','open')]" help="Current Accounts"/>
-                    <filter string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
-                    <group expand="0" string="Group By">
-                        <filter string="Associated Partner" domain="[]" context="{'group_by':'partner_id'}"/>
-                        <filter string="Type" domain="[]" context="{'group_by':'type'}"/>
-                        <filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
-                        <filter string="Parent Account" domain="[]" context="{'group_by':'parent_id'}"/>
-                        <filter string="Status" domain="[]" context="{'group_by':'state'}" groups="base.group_no_one"/>
-                    </group>
-                </search>
-            </field>
-        </record>
-
-        <record id="view_account_analytic_account_tree" model="ir.ui.view">
-            <field name="name">account.analytic.account.tree</field>
-            <field name="model">account.analytic.account</field>
-            <field name="field_parent">child_complete_ids</field>
-            <field name="arch" type="xml">
-                <tree colors="blue:state=='pending';grey:state in ('close','cancelled');blue:type=='view'" string="Analytic account" toolbar="1">
-                    <field name="name" invisible="1"/>
-                    <field name="complete_name"/>
-                    <field name="code"/>
-                    <field name="debit"/>
-                    <field name="credit"/>
-                    <field name="balance"/>
-                    <field name="state" invisible="1"/>
-                    <field name="currency_id" groups="base.group_multi_currency"/>
-                    <field name="date" invisible="1"/>
-                    <field name="user_id" invisible="1"/>
-                    <field name="partner_id" invisible="1"/>
-                    <field name="parent_id" invisible="1"/>
-                    <field name="type"/>
-                    <field name="company_id" groups="base.group_multi_company"/>
-                    <field name="template_id" invisible="1"/>
-                </tree>
-            </field>
-        </record>
-
-
-        <record id="action_account_analytic_account_form" model="ir.actions.act_window">
-            <field name="name">Analytic Accounts</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="context">{}</field> <!-- repair invalid context by setting empty one -->
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="view_id" ref="view_account_analytic_account_tree"/>
-            <field name="search_view_id" ref="account.view_account_analytic_account_search"/>
-        </record>
-        <menuitem action="action_account_analytic_account_form" id="account_analytic_def_account"
-            parent="menu_analytic_accounting"
-            groups="analytic.group_analytic_accounting"/>
-
-        <record id="act_account_renew_view" model="ir.actions.act_window">
-            <field name="name">Accounts to Renew</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="domain">[('date','&lt;',time.strftime('%Y-%m-%d %H:%M:%S'))]</field>
-            <field name="filter" eval="True"/>
-        </record>
-
-        <record id="action_account_analytic_account_tree2" model="ir.actions.act_window">
-            <field name="name">Chart of Analytic Accounts</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="view_type">tree</field>
-            <field name="view_id" ref="view_account_analytic_account_tree"/>
-            <field name="domain">[('parent_id','=',False)]</field>
-            <field name="help" type="html">
-              <p>
-                Click to add a new analytic account.
-              </p><p>
-                The normal chart of accounts has a structure defined by the
-                legal requirement of the country. The analytic chart of
-                accounts structure should reflect your own business needs in
-                term of costs/revenues reporting.
-              </p><p>
-                They are usually structured by contracts, projects, products or
-                departements. Most of the Odoo operations (invoices,
-                timesheets, expenses, etc) generate analytic entries on the
-                related account.
-              </p>
-            </field>
-        </record>
-
-
-        <record id="view_account_analytic_line_form" model="ir.ui.view">
-            <field name="name">account.analytic.line.form</field>
-            <field name="model">account.analytic.line</field>
-            <field name="priority">1</field>
-            <field name="arch" type="xml">
-                <form string="Analytic Entry">
-                    <group>
-                        <group>
-                            <field name="name"/>
-                            <field name="account_id"/>
-                            <field name="journal_id"/>
-                            <field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
-                        </group>
-                        <group>
-                            <field name="date"/>
-                            <field name="ref"/>
-                            <field name="company_id" groups="base.group_multi_company"/>
-                        </group>
-                        <group string="Amount">
-                            <field name="amount"/>
-                            <label for="amount_currency" groups="base.group_multi_currency"/>
-                            <div groups="base.group_multi_currency">
-                                <field name="amount_currency" class="oe_inline"/>
-                                <field name="currency_id" class="oe_inline"/>
-                            </div>
-                        </group>
-                        <group string="Product Information">
-                            <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
-                            <label for="unit_amount"/>
-                            <div>
-                                <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
-                                <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
-                            </div>
-                        </group>
-                        <group string="General Accounting">
-                            <field name="general_account_id"/>
-                            <field name="move_id" readonly="1"/>
-                        </group>
-                    </group>
-                </form>
-            </field>
-        </record>
-        <record id="view_account_analytic_line_tree" model="ir.ui.view">
-            <field name="name">account.analytic.line.tree</field>
-            <field name="model">account.analytic.line</field>
-            <field name="arch" type="xml">
-                <tree string="Analytic Entries">
-                    <field name="date"/>
-                    <field name="ref" invisible="context.get('to_invoice', False)"/>
-                    <field name="name"/>
-                    <field name="user_id"/>
-                    <field name="journal_id" invisible="context.get('to_invoice', False)"/>
-                    <field name="amount" sum="Total" invisible="context.get('to_invoice', False)"/>
-                    <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)" invisible="not context.get('to_invoice', False)"/>
-                    <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" sum="Total Quantity"/>
-                    <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" invisible="not context.get('to_invoice', False)"/>
-                    <field domain="[('type','=','normal')]" name="account_id"/>
-                    <field name="general_account_id" invisible="context.get('to_invoice', False)"/>
-                    <field name="company_id" groups="base.group_multi_company"/>
-                </tree>
-            </field>
-        </record>
-        <record id="view_account_analytic_line_filter" model="ir.ui.view">
-            <field name="name">account.analytic.line.select</field>
-            <field name="model">account.analytic.line</field>
-            <field name="arch" type="xml">
-                <search string="Search Analytic Lines">
-                    <field name="name" string="Analytic Line"/>
-                    <field name="date"/>
-                    <filter name="sales" string="Sales" domain="[('journal_id.type','=','sale')]" help="Analytic Journal Items related to a sale journal."/>
-                    <filter name="purchases" string="Purchases" domain="[('journal_id.type','=','purchase')]" help="Analytic Journal Items related to a purchase journal."/>
-                    <filter name="others" string="Others" domain="[('journal_id.type','in',('cash','general','situation'))]"/>
-                    <separator/>
-                    <filter string="My Entries" domain="[('user_id','=',uid)]"/>
-                    <field name="account_id"/>
-                    <field name="user_id"/>
-                    <group string="Group By" expand="0">
-                        <filter string="Analytic Account" context="{'group_by':'account_id'}"/>
-                        <filter string="Fin. Account" context="{'group_by':'general_account_id'}"/>
-                        <filter string="Journal" context="{'group_by':'journal_id'}" name="group_journal"/>
-                        <separator/>
-                        <filter string="Product" context="{'group_by':'product_id'}"/>
-                        <filter string="User" context="{'group_by':'user_id'}"/>
-                        <separator/>
-                        <filter string="Tasks Month" context="{'group_by':'date'}" name="group_date" help="Invoice Tasks by Month"/>
-
-                    </group>
-                </search>
-            </field>
-        </record>
-        <record id="action_account_analytic_line_form" model="ir.actions.act_window">
-            <field name="name">Analytic Entries</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.line</field>
-            <field name="view_type">form</field>
-            <field name="context">{"search_default_user_id":uid}</field>
-            <field name="view_id" ref="view_account_analytic_line_tree"/>
-        </record>
-
-        <!-- Entries by Line -->
-
-        <record id="action_account_tree1" model="ir.actions.act_window">
-            <field name="name">Analytic Items</field>
-            <field name="res_model">account.analytic.line</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="domain">[('account_id','child_of',[active_id])]</field>
-            <field name="context">{'account_id':active_id}</field>
-            <field name="search_view_id" ref="view_account_analytic_line_filter"/>
-        </record>
-        <record id="ir_open_account_analytic_account" model="ir.values">
-            <field eval="'tree_but_open'" name="key2"/>
-            <field eval="'account.analytic.account'" name="model"/>
-            <field name="name">Open Account Tree</field>
-            <field eval="'ir.actions.act_window,%d'%action_account_tree1" name="value"/>
-        </record>
-
-        <record id="account_analytic_line_extended_form" model="ir.ui.view">
-            <field name="name">account.analytic.line.extended_form</field>
-            <field name="model">account.analytic.line</field>
-            <field name="arch" type="xml">
-                <form string="Project line">
-                    <group>
-                       <group>
-                          <field name="name"/>
-                          <field name="account_id"/>
-                          <field name="journal_id"/>
-                       </group>
-                       <group>
-                          <field name="date" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
-                          <field name="company_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
-                        </group>
-                        <group string="Amount">
-                            <field name="amount"/>
-                            <label for="amount_currency" groups="base.group_multi_currency"/>
-                            <div groups="base.group_multi_currency">
-                                <field name="amount_currency" class="oe_inline"/>
-                                <field name="currency_id" class="oe_inline"/>
-                            </div>
-                            <field invisible="1" name="general_account_id"/>
-                        </group>
-                        <group string="Product Information">
-                            <field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id, journal_id)"/>
-                            <label for="unit_amount"/>
-                            <div>
-                                <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
-                                <field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
-                            </div>
-                        </group>
-                    </group>
-                </form>
-            </field>
-        </record>
-        <record id="action_account_analytic_account_line_extended_form" model="ir.actions.act_window">
-            <field name="name">account.analytic.line.extended</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.line</field>
-            <field name="view_type">form</field>
-            <field name="view_id" ref="account_analytic_line_extended_form"/>
-        </record>
-
-        #
-        # Analytic Journal
-        #
-
-        <record id="view_account_analytic_journal_tree" model="ir.ui.view">
-            <field name="name">account.analytic.journal.tree</field>
-            <field name="model">account.analytic.journal</field>
-            <field name="arch" type="xml">
-                <tree string="Analytic Journal">
-                    <field name="code"/>
-                    <field name="name"/>
-                    <field name="type"/>
-                </tree>
-            </field>
-        </record>
-
-        <record id="view_analytic_journal_search" model="ir.ui.view">
-            <field name="name">account.analytic.journal.search</field>
-            <field name="model">account.analytic.journal</field>
-            <field name="arch" type="xml">
-                <search string="Analytic Journals">
-                    <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Journal"/>
-                    <field name="type"/>
-                    <group expand="0" string="Group By">
-                        <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
-                    </group>
-                </search>
-            </field>
-        </record>
-
-        <record id="view_account_analytic_journal_form" model="ir.ui.view">
-            <field name="name">account.analytic.journal.form</field>
-            <field name="model">account.analytic.journal</field>
-            <field name="arch" type="xml">
-                <form string="Analytic Journal">
-                    <group col="4">
-                        <field name="name"/>
-                        <field name="code"/>
-                        <field name="type"/>
-                        <field name="active"/>
-                        <field name="company_id" groups="base.group_multi_company"/>
-                    </group>
-                </form>
-            </field>
-        </record>
-        <record id="action_account_analytic_journal_form" model="ir.actions.act_window">
-            <field name="name">Analytic Journals</field>
-            <field name="res_model">account.analytic.journal</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="search_view_id" ref="view_analytic_journal_search" />
-        </record>
-        <menuitem groups="analytic.group_analytic_accounting" action="action_account_analytic_journal_form" id="account_def_analytic_journal" parent="menu_analytic_accounting" sequence="5"/>
-
-        #
-        # Open journal entries
-        #
-
-        <record id="action_account_analytic_journal_open_form" model="ir.actions.act_window">
-            <field name="name">Analytic Journal Items</field>
-            <field name="res_model">account.analytic.line</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-        </record>
-        <menuitem groups="analytic.group_analytic_accounting"
-            action="action_account_analytic_journal_open_form"
-            id="account_analytic_journal_entries"
-            parent="menu_finance_entries"/>
-
-        #
-        # Reporting
-        #
-
-
-        <record id="view_account_journal_1" model="ir.ui.view">
-            <field name="name">account.journal.form.1</field>
-            <field name="model">account.journal</field>
-            <field name="inherit_id" ref="account.view_account_journal_form"/>
-            <field name="arch" type="xml">
-                <field name="type" position="after">
-                    <field name="analytic_journal_id" groups="analytic.group_analytic_accounting"/>
-                </field>
-            </field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/report/__init__.py b/addons/account/project/report/__init__.py
deleted file mode 100644 (file)
index 32226f8..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import analytic_journal
-import analytic_balance
-import inverted_analytic_balance
-import cost_ledger
-import quantity_cost_ledger
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/project/report/analytic_balance.py b/addons/account/project/report/analytic_balance.py
deleted file mode 100644 (file)
index 7c333b8..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-
-class account_analytic_balance(report_sxw.rml_parse):
-    def __init__(self, cr, uid, name, context):
-        super(account_analytic_balance, self).__init__(cr, uid, name, context=context)
-        self.localcontext.update( {
-            'time': time,
-            'get_objects': self._get_objects,
-            'lines_g': self._lines_g,
-            'move_sum': self._move_sum,
-            'sum_all': self._sum_all,
-            'sum_balance': self._sum_balance,
-            'move_sum_balance': self._move_sum_balance,
-        })
-        self.acc_ids = []
-        self.read_data = []
-        self.empty_acc = False
-        self.acc_data_dict = {}# maintains a relation with an account with its successors.
-        self.acc_sum_list = []# maintains a list of all ids
-
-    def get_children(self, ids):
-        read_data = self.pool.get('account.analytic.account').read(self.cr, self.uid, ids,['child_ids','code','complete_name','balance'])
-        for data in read_data:
-            if (data['id'] not in self.acc_ids):
-                inculde_empty =  True
-                if (not self.empty_acc) and data['balance'] == 0.00:
-                    inculde_empty = False
-                if inculde_empty:
-                    self.acc_ids.append(data['id'])
-                    self.read_data.append(data)
-                    if data['child_ids']:
-                        self.get_children(data['child_ids'])
-        return True
-
-    def _get_objects(self, empty_acc):
-        if self.read_data:
-            return self.read_data
-        self.empty_acc = empty_acc
-        self.read_data = []
-        self.get_children(self.ids)
-        return self.read_data
-
-    def _lines_g(self, account_id, date1, date2):
-        account_analytic_obj = self.pool.get('account.analytic.account')
-        ids = account_analytic_obj.search(self.cr, self.uid,
-                [('parent_id', 'child_of', [account_id])])
-        self.cr.execute("SELECT aa.name AS name, aa.code AS code, \
-                    sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity \
-                FROM account_analytic_line AS aal, account_account AS aa \
-                WHERE (aal.general_account_id=aa.id) \
-                    AND (aal.account_id IN %s)\
-                    AND (date>=%s) AND (date<=%s) AND aa.active \
-                GROUP BY aal.general_account_id, aa.name, aa.code, aal.code \
-                ORDER BY aal.code", (tuple(ids), date1, date2))
-        res = self.cr.dictfetchall()
-
-        for r in res:
-            if r['balance'] > 0:
-                r['debit'] = r['balance']
-                r['credit'] = 0.0
-            elif r['balance'] < 0:
-                r['debit'] = 0.0
-                r['credit'] = -r['balance']
-            else:
-                r['balance'] == 0
-                r['debit'] = 0.0
-                r['credit'] = 0.0
-        return res
-
-    def _move_sum(self, account_id, date1, date2, option):
-        if account_id not in self.acc_data_dict:
-            account_analytic_obj = self.pool.get('account.analytic.account')
-            ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])])
-            self.acc_data_dict[account_id] = ids
-        else:
-            ids = self.acc_data_dict[account_id]
-
-        query_params = (tuple(ids), date1, date2)
-        if option == "credit":
-            self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
-                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
-        elif option == "debit":
-            self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
-                    WHERE account_id IN %s\
-                        AND date>=%s AND date<=%s AND amount>0",query_params)
-        elif option == "quantity":
-            self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
-                WHERE account_id IN %s\
-                    AND date>=%s AND date<=%s",query_params)
-        return self.cr.fetchone()[0] or 0.0
-
-    def _move_sum_balance(self, account_id, date1, date2):
-        debit = self._move_sum(account_id, date1, date2, 'debit')
-        credit = self._move_sum(account_id, date1, date2, 'credit')
-        return (debit-credit)
-
-    def _sum_all(self, accounts, date1, date2, option):
-        account_analytic_obj = self.pool.get('account.analytic.account')
-        ids = map(lambda x: x['id'], accounts)
-        if not ids:
-            return 0.0
-
-        if not self.acc_sum_list:
-            ids2 = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', ids)])
-            self.acc_sum_list = ids2
-        else:
-            ids2 = self.acc_sum_list
-
-        query_params = (tuple(ids2), date1, date2)
-        if option == "debit":
-            self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
-                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params)
-        elif option == "credit":
-            self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
-                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
-        elif option == "quantity":
-            self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
-                    WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_balance(self, accounts, date1, date2):
-        debit = self._sum_all(accounts, date1, date2, 'debit') or 0.0
-        credit = self._sum_all(accounts, date1, date2, 'credit') or 0.0
-        return (debit-credit)
-
-
-class report_analyticbalance(osv.AbstractModel):
-    _name = 'report.account.report_analyticbalance'
-    _inherit = 'report.abstract_report'
-    _template = 'account.report_analyticbalance'
-    _wrapped_report_class = account_analytic_balance
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/report/analytic_journal.py b/addons/account/project/report/analytic_journal.py
deleted file mode 100644 (file)
index c59efb0..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#    
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
-#
-##############################################################################
-
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-
-#
-# Use period and Journal for selection or resources
-#
-class account_analytic_journal(report_sxw.rml_parse):
-    def __init__(self, cr, uid, name, context):
-        super(account_analytic_journal, self).__init__(cr, uid, name, context=context)
-        self.localcontext.update( {
-            'time': time,
-            'lines': self._lines,
-            'lines_a': self._lines_a,
-            'sum_general': self._sum_general,
-            'sum_analytic': self._sum_analytic,
-        })
-
-    def _lines(self, journal_id, date1, date2):
-        self.cr.execute('SELECT DISTINCT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null)', (date1, date2, journal_id,))
-        ids = map(lambda x: x[0], self.cr.fetchall())
-        return self.pool.get('account.move.line').browse(self.cr, self.uid, ids)
-
-    def _lines_a(self, move_id, journal_id, date1, date2):
-        ids = self.pool.get('account.analytic.line').search(self.cr, self.uid, [('move_id','=',move_id), ('journal_id','=',journal_id), ('date','>=',date1), ('date','<=',date2)])
-        if not ids:
-            return []
-        return self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids)
-        
-    def _sum_general(self, journal_id, date1, date2):
-        self.cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE id IN (SELECT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null))', (date1, date2, journal_id,))
-        return self.cr.fetchall()[0][0] or 0
-
-    def _sum_analytic(self, journal_id, date1, date2):
-        self.cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE date>=%s AND date<=%s AND journal_id=%s", (date1, date2, journal_id))
-        res = self.cr.dictfetchone()
-        return res['sum'] or 0
-
-
-class report_analyticjournal(osv.AbstractModel):
-    _name = 'report.account.report_analyticjournal'
-    _inherit = 'report.abstract_report'
-    _template = 'account.report_analyticjournal'
-    _wrapped_report_class = account_analytic_journal
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py
deleted file mode 100644 (file)
index 5eef375..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-
-class account_analytic_cost_ledger(report_sxw.rml_parse):
-    def __init__(self, cr, uid, name, context):
-        super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context)
-        self.localcontext.update( {
-            'time': time,
-            'lines_g': self._lines_g,
-            'lines_a': self._lines_a,
-            'account_sum_debit': self._account_sum_debit,
-            'account_sum_credit': self._account_sum_credit,
-            'account_sum_balance': self._account_sum_balance,
-            'sum_debit': self._sum_debit,
-            'sum_credit': self._sum_credit,
-            'sum_balance': self._sum_balance,
-        })
-        self.children = {}      # a memo for the method _get_children
-
-    def _get_children(self, accounts):
-        """ return all children accounts of the given accounts
-            :param accounts: list of browse records of 'account.analytic.account'
-            :return: tuple of account ids
-        """
-        analytic_obj = self.pool.get('account.analytic.account')
-        res = set()
-        for account in accounts:
-            if account.id not in self.children:
-                self.children[account.id] = analytic_obj.search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])])
-            res.update(self.children[account.id])
-        return tuple(res)
-
-    def _lines_g(self, account, date1, date2):
-        self.cr.execute("SELECT sum(aal.amount) AS balance, aa.code AS code, aa.name AS name, aa.id AS id \
-                FROM account_account AS aa, account_analytic_line AS aal \
-                WHERE (aal.account_id IN %s) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) AND aa.active \
-                GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", (self._get_children([account]), date1, date2))
-        res = self.cr.dictfetchall()
-        for r in res:
-            r['debit'] = r['balance'] if r['balance'] > 0 else 0.0
-            r['credit'] = -r['balance'] if r['balance'] < 0 else 0.0
-        return res
-
-    def _lines_a(self, general_account, account, date1, date2):
-        self.cr.execute("SELECT aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj FROM account_analytic_line AS aal, account_analytic_journal AS aaj \
-                WHERE (aal.general_account_id=%s) AND (aal.account_id IN %s) AND (aal.date>=%s) AND (aal.date<=%s) \
-                AND (aal.journal_id=aaj.id) \
-                ORDER BY aal.date, aaj.code, aal.code", (general_account['id'], self._get_children([account]), date1, date2))
-        res = self.cr.dictfetchall()
-        for r in res:
-            r['debit'] = r['balance'] if r['balance'] > 0 else 0.0
-            r['credit'] = -r['balance'] if r['balance'] < 0 else 0.0
-        return res
-
-    def _account_sum_debit(self, account, date1, date2):
-        return self._sum_debit([account], date1, date2)
-
-    def _account_sum_credit(self, account, date1, date2):
-        return self._sum_credit([account], date1, date2)
-
-    def _account_sum_balance(self, account, date1, date2):
-        debit = self._account_sum_debit(account, date1, date2)
-        credit = self._account_sum_credit(account, date1, date2)
-        return (debit-credit)
-
-    def _sum_debit(self, accounts, date1, date2):
-        self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",
-            (self._get_children(accounts), date1, date2,))
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_credit(self, accounts, date1, date2):
-        self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",
-            (self._get_children(accounts), date1, date2,))
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_balance(self, accounts, date1, date2):
-        debit = self._sum_debit(accounts, date1, date2)
-        credit = self._sum_credit(accounts, date1, date2)
-        return (debit-credit)
-
-
-class report_analyticcostledger(osv.AbstractModel):
-    _name = 'report.account.report_analyticcostledger'
-    _inherit = 'report.abstract_report'
-    _template = 'account.report_analyticcostledger'
-    _wrapped_report_class = account_analytic_cost_ledger
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/report/inverted_analytic_balance.py b/addons/account/project/report/inverted_analytic_balance.py
deleted file mode 100644 (file)
index 2312914..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-class account_inverted_analytic_balance(report_sxw.rml_parse):
-    def __init__(self, cr, uid, name, context):
-        super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context=context)
-        self.localcontext.update( {
-            'time': time,
-            'lines_g': self._lines_g,
-            'lines_a': self._lines_a,
-            'sum_debit': self._sum_debit,
-            'sum_credit': self._sum_credit,
-            'sum_balance': self._sum_balance,
-            'sum_quantity': self._sum_quantity,
-        })
-
-    def _lines_g(self, accounts, date1, date2):
-        ids = map(lambda x: x.id, accounts)
-        self.cr.execute("SELECT aa.name AS name, aa.code AS code, "
-                        "sum(aal.amount) AS balance, "
-                        "sum(aal.unit_amount) AS quantity, aa.id AS id \
-                FROM account_analytic_line AS aal, account_account AS aa \
-                WHERE (aal.general_account_id=aa.id) "
-                        "AND (aal.account_id IN %s) "
-                        "AND (date>=%s) AND (date<=%s) AND aa.active \
-                GROUP BY aal.general_account_id, aa.name, aa.code, aal.code, aa.id "
-                        "ORDER BY aal.code",
-                        (tuple(ids), date1, date2))
-        res = self.cr.dictfetchall()
-        for r in res:
-            if r['balance'] > 0:
-                r['debit'] = r['balance']
-                r['credit'] = 0.0
-            elif r['balance'] < 0:
-                r['debit'] =  0.0
-                r['credit'] = -r['balance']
-            else:
-                r['debit'] = 0.0
-                r['credit'] = 0.0
-        return res
-
-    def _lines_a(self, accounts, general_account_id, date1, date2):
-        ids = map(lambda x: x.id, accounts)
-        self.cr.execute("SELECT sum(aal.amount) AS balance, "
-                        "sum(aal.unit_amount) AS quantity, "
-                        "aaa.code AS code, aaa.name AS name, account_id \
-                FROM account_analytic_line AS aal, "
-                        "account_analytic_account AS aaa \
-                WHERE aal.account_id=aaa.id AND aal.account_id IN %s "
-                        "AND aal.general_account_id=%s AND aal.date>=%s "
-                        "AND aal.date<=%s \
-                GROUP BY aal.account_id, general_account_id, aaa.code, aaa.name "
-                        "ORDER BY aal.account_id",
-                        (tuple(ids), general_account_id, date1, date2))
-        res = self.cr.dictfetchall()
-
-        aaa_obj = self.pool.get('account.analytic.account')
-        res2 = aaa_obj.read(self.cr, self.uid, ids, ['complete_name'])
-        complete_name = {}
-        for r in res2:
-            complete_name[r['id']] = r['complete_name']
-        for r in res:
-            r['complete_name'] = complete_name[r['account_id']]
-            if r['balance'] > 0:
-                r['debit'] = r['balance']
-                r['credit'] = 0.0
-            elif r['balance'] < 0:
-                r['debit'] = 0.0
-                r['credit'] = -r['balance']
-            else:
-                r['debit'] = 0.0
-                r['credit'] = 0.0
-        return res
-
-    def _sum_debit(self, accounts, date1, date2):
-        ids = map(lambda x: x.id, accounts)
-        self.cr.execute("SELECT sum(amount) \
-                FROM account_analytic_line \
-                WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids),date1, date2,))
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_credit(self, accounts, date1, date2):
-        ids = map(lambda x: x.id, accounts)
-        self.cr.execute("SELECT -sum(amount) \
-                FROM account_analytic_line \
-                WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_balance(self, accounts, date1, date2):
-        debit = self._sum_debit(accounts, date1, date2)
-        credit = self._sum_credit(accounts, date1, date2)
-        return (debit-credit)
-
-    def _sum_quantity(self, accounts, date1, date2):
-        ids = map(lambda x: x.id, accounts)
-        self.cr.execute("SELECT sum(unit_amount) \
-                FROM account_analytic_line \
-                WHERE account_id IN %s AND date>=%s AND date<=%s", (tuple(ids),date1, date2,))
-        return self.cr.fetchone()[0] or 0.0
-
-
-class report_invertedanalyticbalance(osv.AbstractModel):
-    _name = 'report.account.report_invertedanalyticbalance'
-    _inherit = 'report.abstract_report'
-    _template = 'account.report_invertedanalyticbalance'
-    _wrapped_report_class = account_inverted_analytic_balance
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py
deleted file mode 100644 (file)
index d3ed1cd..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-import time
-from openerp.osv import osv
-from openerp.report import report_sxw
-
-
-class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
-    def __init__(self, cr, uid, name, context):
-        super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context)
-        self.localcontext.update( {
-            'time': time,
-            'lines_g': self._lines_g,
-            'lines_a': self._lines_a,
-            'sum_quantity': self._sum_quantity,
-            'account_sum_quantity': self._account_sum_quantity,
-        })
-
-    def _lines_g(self, account_id, date1, date2, journals):
-        if not journals:
-            self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
-                        aa.code AS code, aa.name AS name, aa.id AS id \
-                    FROM account_account AS aa, account_analytic_line AS aal \
-                    WHERE (aal.account_id=%s) AND (aal.date>=%s) \
-                        AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
-                        AND aa.active \
-                    GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
-                    (account_id, date1, date2))
-        else:
-            journal_ids = journals
-            self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
-                        aa.code AS code, aa.name AS name, aa.id AS id \
-                    FROM account_account AS aa, account_analytic_line AS aal \
-                    WHERE (aal.account_id=%s) AND (aal.date>=%s) \
-                        AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
-                        AND aa.active \
-                        AND (aal.journal_id IN %s ) \
-                    GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
-                    (account_id, date1, date2, tuple(journal_ids)))
-        res = self.cr.dictfetchall()
-        return res
-
-    def _lines_a(self, general_account_id, account_id, date1, date2, journals):
-        if not journals:
-            self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
-                        aal.unit_amount AS quantity, aal.date AS date, \
-                        aaj.code AS cj \
-                    FROM account_analytic_line AS aal, \
-                        account_analytic_journal AS aaj \
-                    WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \
-                        AND (aal.date>=%s) AND (aal.date<=%s) \
-                        AND (aal.journal_id=aaj.id) \
-                    ORDER BY aal.date, aaj.code, aal.code",
-                    (general_account_id, account_id, date1, date2))
-        else:
-            journal_ids = journals
-            self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
-                        aal.unit_amount AS quantity, aal.date AS date, \
-                        aaj.code AS cj \
-                    FROM account_analytic_line AS aal, \
-                        account_analytic_journal AS aaj \
-                    WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \
-                        AND (aal.date>=%s) AND (aal.date<=%s) \
-                        AND (aal.journal_id=aaj.id) AND (aaj.id IN %s) \
-                        ORDER BY aal.date, aaj.code, aal.code",
-                    (general_account_id, account_id, date1, date2,tuple(journal_ids)))
-        res = self.cr.dictfetchall()
-        return res
-
-    def _account_sum_quantity(self, account_id, date1, date2, journals):
-        if not journals:
-            self.cr.execute("SELECT sum(unit_amount) \
-                    FROM account_analytic_line \
-                    WHERE account_id=%s AND date>=%s AND date<=%s",
-                    (account_id, date1, date2))
-        else:
-            journal_ids = journals
-            self.cr.execute("SELECT sum(unit_amount) \
-                    FROM account_analytic_line \
-                    WHERE account_id = %s AND date >= %s AND date <= %s \
-                        AND journal_id IN %s",
-                        (account_id, date1, date2, tuple(journal_ids),))
-        return self.cr.fetchone()[0] or 0.0
-
-    def _sum_quantity(self, accounts, date1, date2, journals):
-        ids = map(lambda x: x.id, accounts)
-        if not ids:
-            return 0.0
-        if not journals:
-            self.cr.execute("SELECT sum(unit_amount) \
-                    FROM account_analytic_line \
-                    WHERE account_id IN %s AND date>=%s AND date<=%s",
-                    (tuple(ids), date1, date2,))
-        else:
-            journal_ids = journals
-            self.cr.execute("SELECT sum(unit_amount) \
-                    FROM account_analytic_line \
-                    WHERE account_id IN %s AND date >= %s AND date <= %s \
-                        AND journal_id IN %s",(tuple(ids), date1, date2, tuple(journal_ids)))
-        return self.cr.fetchone()[0] or 0.0
-
-
-class report_analyticcostledgerquantity(osv.AbstractModel):
-    _name = 'report.account.report_analyticcostledgerquantity'
-    _inherit = 'report.abstract_report'
-    _template = 'account.report_analyticcostledgerquantity'
-    _wrapped_report_class = account_analytic_quantity_cost_ledger
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/views/report_analyticbalance.xml b/addons/account/project/views/report_analyticbalance.xml
deleted file mode 100644 (file)
index 09cd56f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-<template id="report_analyticbalance">
-    <t t-call="report.html_container">
-        <t t-call="report.internal_layout">
-            <div class="page">
-                <h2>Analytic Balance - <span t-esc="res_company.currency_id.name"/></h2>
-
-                <table class="table table-condensed">
-                    <thead>
-                        <tr>
-                            <th>Code</th>
-                            <th>Account Name</th>
-                            <th>Debit</th>
-                            <th>Credit</th>
-                            <th>Balance</th>
-                            <th>Quantity</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td colspan="2">Total</td>
-                            <td>
-                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'debit'))"/>
-                            </td>
-                            <td>
-                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'credit'))"/>
-                            </td>
-                            <td>
-                                <span t-esc="formatLang(sum_balance(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2']),currency_obj=res_company.currency_id)"/>
-                            </td>
-                            <td>
-                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'quantity'))"/>
-                            </td>
-                        </tr>
-                        <t t-foreach="get_objects(data['form']['empty_acc'])" t-as="o">
-                            <tr>
-                                <td><span t-esc="o['code']"/></td>
-                                <td><span t-esc="o['complete_name']"/></td>
-                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'debit'))"/></td>
-                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'credit'))"/></td>
-                                <td><span t-esc="formatLang(move_sum_balance(o['id'], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
-                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'quantity'))"/></td>
-                            </tr>
-                            <tr t-foreach="lines_g(o['id'], data['form']['date1'], data['form']['date2'])" t-as="move_g">
-                                <td><span t-esc="move_g['code']"/></td>
-                                <td><span t-esc="move_g['name']"/></td>
-                                <td><span t-esc="formatLang(move_g['debit'])"/></td>
-                                <td><span t-esc="formatLang(move_g['credit'])"/></td>
-                                <td><span t-esc="formatLang(move_g['balance'], currency_obj=res_company.currency_id)"/></td>
-                                <td><span t-esc="formatLang(move_g['quantity'])"/></td>
-                            </tr>    
-                        </t>
-                    </tbody>
-                </table> 
-            </div>
-        </t>
-    </t>
-</template>
-</data>
-</openerp>
diff --git a/addons/account/project/views/report_analyticcostledger.xml b/addons/account/project/views/report_analyticcostledger.xml
deleted file mode 100644 (file)
index cda37d4..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-<template id="report_analyticcostledger">
-    <t t-call="report.html_container">
-        <t t-call="report.internal_layout">
-            <div class="page">
-                <h2>Cost Ledger</h2>
-            
-                <div class="row mt32 mb32">
-                    <div class="col-xs-3">
-                        <strong>Period From:</strong>
-                        <p t-esc="formatLang(data['form']['date1'], date=True)"/>
-                    </div>
-                    <div class="col-xs-3">
-                        <strong>Period To:</strong>
-                        <p t-esc="formatLang(data['form']['date2'], date=True)"/>
-                    </div>
-                    <div class="col-xs-3">
-                        <strong>Printing Date:</strong>
-                        <p t-esc="formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time=True)" />
-                    </div>
-                </div>
-
-                <table class="table table-condensed">
-                    <thead>
-                        <tr>
-                            <th>Date/Code</th>
-                            <th>J.C. /Move</th>
-                            <th>Name</th>
-                            <th>Debit</th>
-                            <th>Credit</th>
-                            <th>Balance</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr style="font-weight: bold;">
-                            <td>Total:</td>
-                            <td></td>
-                            <td></td>
-                            <td><span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
-                            <td><span t-esc="formatLang(sum_credit(docs,data['form']['date1'],data['form']['date2']))"/></td>
-                            <td>
-                                <span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']) - sum_credit(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
-                            </td>
-                        </tr>
-                
-                        <t t-foreach="docs" t-as="account">
-                            <tr style="font-weight: bold;">
-                                <td><span t-esc="account.code"/></td>
-                                <td></td>
-                                <td><span t-esc="account.complete_name"/></td>
-                                <td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']))"/></td>
-                                <td><span t-esc="formatLang(sum_credit([account], data['form']['date1'], data['form']['date2']))"/></td>
-                                <td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']) - sum_credit([account], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
-                            </tr>
-
-                            <t t-foreach="lines_g(account, data['form']['date1'], data['form']['date2'])" t-as="move_g">
-                                <tr>
-                                    <td><span t-esc="move_g['code']"/></td>
-                                    <td></td>
-                                    <td><span t-esc="move_g['name']"/></td>
-                                    <td><span t-esc="move_g['debit']"/></td>
-                                    <td><span t-esc="move_g['credit']"/></td>
-                                    <td>
-                                        <span t-esc="formatLang(move_g['balance'], currency_obj=res_company.currency_id)"/>
-                                    </td>
-                                </tr>
-                                <tr t-foreach="lines_a(move_g, account, data['form']['date1'], data['form']['date2'])" t-as="move_a">
-                                    <td>
-                                        <t t-esc="formatLang(move_a['date'], date=True)"></t> 
-                                    </td>
-                                    <td><span t-esc="move_a['cj']"/></td>
-                                    <td><span t-esc="move_a['name']"/></td>
-                                    <td><span t-esc="move_a['debit']"/></td>
-                                    <td><span t-esc="move_a['credit']"/></td>
-                                    <td>
-                                        <span t-esc="formatLang(move_a['balance'], currency_obj=res_company.currency_id)"/>
-                                    </td> 
-                                </tr>
-                            </t>
-                        </t>
-                    </tbody>
-                </table>
-            </div>
-        </t>
-    </t>
-</template>
-</data>
-</openerp>
\ No newline at end of file
diff --git a/addons/account/project/views/report_analyticcostledgerquantity.xml b/addons/account/project/views/report_analyticcostledgerquantity.xml
deleted file mode 100644 (file)
index de49d49..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-<template id="report_analyticcostledgerquantity">
-    <t t-call="report.html_container">
-        <t t-call="report.internal_layout">
-            <div class="page">
-                <h2>Cost Ledger</h2>
-
-                <div class="row mt32 mb32">
-                    <div class="col-xs-3">
-                        <strong>Period From:</strong>
-                        <p t-esc="formatLang(data['form']['date1'], date=True)"/>
-                    </div>
-                    <div class="col-xs-3">
-                        <strong>Period To:</strong>
-                        <p t-esc="formatLang(data['form']['date2'], date=True)"/>
-                    </div>
-                    <div class="col-xs-3">
-                        <strong>Printing Date:</strong>
-                        <p t-esc="formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time=True)" />
-                    </div>
-                </div>
-
-                <table class="table table-condensed">
-                    <thead>
-                        <tr>
-                            <th>Date/Code</th>
-                            <th>J.C./Move</th>
-                            <th>Name</th>
-                            <th>Quantity</th>
-                            <th>Total</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr style="font-weight:bold;">
-                            <td>Total:</td>
-                            <td></td>
-                            <td></td>
-                            <td></td>
-                            <td>
-                                <span t-esc="sum_quantity(docs, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
-                            </td>
-                        </tr>
-                
-                        <t t-foreach="docs" t-as="account">
-                            <tr style="font-weight:bold;">
-                                <td><span t-esc="account.code"/></td>
-                                <td><span t-esc="account.complete_name"/></td>
-                                <td></td>
-                                <td>
-                                    <p t-if="account.quantity_max">
-                                        Max quantity : <span t-esc="formatLang(account.quantity_max)"/>
-                                    </p>
-                                </td>
-                                <td>
-                                    <span t-esc="account_sum_quantity(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
-                                </td>
-                            </tr>
-
-                            <t t-foreach="lines_g(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_g">
-                                <tr style="font-weight:bold;">
-                                    <td><span t-esc="move_g['code']"/></td>
-                                    <td colspan="2"><span t-esc="move_g['name']"/></td>
-                                    <td></td>
-                                    <td class="text-right"><span t-esc="move_g['quantity']"/></td>
-                                </tr>
-                        
-                                <t t-foreach="lines_a(move_g['id'], account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_a">
-                                    <tr style="font-weight:normal;">
-                                        <td><span t-esc="formatLang(move_a['date'], date=True)"/></td>
-                                        <td><span t-esc="move_a['cj']"/></td>
-                                        <td><span t-esc="move_a['name']"/></td>
-                                        <td></td>
-                                        <td class="text-right"><span t-esc="move_a['quantity']"/></td> 
-                                    </tr>
-                                </t> 
-                            </t> 
-                        </t>
-                    </tbody>
-                </table>
-            </div>
-        </t>
-    </t>
-</template>
-</data>
-</openerp>
\ No newline at end of file
diff --git a/addons/account/project/views/report_analyticjournal.xml b/addons/account/project/views/report_analyticjournal.xml
deleted file mode 100644 (file)
index 1b3a4fd..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-<template id="report_analyticjournal">
-    <t t-call="report.html_container">
-        <t t-foreach="docs" t-as="o">
-            <t t-call="report.internal_layout">
-                <div class="page">
-                    <h2>Analytic Journal</h2>
-
-                    <div class="row mt32 mb32">
-                        <div class="col-xs-3">
-                            <strong>Period From:</strong>
-                            <p t-esc="formatLang(data['form']['date1'], date=True)"/>
-                        </div>
-                        <div class="col-xs-3">
-                            <strong>Period To:</strong>
-                            <p t-esc="formatLang(data['form']['date2'], date=True)"/>
-                        </div>
-                        <div class="col-xs-3">
-                            <strong>Currency:</strong>
-                            <p t-field="res_company.currency_id" />
-                        </div>
-                    </div>
-
-                    <table class="table table-condensed">
-                        <thead>
-                            <tr>
-                                <th>Date</th>
-                                <th>Code</th>
-                                <th>Move Name</th>
-                                <th>Account n°</th>
-                                <th>General</th>
-                                <th>Analytic</th>
-                            </tr>
-                            <tr>
-                                <th colspan="4"><t t-if="o.code"><span t-esc="o.code"/></t> - <span t-esc="o.name"/></th>
-                                <th><span t-esc="formatLang(sum_general(o.id, data['form']['date1'], data['form']['date2']))"/></th>
-                                <th><span t-esc="formatLang(sum_analytic(o.id, data['form']['date1'], data['form']['date2']))"/></th>
-                            </tr>
-                        </thead>
-                        <tbody>
-                            <t t-foreach="lines(o.id, data['form']['date1'], data['form']['date2'])" t-as="move">
-                                <tr>
-                                    <td></td>
-                                    <td></td>
-                                    <td>
-                                        <span t-esc="move.name"/>
-                                    </td>
-                                    <td>
-                                        <span t-esc="move.account_id.code"/>
-                                        <span t-esc="move.account_id.name"/>
-                                    </td>
-                                    <td>
-                                        <span t-esc="formatLang(move.debit-move.credit)"/>
-                                    </td>
-                                    <td></td>
-                                </tr>
-                                <tr t-foreach="lines_a(move.id, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
-                                    <td>
-                                        <span t-esc="formatLang(move_a.date,date = True)"/>
-                                    </td>
-                                    <td>
-                                        <p t-if="move_a.code"><span t-esc="move_a.code"/></p>
-                                    </td>
-                                    <td>
-                                        <span t-esc="move_a.name"/>
-                                    </td>
-                                    <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
-                                    <td></td>
-                                    <td><span t-esc="formatLang(move_a.amount)"/></td>
-                                </tr>
-                            </t>
-                            <tr t-foreach="lines_a(False, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
-                                <td><span t-esc="formatLang(move_a.date,date = True)"/></td>
-                                <td><p t-if="move_a.code"><span t-esc="move_a.code"/></p></td>
-                                <td><span t-esc="move_a.name"/></td>
-                                <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
-                                <td></td>
-                                <td><span t-esc="formatLang(move_a.amount)"/></td>
-                            </tr>
-                        </tbody>
-                    </table>
-                </div>
-            </t>
-        </t>
-    </t>
-</template>
-</data>
-</openerp>
diff --git a/addons/account/project/views/report_invertedanalyticbalance.xml b/addons/account/project/views/report_invertedanalyticbalance.xml
deleted file mode 100644 (file)
index e545ec8..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-<data>
-<template id="report_invertedanalyticbalance">
-    <t t-call="report.html_container">
-        <t t-call="report.internal_layout">
-            <div class="page">
-                <h2>Inverted Analytic Balance - <span t-esc="res_company.currency_id.name"/></h2>
-
-                <table class="table table-condensed">
-                    <thead>
-                        <tr>
-                            <th>Code</th>
-                            <th>Account Name</th>
-                            <th>Debit</th>
-                            <th>Credit</th>
-                            <th>Balance</th>
-                            <th>Quantity</th>
-                        </tr>
-                    </thead>
-                    <tbody>
-                        <tr>
-                            <td><strong>Total</strong></td>
-                            <td></td>
-                            <td><strong t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
-                            <td><strong t-esc="formatLang(sum_credit(docs, data['form']['date1'], data['form']['date2']))"/></td>
-                            <td>
-                                <strong t-esc="formatLang(sum_balance(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
-                            </td>
-                            <td><strong><span t-esc="formatLang(sum_quantity(docs, data['form']['date1'], data['form']['date2']))"/></strong></td>
-                        </tr>
-                        <t t-foreach="lines_g(docs, data['form']['date1'], data['form']['date2'])" t-as="move_g">
-                            <tr>
-                                <td>
-                                    <strong t-esc="move_g['code']"/>
-                                </td>
-                                <td>
-                                    <strong t-esc="move_g['name']"/>
-                                </td>
-                                <td class="text-right">
-                                    <strong>
-                                        <span t-esc="formatLang(move_g['debit'])"/>
-                                    </strong>
-                                </td>
-                                <td class="text-right">
-                                    <strong>
-                                        <span t-esc="formatLang(move_g['credit'])"/>
-                                    </strong>
-                                </td>
-                                <td class="text-right">
-                                    <strong>
-                                        <span t-esc="formatLang(move_g['balance'], currency_obj = res_company.currency_id)"/>
-                                    </strong>
-                                </td>
-                                <td class="text-right">
-                                    <strong>
-                                        <span t-esc="formatLang(move_g['quantity'])"/>
-                                    </strong>
-                                </td>
-                            </tr>
-                            <t t-foreach="lines_a(docs, move_g['id'], data['form']['date1'], data['form']['date2'])" t-as="move_a">
-                                <tr>
-                                    <td>
-                                        <span t-esc="move_a['code']"/>
-                                    </td>
-                                    <td>
-                                        <span t-esc="move_a['complete_name']"/>
-                                    </td>
-                                    <td class="text-right">
-                                        <span t-esc="formatLang(move_a['debit'])"/>
-                                    </td>
-                                    <td class="text-right">
-                                        <span t-esc="formatLang(move_a['credit'])"/>
-                                    </td>
-                                    <td class="text-right">
-                                        <span t-esc="formatLang(move_a['balance'], currency_obj = res_company.currency_id)"/>
-                                    </td>
-                                    <td class="text-right">
-                                        <span t-esc="formatLang(move_a['quantity'])"/>
-                                    </td>
-                                </tr>
-                            </t>
-                        </t>
-                    </tbody>
-                </table> 
-            </div>
-        </t>
-    </t>
-</template>
-</data>
-</openerp>
diff --git a/addons/account/project/wizard/__init__.py b/addons/account/project/wizard/__init__.py
deleted file mode 100644 (file)
index 972373f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import account_analytic_journal_report
-import account_analytic_balance_report
-import account_analytic_inverted_balance_report
-import account_analytic_cost_ledger_report
-import account_analytic_cost_ledger_for_journal_report
-import project_account_analytic_line
-import account_analytic_chart
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_balance_report.py b/addons/account/project/wizard/account_analytic_balance_report.py
deleted file mode 100644 (file)
index 062945f..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import fields, osv
-
-
-class account_analytic_balance(osv.osv_memory):
-    _name = 'account.analytic.balance'
-    _description = 'Account Analytic Balance'
-
-    _columns = {
-        'date1': fields.date('Start of period', required=True),
-        'date2': fields.date('End of period', required=True),
-        'empty_acc': fields.boolean('Empty Accounts ? ', help='Check if you want to display Accounts with 0 balance too.'),
-    }
-
-    _defaults = {
-        'date1': lambda *a: time.strftime('%Y-01-01'),
-        'date2': lambda *a: time.strftime('%Y-%m-%d')
-    }
-
-    def check_report(self, cr, uid, ids, context=None):
-        if context is None:
-            context = {}
-        data = self.read(cr, uid, ids)[0]
-        datas = {
-            'ids': context.get('active_ids', []),
-            'model': 'account.analytic.account',
-            'form': data
-        }
-
-        datas['form']['active_ids'] = context.get('active_ids', False)
-
-        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticbalance', data=datas, context=context)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_balance_report_view.xml b/addons/account/project/wizard/account_analytic_balance_report_view.xml
deleted file mode 100644 (file)
index d4d5d65..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_balance_view" model="ir.ui.view">
-            <field name="name">Account Analytic Balance</field>
-            <field name="model">account.analytic.balance</field>
-            <field name="arch" type="xml">
-            <form string="Select Period">
-                <header>
-                    <button name="check_report" string="Print" type="object" class="oe_highlight"/>
-                    or
-                    <button string="Cancel" class="oe_link" special="cancel"/>
-                </header>
-                <group col="4">
-                    <field name="date1"/>
-                    <field name="date2"/>
-                    <newline/>
-                    <field name="empty_acc"/>
-                </group>
-            </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_balance" model="ir.actions.act_window">
-            <field name="name">Analytic Balance</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.balance</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_balance_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <record model="ir.values" id="account_analytic_balance_values">
-            <field name="model_id" ref="analytic.model_account_analytic_account" />
-            <field name="name">Account Analytic Balance</field>
-            <field name="key2">client_print_multi</field>
-            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_balance'))" />
-            <field name="key">action</field>
-            <field name="model">account.analytic.account</field>
-        </record>
-
-    </data>
-</openerp>
-
diff --git a/addons/account/project/wizard/account_analytic_chart.py b/addons/account/project/wizard/account_analytic_chart.py
deleted file mode 100644 (file)
index 4a26eec..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-from openerp.osv import fields, osv
-
-class account_analytic_chart(osv.osv_memory):
-    _name = 'account.analytic.chart'
-    _description = 'Account Analytic Chart'
-
-    _columns = {
-        'from_date': fields.date('From'),
-        'to_date': fields.date('To'),
-    }
-
-    def analytic_account_chart_open_window(self, cr, uid, ids, context=None):
-        mod_obj = self.pool.get('ir.model.data')
-        act_obj = self.pool.get('ir.actions.act_window')
-        result_context = {}
-        if context is None:
-            context = {}
-        result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_analytic_account_tree2')
-        id = result and result[1] or False
-        result = act_obj.read(cr, uid, [id], context=context)[0]
-        data = self.read(cr, uid, ids, [])[0]
-        if data['from_date']:
-            result_context.update({'from_date': data['from_date']})
-        if data['to_date']:
-            result_context.update({'to_date': data['to_date']})
-        result['context'] = str(result_context)
-        return result
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_chart_view.xml b/addons/account/project/wizard/account_analytic_chart_view.xml
deleted file mode 100644 (file)
index 2fb44f5..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_chart_view" model="ir.ui.view">
-            <field name="name">Chart of Analytic Accounts</field>
-            <field name="model">account.analytic.chart</field>
-            <field name="arch" type="xml">
-                <form string="Analytic Account Charts">
-                    <group string="Select the Period for Analysis" col="4">
-                        <field name="from_date"/>
-                        <field name="to_date"/>
-                        <label string="(Keep empty to open the current situation)" colspan="4"/>
-                    </group>
-                    <footer>
-                        <button name="analytic_account_chart_open_window" string="Open Charts" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel"/>
-                    </footer>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_chart" model="ir.actions.act_window">
-            <field name="name">Chart of Analytic Accounts</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.chart</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_chart_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <menuitem
-            name="Chart of Analytic Accounts"
-            parent="account.menu_finance_charts"
-            action="action_account_analytic_chart"
-            id="menu_action_analytic_account_tree2"
-            icon="STOCK_INDENT"
-            groups="analytic.group_analytic_accounting"/>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py
deleted file mode 100644 (file)
index ab84af4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import fields, osv
-
-
-class account_analytic_cost_ledger_journal_report(osv.osv_memory):
-    _name = 'account.analytic.cost.ledger.journal.report'
-    _description = 'Account Analytic Cost Ledger For Journal Report'
-
-    _columns = {
-        'date1': fields.date('Start of period', required=True),
-        'date2': fields.date('End of period', required=True),
-        'journal': fields.many2many('account.analytic.journal', 'ledger_journal_rel', 'ledger_id', 'journal_id', 'Journals'),
-    }
-
-    _defaults = {
-        'date1': lambda *a: time.strftime('%Y-01-01'),
-        'date2': lambda *a: time.strftime('%Y-%m-%d')
-    }
-
-    def check_report(self, cr, uid, ids, context=None):
-        if context is None:
-            context = {}
-        data = self.read(cr, uid, ids)[0]
-        datas = {
-            'ids': context.get('active_ids', []),
-            'model': 'account.analytic.account',
-            'form': data
-        }
-
-        datas['form']['active_ids'] = context.get('active_ids', False)
-        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticcostledgerquantity', data=datas, context=context)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report_view.xml
deleted file mode 100644 (file)
index 55b13e3..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_cost_ledger_journal_view" model="ir.ui.view">
-            <field name="name">Account Analytic Cost Ledger Journal</field>
-            <field name="model">account.analytic.cost.ledger.journal.report</field>
-            <field name="arch" type="xml">
-                <form string="Select period">
-                    <header>
-                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel"/>
-                    </header>
-                    <group string="Cost Ledger for Period" col="4">
-                        <field name="date1"/>
-                        <field name="date2"/>
-                        <field name="journal" colspan="4"/>
-                    </group>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_cost_ledger_journal" model="ir.actions.act_window">
-            <field name="name">Cost Ledger (Only quantities)</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.cost.ledger.journal.report</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_cost_ledger_journal_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <record model="ir.values" id="account_analytic_cost_ledger_journal_values">
-            <field name="model_id" ref="analytic.model_account_analytic_account" />
-            <field name="name">Account Analytic Cost Ledger Journal</field>
-            <field name="key2">client_print_multi</field>
-            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost_ledger_journal'))" />
-            <field name="key">action</field>
-            <field name="model">account.analytic.account</field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_report.py
deleted file mode 100644 (file)
index 978863f..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import osv, fields
-
-
-class account_analytic_cost_ledger(osv.osv_memory):
-    _name = 'account.analytic.cost.ledger'
-    _description = 'Account Analytic Cost Ledger'
-
-    _columns = {
-        'date1': fields.date('Start of period', required=True),
-        'date2': fields.date('End of period', required=True),
-    }
-
-    _defaults = {
-        'date1': lambda *a: time.strftime('%Y-01-01'),
-        'date2': lambda *a: time.strftime('%Y-%m-%d')
-    }
-
-    def check_report(self, cr, uid, ids, context=None):
-        if context is None:
-            context = {}
-        data = self.read(cr, uid, ids)[0]
-        datas = {
-            'ids': context.get('active_ids',[]),
-            'model': 'account.analytic.account',
-            'form': data
-        }
-
-        datas['form']['active_ids'] = context.get('active_ids', False)
-
-        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticcostledger', data=datas, context=context)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_view.xml b/addons/account/project/wizard/account_analytic_cost_ledger_view.xml
deleted file mode 100644 (file)
index 25ab748..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_cost_view" model="ir.ui.view">
-            <field name="name">Account Analytic Check</field>
-            <field name="model">account.analytic.cost.ledger</field>
-            <field name="arch" type="xml">
-            <form string="Select Period">
-                <header>
-                     <button name="check_report" string="Print" type="object" class="oe_highlight"/>
-                     or
-                     <button string="Cancel" class="oe_link" special="cancel"/>
-                </header>
-                <group col="4">
-                    <field name="date1"/>
-                    <field name="date2"/>
-                </group>
-            </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_cost" model="ir.actions.act_window">
-            <field name="name">Cost Ledger</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.cost.ledger</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_cost_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <record model="ir.values" id="account_analytic_cost_values">
-            <field name="model_id" ref="analytic.model_account_analytic_account" />
-            <field name="name">Account Analytic Cost</field>
-            <field name="key2">client_print_multi</field>
-            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost'))" />
-            <field name="key">action</field>
-            <field name="model">account.analytic.account</field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.py b/addons/account/project/wizard/account_analytic_inverted_balance_report.py
deleted file mode 100644 (file)
index 9394696..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import fields, osv
-
-
-class account_analytic_inverted_balance(osv.osv_memory):
-    _name = 'account.analytic.inverted.balance'
-    _description = 'Account Analytic Inverted Balance'
-
-    _columns = {
-        'date1': fields.date('Start of period', required=True),
-        'date2': fields.date('End of period', required=True),
-    }
-
-    _defaults = {
-        'date1': lambda *a: time.strftime('%Y-01-01'),
-        'date2': lambda *a: time.strftime('%Y-%m-%d')
-    }
-
-    def check_report(self, cr, uid, ids, context=None):
-        if context is None:
-            context = {}
-        data = self.read(cr, uid, ids)[0]
-        datas = {
-            'ids': context.get('active_ids', []),
-            'model': 'account.analytic.account',
-            'form': data
-        }
-        datas['form']['active_ids'] = context.get('active_ids', False)
-        return self.pool['report'].get_action(cr, uid, [], 'account.report_invertedanalyticbalance', data=datas, context=context)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_inverted_balance_report.xml b/addons/account/project/wizard/account_analytic_inverted_balance_report.xml
deleted file mode 100644 (file)
index 5188c01..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_invert_balance_view" model="ir.ui.view">
-            <field name="name">Account Analytic Inverted Balance</field>
-            <field name="model">account.analytic.inverted.balance</field>
-            <field name="arch" type="xml">
-                <form string="Select Period">
-                    <header>
-                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel"/>
-                    </header>
-                    <group col="4">
-                        <field name="date1"/>
-                        <field name="date2"/>
-                    </group>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_invert_balance" model="ir.actions.act_window">
-            <field name="name">Inverted Analytic Balance</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.inverted.balance</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_invert_balance_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <record model="ir.values" id="account_analytic_invert_balance_values">
-            <field name="model_id" ref="analytic.model_account_analytic_account" />
-            <field name="name">Account Analytic Inverted Balance</field>
-            <field name="key2">client_print_multi</field>
-            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_invert_balance'))" />
-            <field name="key">action</field>
-            <field name="model">account.analytic.account</field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/wizard/account_analytic_journal_report.py b/addons/account/project/wizard/account_analytic_journal_report.py
deleted file mode 100644 (file)
index d8790e8..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from openerp.osv import fields, osv
-
-
-class account_analytic_journal_report(osv.osv_memory):
-    _name = 'account.analytic.journal.report'
-    _description = 'Account Analytic Journal'
-
-    _columns = {
-        'date1': fields.date('Start of period', required=True),
-        'date2': fields.date('End of period', required=True),
-        'analytic_account_journal_id': fields.many2many('account.analytic.journal', 'account_analytic_journal_name', 'journal_line_id', 'journal_print_id', 'Analytic Journals', required=True),
-    }
-
-    _defaults = {
-        'date1': lambda *a: time.strftime('%Y-01-01'),
-        'date2': lambda *a: time.strftime('%Y-%m-%d')
-    }
-
-    def check_report(self, cr, uid, ids, context=None):
-        if context is None:
-            context = {}
-        data = self.read(cr, uid, ids)[0]
-        ids_list = []
-        if context.get('active_id',False):
-            ids_list.append(context.get('active_id',False))
-        else:
-            record = self.browse(cr,uid,ids[0],context=context)
-            for analytic_record in record.analytic_account_journal_id:
-                ids_list.append(analytic_record.id)
-        datas = {
-            'ids': ids_list,
-            'model': 'account.analytic.journal',
-            'form': data
-        }
-        context2 = context.copy()
-        context2['active_model'] = 'account.analytic.journal'
-        context2['active_ids'] = ids_list
-        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticjournal', data=datas, context=context2)
-
-    def default_get(self, cr, uid, fields, context=None):
-        if context is None:
-            context = {}
-        res = super(account_analytic_journal_report, self).default_get(cr, uid, fields, context=context)
-        if not context.has_key('active_ids'):
-            journal_ids = self.pool.get('account.analytic.journal').search(cr, uid, [], context=context)
-        else:
-            journal_ids = context.get('active_ids')
-        if 'analytic_account_journal_id' in fields:
-            res.update({'analytic_account_journal_id': journal_ids})
-        return res
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/account_analytic_journal_report_view.xml b/addons/account/project/wizard/account_analytic_journal_report_view.xml
deleted file mode 100644 (file)
index b196081..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="account_analytic_journal_view" model="ir.ui.view">
-            <field name="name">Account Analytic Journal</field>
-            <field name="model">account.analytic.journal.report</field>
-            <field name="arch" type="xml">
-                <form string="Select Period">
-                    <group col="4">
-                        <field name="date1"/>
-                        <field name="date2"/>
-                        <field name="analytic_account_journal_id" widget="many2many_tags" class="oe_inline" required="1" colspan="4"/>
-                    </group>
-                    <footer>
-                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel"/>
-                    </footer>
-                </form>
-            </field>
-        </record>
-
-        <record id="action_account_analytic_journal" model="ir.actions.act_window">
-            <field name="name">Analytic Journal</field>
-            <field name="type">ir.actions.act_window</field>
-            <field name="res_model">account.analytic.journal.report</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">form</field>
-            <field name="view_id" ref="account_analytic_journal_view"/>
-            <field name="target">new</field>
-        </record>
-
-        <record model="ir.values" id="account_analytic_journal_values">
-            <field name="model_id" ref="account.model_account_analytic_journal" />
-            <field name="name">Account Analytic Journal</field>
-            <field name="key2">client_print_multi</field>
-            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_journal'))" />
-            <field name="key">action</field>
-            <field name="model">account.analytic.journal</field>
-        </record>
-        
-        <menuitem groups="analytic.group_analytic_accounting" id="next_id_40"
-            name="Analytic" parent="account.menu_finance_generic_reporting"
-            sequence="4"/>
-        <menuitem groups="analytic.group_analytic_accounting"
-            action="account.action_account_analytic_journal"
-            id="account_analytic_journal_print" parent="account.next_id_40"/>
-
-    </data>
-</openerp>
diff --git a/addons/account/project/wizard/project_account_analytic_line.py b/addons/account/project/wizard/project_account_analytic_line.py
deleted file mode 100644 (file)
index 40777f7..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-from openerp.osv import fields, osv
-from openerp.tools.translate import _
-
-class project_account_analytic_line(osv.osv_memory):
-    _name = "project.account.analytic.line"
-    _description = "Analytic Entries by line"
-    _columns = {
-        'from_date': fields.date('From'),
-         'to_date': fields.date('To'),
-    }
-
-    def action_open_window(self, cr, uid, ids, context=None):
-        mod_obj =self.pool.get('ir.model.data')
-        domain = []
-        data = self.read(cr, uid, ids, [])[0]
-        from_date = data['from_date']
-        to_date = data['to_date']
-        if from_date and to_date:
-            domain = [('date','>=',from_date), ('date','<=',to_date)]
-        elif from_date:
-            domain = [('date','>=',from_date)]
-        elif to_date:
-            domain = [('date','<=',to_date)]
-        result = mod_obj.get_object_reference(cr, uid, 'account', 'view_account_analytic_line_filter')
-        id = result and result[1] or False
-        return {
-              'name': _('Analytic Entries by line'),
-              'view_type': 'form',
-              "view_mode": 'tree,form',
-              'res_model': 'account.analytic.line',
-              'type': 'ir.actions.act_window',
-              'domain': domain,
-              'search_view_id': id['res_id'],
-              }
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/project/wizard/project_account_analytic_line_view.xml b/addons/account/project/wizard/project_account_analytic_line_view.xml
deleted file mode 100644 (file)
index ac3047e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="view_project_account_analytic_line_form" model="ir.ui.view">
-            <field name="name">project.account.analytic.line.form</field>
-            <field name="model">project.account.analytic.line</field>
-            <field name="arch" type="xml">
-                <form string="View Account Analytic Lines">
-                    <header>
-                        <button string="Open Entries" name="action_open_window" type="object" class="oe_highlight"/>
-                        or
-                        <button string="Cancel" class="oe_link" special="cancel"/>
-                    </header>
-                    <group col="4">
-                        <field name="from_date"/>
-                        <field name="to_date"/>
-                    </group>
-                    <label string ="(Keep empty to open the current situation)" />
-                </form>
-            </field>
-        </record>
-
-        <record id="action_project_account_analytic_line_form" model="ir.actions.act_window">
-            <field name="name">Entries By Line</field>
-            <field name="res_model">project.account.analytic.line</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="view_id" ref="view_project_account_analytic_line_form"/>
-            <field name="target">new</field>
-        </record>
-
-    </data>
-</openerp>
index 1cd0f4c..a5da58e 100644 (file)
@@ -33,8 +33,8 @@ class analytic_entries_report(osv.osv):
         'partner_id': fields.many2one('res.partner', 'Partner'),
         'company_id': fields.many2one('res.company', 'Company', required=True),
         'currency_id': fields.many2one('res.currency', 'Currency', required=True),
-        'account_id': fields.many2one('account.analytic.account', 'Account', required=False),
-        'general_account_id': fields.many2one('account.account', 'General Account', required=True),
+        'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=False),
+        'general_account_id': fields.many2one('account.account', 'Financial Account', required=True),
         'journal_id': fields.many2one('account.analytic.journal', 'Journal', required=True),
         'move_id': fields.many2one('account.move.line', 'Move', required=True),
         'product_id': fields.many2one('product.product', 'Product', required=True),
index 2020b56..ac0551d 100644 (file)
@@ -14,8 +14,8 @@
                 <group expand="0" string="Group By">
                     <filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
                     <filter string="Partner" icon="terp-partner" context="{'group_by':'partner_id'}"/>
-                    <filter string="Account" name="Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/>
-                    <filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
+                    <filter string="Analytic Account" name="Account" icon="terp-folder-green" context="{'group_by':'account_id'}" groups="analytic.group_analytic_accounting"/>
+                    <filter string="Financial Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
                     <filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
                     <filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
                     <filter string="Product Unit of Measure" icon="terp-mrp" context="{'group_by':'product_uom_id'}"/>
index 65d3e95..9cbfd16 100644 (file)
         <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
     </record>
 
-    <record id="analytic_journal_comp_rule" model="ir.rule">
-        <field name="name">Analytic journal multi-company</field>
-        <field name="model_id" ref="model_account_analytic_journal"/>
-        <field name="global" eval="True"/>
-        <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
-    </record>
-
     <record id="period_comp_rule" model="ir.rule">
         <field name="name">Period multi-company</field>
         <field name="model_id" ref="model_account_period"/>
index 16ad4fe..be8342c 100644 (file)
@@ -24,8 +24,8 @@ access_account_bank_statement,account.bank.statement,model_account_bank_statemen
 access_account_bank_statement_line,account.bank.statement.line,model_account_bank_statement_line,account.group_account_user,1,1,1,1
 access_account_analytic_line_manager,account.analytic.line manager,model_account_analytic_line,account.group_account_manager,1,0,0,0
 access_account_analytic_account,account.analytic.account,analytic.model_account_analytic_account,base.group_user,1,0,0,0
-access_account_analytic_journal,account.analytic.journal,model_account_analytic_journal,account.group_account_user,1,0,0,0
-access_account_analytic_journal_user,account.analytic.journal,model_account_analytic_journal,base.group_user,1,1,1,0
+access_account_analytic_journal,account.analytic.journal,analytic.model_account_analytic_journal,account.group_account_user,1,0,0,0
+access_account_analytic_journal_user,account.analytic.journal,analytic.model_account_analytic_journal,base.group_user,1,1,1,0
 access_account_invoice_uinvoice,account.invoice,model_account_invoice,account.group_account_invoice,1,1,1,1
 access_account_invoice_line_uinvoice,account.invoice.line,model_account_invoice_line,account.group_account_invoice,1,1,1,1
 access_account_invoice_tax_uinvoice,account.invoice.tax,model_account_invoice_tax,account.group_account_invoice,1,1,1,1
@@ -41,7 +41,7 @@ access_account_journal_invoice,account.journal invoice,model_account_journal,acc
 access_account_period_manager,account.period,model_account_period,account.group_account_manager,1,1,1,1
 access_account_period_invoice,account.period invoice,model_account_period,account.group_account_invoice,1,0,0,0
 access_account_invoice_group_invoice,account.invoice group invoice,model_account_invoice,account.group_account_invoice,1,1,1,1
-access_account_analytic_journal_manager,account.analytic.journal,model_account_analytic_journal,account.group_account_manager,1,1,1,1
+access_account_analytic_journal_manager,account.analytic.journal,analytic.model_account_analytic_journal,account.group_account_manager,1,1,1,1
 access_account_fiscalyear,account.fiscalyear,model_account_fiscalyear,account.group_account_manager,1,1,1,1
 access_account_fiscalyear_invoice,account.fiscalyear.invoice,model_account_fiscalyear,account.group_account_invoice,1,0,0,0
 access_account_fiscalyear_partner_manager,account.fiscalyear.partnermanager,model_account_fiscalyear,base.group_partner_manager,1,0,0,0
index 75c94a6..e9d232e 100644 (file)
@@ -34,7 +34,7 @@
     name: End of Year
     code: NEW
     type: situation
-    analytic_journal_id: sit
+    analytic_journal_id: analytic.sit
     default_debit_account_id: cash
     default_credit_account_id: cash
     company_id: base.main_company
index 9173c37..d13b387 100644 (file)
 -
   !python {model: account.analytic.account}: |
     ctx={}
-    ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
+    ctx.update({'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root')]})
     data_dict = {}
     from openerp.tools import test_reports
-    test_reports.try_report_action(cr, uid, 'action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
+    test_reports.try_report_action(cr, uid, 'analytic.action_account_analytic_balance',wiz_data=data_dict, context=ctx, our_module='account')
 
 -
  Print the Cost Ledger Report through the wizard
 -
   !python {model: account.analytic.account}: |
     ctx={}
-    ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root'),ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_our_super_product')]})
+    ctx.update({'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root'),ref('analytic.analytic_absences'),ref('analytic.analytic_internal'),ref('analytic.analytic_our_super_product')]})
     data_dict = {}
     from openerp.tools import test_reports
-    test_reports.try_report_action(cr, uid, 'action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
+    test_reports.try_report_action(cr, uid, 'analytic.action_account_analytic_cost',wiz_data=data_dict, context=ctx, our_module='account')
 
 -
  Print the Cost Ledger(Only Quantities) Report through the wizard
 -
   !python {model: account.analytic.account}: |
     ctx={}
-    ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root'),ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_our_super_product')]})
+    ctx.update({'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root'),ref('analytic.analytic_absences'),ref('analytic.analytic_internal'),ref('analytic.analytic_our_super_product')]})
     data_dict = {}
     from openerp.tools import test_reports
-    test_reports.try_report_action(cr, uid, 'action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
+    test_reports.try_report_action(cr, uid, 'analytic.action_account_analytic_cost_ledger_journal',wiz_data=data_dict, context=ctx, our_module='account')
 
 -
  Print the Analytic Journal Report through the wizard
 -
   !python {model: account.analytic.journal}: |
     ctx={}
-    ctx.update({'model': 'account.analytic.journal','active_ids': [ref('account.cose_journal_sale'), ref('account.exp'), ref('account.sit')]})
+    ctx.update({'model': 'account.analytic.journal','active_ids': [ref('analytic.cose_journal_sale'), ref('account.exp'), ref('analytic.sit')]})
     data_dict = {}
     from openerp.tools import test_reports
-    test_reports.try_report_action(cr, uid, 'action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
+    test_reports.try_report_action(cr, uid, 'analytic.action_account_analytic_journal',wiz_data=data_dict, context=ctx, our_module='account')
 
 -
  Print the Inverted Analytic Balance Report through the wizard
 -
   !python {model: account.analytic.account}: |
     ctx={}
-    ctx.update({'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]})
+    ctx.update({'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root')]})
     data_dict = {}
     from openerp.tools import test_reports
-    test_reports.try_report_action(cr, uid, 'action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')
+    test_reports.try_report_action(cr, uid, 'analytic.action_account_analytic_invert_balance',wiz_data=data_dict, context=ctx, our_module='account')
\ No newline at end of file
index ec363a2..7b9a943 100644 (file)
         <record id="view_account_analytic_account_tree_c2c_3" model="ir.ui.view">
             <field name="name">account.analytic.account.list.contract</field>
             <field name="model">account.analytic.account</field>
-            <field name="inherit_id" ref="account.view_account_analytic_account_list"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_account_list"/>
             <field name="arch" type="xml">
                 <field name="date_start" position="before">
                     <field name="last_invoice_date"/>
             <field name="view_mode">tree,form</field>
             <field name="domain">[('invoice_id','=',False)]</field>
             <field name="context">{'search_default_to_invoice': 1}</field>
-            <field name="search_view_id" ref="account.view_account_analytic_line_filter"/>
+            <field name="search_view_id" ref="analytic.view_account_analytic_line_filter"/>
             <field name="help" type="html">
               <p>
                 You will find here timesheets and purchases you did for
             </field>
         </record>
         <menuitem action="template_of_contract_action" id="menu_template_of_contract_action" parent="base.menu_base_config"/>
+        
+        <record id="account_analytic_analysis_form_form" model="ir.ui.view">
+            <field name="name">account.analytic.account.invoice.form.inherit</field>
+            <field name="model">account.analytic.account</field>
+            <field name="inherit_id" ref="analytic.view_account_analytic_account_form"/>
+            <field eval="20" name="priority"/>
+            <field name="arch" type="xml">
+                <xpath expr='//div[@name="buttons"]' position='inside'>
+                    <button class="oe_inline oe_stat_button" string="Time &amp; Materials to Invoice"
+                        name="%(action_hr_tree_invoiced_all)d"
+                        type="action"
+                        context="{'search_default_account_id': [active_id], 'default_account_id': active_id}"/>
+                </xpath>
+            </field>
+        </record>
 
     </data>
 </openerp>
index 4198b3e..9cb00b6 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <openerp>
     <data noupdate="1">
-        <record id="account.analytic_consultancy" model="account.analytic.account">
+        <record id="analytic.analytic_consultancy" model="account.analytic.account">
             <field name="partner_id" ref="base.res_partner_15"/>
             <field name="invoice_on_timesheets">True</field>
             <field name="hours_qtt_est">1200</field>
         </record>
 
         <record id="sale.sale_order_4" model="sale.order">
-            <field name="project_id" ref="account.analytic_consultancy"/>
+            <field name="project_id" ref="analytic.analytic_consultancy"/>
         </record>
         
         <record id="hr_timesheet.working_hours_maintenance" model="hr.analytic.timesheet">
-            <field name="account_id" ref="account.analytic_consultancy"/>
+            <field name="account_id" ref="analytic.analytic_consultancy"/>
             <field name="to_invoice" ref="hr_timesheet_invoice.timesheet_invoice_factor1"/>
             <field name="unit_amount">100</field>
         </record>
 
-        <record id="account.analytic_super_product_trainings" model="account.analytic.account">
+        <record id="analytic.analytic_super_product_trainings" model="account.analytic.account">
             <field name="partner_id" ref="base.res_partner_18"/>
             <field name="invoice_on_timesheets">True</field>
             <field name="hours_qtt_est">500</field>
         </record>
         
         <record id="sale.sale_order_6" model="sale.order">
-            <field name="project_id" ref="account.analytic_super_product_trainings"/>
+            <field name="project_id" ref="analytic.analytic_super_product_trainings"/>
             <field name="partner_id" ref="base.res_partner_1"/>
         </record>
 
-        <record id="account.analytic_support_internal" model="account.analytic.account">
+        <record id="analytic.analytic_support_internal" model="account.analytic.account">
                <field name="partner_id" ref="base.res_partner_1"/>
             <field name="use_timesheets">True</field>
             <field name="invoice_on_timesheets">True</field>
index cae5858..35a6824 100644 (file)
@@ -5,7 +5,7 @@
     import os, time
     import openerp.report
     from openerp import tools
-    data_dict = {'model': 'account.analytic.account', 'form': {'date1':time.strftime("%Y-01-01"),'date2':time.strftime('%Y-%m-%d'),'journal_ids':[6,0,(ref('account.cose_journal_sale'))],'ref':ref('account.analytic_root'),'empty_line':True,'id':ref('account.analytic_root'),'context':{}}}
-    data, format = openerp.report.render_report(cr, uid, [ref('account.analytic_root')], 'account_analytic_plans.report_crossoveredanalyticplans', data_dict, {})
+    data_dict = {'model': 'account.analytic.account', 'form': {'date1':time.strftime("%Y-01-01"),'date2':time.strftime('%Y-%m-%d'),'journal_ids':[6,0,(ref('analytic.cose_journal_sale'))],'ref':ref('analytic.analytic_root'),'empty_line':True,'id':ref('analytic.analytic_root'),'context':{}}}
+    data, format = openerp.report.render_report(cr, uid, [ref('analytic.analytic_root')], 'account_analytic_plans.report_crossoveredanalyticplans', data_dict, {})
     if tools.config['test_report_directory']:
        file(os.path.join(tools.config['test_report_directory'], 'account_analytic_plans-crossovered_analyitic.'+format), 'wb+').write(data)
index d93e78e..f5de2cf 100644 (file)
@@ -42,7 +42,7 @@
     <!-- Budget lines -->
     <data noupdate="1">
         <record id="crossovered_budget_lines_0" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_consultancy"/>
+            <field name="analytic_account_id" ref="analytic.analytic_consultancy"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-01-01'" name="date_from"/>
             <field eval="-500.0" name="planned_amount"/>
@@ -50,7 +50,7 @@
             <field eval="str(time.localtime(time.time())[0]+1)+'-01-31'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_1" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_consultancy"/>
+            <field name="analytic_account_id" ref="analytic.analytic_consultancy"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-02-01'" name="date_from"/>
             <field eval="-250.0" name="planned_amount"/>
@@ -58,7 +58,7 @@
             <field eval="str(time.localtime(time.time())[0]+1)+'-02-28'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_2" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_consultancy"/>
+            <field name="analytic_account_id" ref="analytic.analytic_consultancy"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-01-01'" name="date_from"/>
             <field eval="500.0" name="planned_amount"/>
@@ -66,7 +66,7 @@
             <field eval="str(time.localtime(time.time())[0]+1)+'-01-31'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_3" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_consultancy"/>
+            <field name="analytic_account_id" ref="analytic.analytic_consultancy"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-02-07'" name="date_from"/>
             <field eval="900.0" name="planned_amount"/>
@@ -74,7 +74,7 @@
             <field eval="str(time.localtime(time.time())[0]+1)+'-02-28'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_4" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_consultancy"/>
+            <field name="analytic_account_id" ref="analytic.analytic_consultancy"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-03-01'" name="date_from"/>
             <field eval="300.0" name="planned_amount"/>
@@ -84,7 +84,7 @@
     </data>
     <data noupdate="1">
         <record id="crossovered_budget_lines_5" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
+            <field name="analytic_account_id" ref="analytic.analytic_super_product_trainings"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-03-16'" name="date_from"/>
             <field eval="375.0" name="planned_amount"/>
@@ -93,7 +93,7 @@
             <field eval="str(time.localtime(time.time())[0]+1)+'-03-31'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_6" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
+            <field name="analytic_account_id" ref="analytic.analytic_super_product_trainings"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-04-01'" name="date_from"/>
             <field eval="-150.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-04-30'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_7" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
+            <field name="analytic_account_id" ref="analytic.analytic_super_product_trainings"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-05-01'" name="date_from"/>
             <field eval="375.0" name="planned_amount"/>
     </data>
     <data noupdate="1">
         <record id="crossovered_budget_lines_8" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p1"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-06-01'" name="date_from"/>
             <field eval="-7500.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-06-15'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_9" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p1"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-06-16'" name="date_from"/>
             <field eval="-5000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-06-30'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_10" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p1"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-07-01'" name="date_from"/>
             <field eval="-2000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-07-15'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_11" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p1"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-07-16'" name="date_from"/>
             <field eval="20000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-07-31'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_12" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p1"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-08-01'" name="date_from"/>
             <field eval="20000.0" name="planned_amount"/>
     </data>
     <data noupdate="1">
         <record id="crossovered_budget_lines_13" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p2"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-08-16'" name="date_from"/>
             <field eval="-3000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-08-31'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_14" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p2"/>
             <field name="general_budget_id" ref="account_budget_post_purchase0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-09-01'" name="date_from"/>
             <field eval="-1000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-09-15'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_15" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p2"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-09-16'" name="date_from"/>
             <field eval="10000.0" name="planned_amount"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-09-30'" name="date_to"/>
         </record>
         <record id="crossovered_budget_lines_16" model="crossovered.budget.lines">
-            <field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
+            <field name="analytic_account_id" ref="analytic.analytic_seagate_p2"/>
             <field name="general_budget_id" ref="account_budget_post_sales0"/>
             <field eval="str(time.localtime(time.time())[0]+1)+'-10-01'" name="date_from"/>
             <field eval="10000.0" name="planned_amount"/>
index f656d21..cab07c3 100644 (file)
 -
   !record {model: crossovered.budget, id: crossovered_budget_budget0}:
     crossovered_budget_line:
-      - analytic_account_id: account.analytic_consultancy
+      - analytic_account_id: analytic.analytic_consultancy
         date_from: !eval "'%s-01-01' %(datetime.now().year+1)"
         date_to: !eval "'%s-12-31' %(datetime.now().year+1)"
         general_budget_id: account_budget.account_budget_post_purchase0
         planned_amount: 10000.0
-      - analytic_account_id: account.analytic_super_product_trainings
+      - analytic_account_id: analytic.analytic_super_product_trainings
         date_from: !eval "'%s-09-01' %(datetime.now().year+1)"
         date_to: !eval "'%s-09-30' %(datetime.now().year+1)"
         general_budget_id: account_budget.account_budget_post_sales0
index a36c2d8..4b2d9d2 100644 (file)
@@ -2,7 +2,7 @@
   Print the Analytic Budget Report through wizard
 -
   !python {model: account.analytic.account}: |
-    ctx = {'model': 'account.analytic.account','active_ids': [ref('account.analytic_root')]}
+    ctx = {'model': 'account.analytic.account','active_ids': [ref('analytic.analytic_root')]}
     from openerp.tools import test_reports
     test_reports.try_report_action(cr, uid, 'action_account_budget_analytic',wiz_data={}, context=ctx, our_module='account_budget')
 
index 4c19c33..bda36a5 100644 (file)
@@ -60,7 +60,7 @@
     name: Bank Journal(USD)
     code: BUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_usd_id
     default_credit_account_id: account_cash_usd_id
index 7f5cf15..9b2244f 100644 (file)
@@ -60,7 +60,7 @@
     name: Bank Journal(USD)
     code: BUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_usd_id
     default_credit_account_id: account_cash_usd_id
index 0eb71d6..e679a4c 100644 (file)
@@ -54,7 +54,7 @@
     name: Bank Journal(EUR)
     code: BEUR
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account.cash
     default_credit_account_id: account.cash
@@ -66,7 +66,7 @@
     name: Bank Journal(USD)
     code: BUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_usd_id
     default_credit_account_id: account_cash_usd_id
index 12d6f07..f52fcbb 100644 (file)
@@ -54,7 +54,7 @@
     name: Bank Journal(EUR)
     code: BEUR
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account.cash
     default_credit_account_id: account.cash
@@ -66,7 +66,7 @@
     name: Bank Journal(USD)
     code: BUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_usd_id
     default_credit_account_id: account_cash_usd_id
index 6c48c2e..b2732bb 100644 (file)
@@ -22,7 +22,7 @@
     name: Bank Journal(EUR)
     code: BEUR
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account.cash
     default_credit_account_id: account.cash
index e31dd57..d06b851 100644 (file)
@@ -55,7 +55,7 @@
     name: Bank Journal(CHF)
     code: BCHF
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_chf_id
     default_credit_account_id: account_cash_chf_id
index 327cd9d..c46e3be 100644 (file)
@@ -41,7 +41,7 @@
     name: Bank Journal(EUR)
     code: BEUR
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account.cash
     default_credit_account_id: account.cash
@@ -53,7 +53,7 @@
     name: Bank Journal(USD)
     code: BUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_cash_usd_id2
     default_credit_account_id: account_cash_usd_id2
index ce2b71d..4f0c711 100644 (file)
@@ -39,7 +39,7 @@
     name: Bank Journal Test(USD)
     code: BEUSD
     type: bank
-    analytic_journal_id: account.sit
+    analytic_journal_id: analytic.sit
     sequence_id: account.sequence_bank_journal
     default_debit_account_id: account_eur_usd_id
     default_credit_account_id: account_eur_usd_id
index d0175cf..53109ee 100644 (file)
@@ -19,7 +19,9 @@
 #
 ##############################################################################
 
-import analytic
+import models
+import report
+import wizard
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
index eaff26d..79eacdd 100644 (file)
@@ -37,11 +37,26 @@ that have no counterpart in the general financial accounts.
     'data': [
         'security/analytic_security.xml',
         'security/ir.model.access.csv',
-        'analytic_sequence.xml',
-        'analytic_view.xml',
-        'analytic_data.xml',
+        'data/analytic_sequence.xml',
+        'views/analytic_view.xml',
+        'data/analytic_data.xml',
+        'analytic_report.xml',
+        'wizard/account_analytic_balance_report_view.xml',
+        'wizard/account_analytic_cost_ledger_view.xml',
+        'wizard/account_analytic_inverted_balance_report.xml',
+        'wizard/account_analytic_journal_report_view.xml',
+        'wizard/account_analytic_cost_ledger_for_journal_report_view.xml',
+        'wizard/account_analytic_chart_view.xml',
+        'views/report_analyticbalance.xml',
+        'views/report_analyticjournal.xml',
+        'views/report_analyticcostledgerquantity.xml',
+        'views/report_analyticcostledger.xml',
+        'views/report_invertedanalyticbalance.xml',
+    ],
+    'demo': [
+        'data/analytic_demo.xml',
+        'data/analytic_account_demo.xml',
     ],
-    'demo': [],
     'installable': True,
     'auto_install': False,
 }
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
deleted file mode 100644 (file)
index e31efa0..0000000
+++ /dev/null
@@ -1,357 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-#    This program is free software: you can redistribute it and/or modify
-#    it under the terms of the GNU Affero General Public License as
-#    published by the Free Software Foundation, either version 3 of the
-#    License, or (at your option) any later version.
-#
-#    This program is distributed in the hope that it will be useful,
-#    but WITHOUT ANY WARRANTY; without even the implied warranty of
-#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-#    GNU Affero General Public License for more details.
-#
-#    You should have received a copy of the GNU Affero General Public License
-#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from datetime import datetime
-
-from openerp.osv import fields, osv
-from openerp import tools
-from openerp.tools.translate import _
-import openerp.addons.decimal_precision as dp
-
-class account_analytic_account(osv.osv):
-    _name = 'account.analytic.account'
-    _inherit = ['mail.thread']
-    _description = 'Analytic Account'
-    _track = {
-        'state': {
-            'analytic.mt_account_pending': lambda self, cr, uid, obj, ctx=None: obj.state == 'pending',
-            'analytic.mt_account_closed': lambda self, cr, uid, obj, ctx=None: obj.state == 'close',
-            'analytic.mt_account_opened': lambda self, cr, uid, obj, ctx=None: obj.state == 'open',
-        },
-    }
-
-    def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
-        currency_obj = self.pool.get('res.currency')
-        recres = {}
-        def recursive_computation(account):
-            result2 = res[account.id].copy()
-            for son in account.child_ids:
-                result = recursive_computation(son)
-                for field in field_names:
-                    if (account.currency_id.id != son.currency_id.id) and (field!='quantity'):
-                        result[field] = currency_obj.compute(cr, uid, son.currency_id.id, account.currency_id.id, result[field], context=context)
-                    result2[field] += result[field]
-            return result2
-        for account in self.browse(cr, uid, ids, context=context):
-            if account.id not in child_ids:
-                continue
-            recres[account.id] = recursive_computation(account)
-        return recres
-
-    def _debit_credit_bal_qtty(self, cr, uid, ids, fields, arg, context=None):
-        res = {}
-        if context is None:
-            context = {}
-        child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
-        for i in child_ids:
-            res[i] =  {}
-            for n in fields:
-                res[i][n] = 0.0
-
-        if not child_ids:
-            return res
-
-        where_date = ''
-        where_clause_args = [tuple(child_ids)]
-        if context.get('from_date', False):
-            where_date += " AND l.date >= %s"
-            where_clause_args  += [context['from_date']]
-        if context.get('to_date', False):
-            where_date += " AND l.date <= %s"
-            where_clause_args += [context['to_date']]
-        cr.execute("""
-              SELECT a.id,
-                     sum(
-                         CASE WHEN l.amount > 0
-                         THEN l.amount
-                         ELSE 0.0
-                         END
-                          ) as debit,
-                     sum(
-                         CASE WHEN l.amount < 0
-                         THEN -l.amount
-                         ELSE 0.0
-                         END
-                          ) as credit,
-                     COALESCE(SUM(l.amount),0) AS balance,
-                     COALESCE(SUM(l.unit_amount),0) AS quantity
-              FROM account_analytic_account a
-                  LEFT JOIN account_analytic_line l ON (a.id = l.account_id)
-              WHERE a.id IN %s
-              """ + where_date + """
-              GROUP BY a.id""", where_clause_args)
-        for row in cr.dictfetchall():
-            res[row['id']] = {}
-            for field in fields:
-                res[row['id']][field] = row[field]
-        return self._compute_level_tree(cr, uid, ids, child_ids, res, fields, context)
-
-    def name_get(self, cr, uid, ids, context=None):
-        res = []
-        if not ids:
-            return res
-        if isinstance(ids, (int, long)):
-            ids = [ids]
-        for id in ids:
-            elmt = self.browse(cr, uid, id, context=context)
-            res.append((id, self._get_one_full_name(elmt)))
-        return res
-
-    def _get_full_name(self, cr, uid, ids, name=None, args=None, context=None):
-        if context == None:
-            context = {}
-        res = {}
-        for elmt in self.browse(cr, uid, ids, context=context):
-            res[elmt.id] = self._get_one_full_name(elmt)
-        return res
-
-    def _get_one_full_name(self, elmt, level=6):
-        if level<=0:
-            return '...'
-        if elmt.parent_id and not elmt.type == 'template':
-            parent_path = self._get_one_full_name(elmt.parent_id, level-1) + " / "
-        else:
-            parent_path = ''
-        return parent_path + elmt.name
-
-    def _child_compute(self, cr, uid, ids, name, arg, context=None):
-        result = {}
-        if context is None:
-            context = {}
-
-        for account in self.browse(cr, uid, ids, context=context):
-            result[account.id] = map(lambda x: x.id, [child for child in account.child_ids if child.state != 'template'])
-
-        return result
-
-    def _get_analytic_account(self, cr, uid, ids, context=None):
-        company_obj = self.pool.get('res.company')
-        analytic_obj = self.pool.get('account.analytic.account')
-        accounts = []
-        for company in company_obj.browse(cr, uid, ids, context=context):
-            accounts += analytic_obj.search(cr, uid, [('company_id', '=', company.id)])
-        return accounts
-
-    def _set_company_currency(self, cr, uid, ids, name, value, arg, context=None):
-        if isinstance(ids, (int, long)):
-            ids=[ids]
-        for account in self.browse(cr, uid, ids, context=context):
-            if account.company_id:
-                if account.company_id.currency_id.id != value:
-                    raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really useful for consolidation purposes of several companies charts with different currencies, for example."))
-        if value:
-            cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id))
-            self.invalidate_cache(cr, uid, ['currency_id'], [account.id], context=context)
-
-    def _currency(self, cr, uid, ids, field_name, arg, context=None):
-        result = {}
-        for rec in self.browse(cr, uid, ids, context=context):
-            if rec.company_id:
-                result[rec.id] = rec.company_id.currency_id.id
-            else:
-                result[rec.id] = rec.currency_id.id
-        return result
-
-    _columns = {
-        'name': fields.char('Account/Contract Name', required=True, track_visibility='onchange'),
-        'complete_name': fields.function(_get_full_name, type='char', string='Full Name'),
-        'code': fields.char('Reference', select=True, track_visibility='onchange', copy=False),
-        'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Contract')], 'Type of Account', required=True,
-                                 help="If you select the View Type, it means you won\'t allow to create journal entries using that account.\n"\
-                                  "The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
-                                  "If you select Contract or Project, it offers you the possibility to manage the validity and the invoicing options for this account.\n"\
-                                  "The special type 'Template of Contract' allows you to define a template with default data that you can reuse easily."),
-        'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
-        'description': fields.text('Description'),
-        'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
-        'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
-        'child_complete_ids': fields.function(_child_compute, relation='account.analytic.account', string="Account Hierarchy", type='many2many'),
-        'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
-        'balance': fields.function(_debit_credit_bal_qtty, type='float', string='Balance', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
-        'debit': fields.function(_debit_credit_bal_qtty, type='float', string='Debit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
-        'credit': fields.function(_debit_credit_bal_qtty, type='float', string='Credit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
-        'quantity': fields.function(_debit_credit_bal_qtty, type='float', string='Quantity', multi='debit_credit_bal_qtty'),
-        'quantity_max': fields.float('Prepaid Service Units', help='Sets the higher limit of time to work on the contract, based on the timesheet. (for instance, number of hours in a limited support contract.)'),
-        'partner_id': fields.many2one('res.partner', 'Customer'),
-        'user_id': fields.many2one('res.users', 'Project Manager', track_visibility='onchange'),
-        'manager_id': fields.many2one('res.users', 'Account Manager', track_visibility='onchange'),
-        'date_start': fields.date('Start Date'),
-        'date': fields.date('Expiration Date', select=True, track_visibility='onchange'),
-        'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
-        'state': fields.selection([('template', 'Template'),
-                                   ('draft','New'),
-                                   ('open','In Progress'),
-                                   ('pending','To Renew'),
-                                   ('close','Closed'),
-                                   ('cancelled', 'Cancelled')],
-                                  'Status', required=True,
-                                  track_visibility='onchange', copy=False),
-        'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company
-            store = {
-                'res.company': (_get_analytic_account, ['currency_id'], 10),
-            }, string='Currency', type='many2one', relation='res.currency'),
-    }
-
-    def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
-        if not template_id:
-            return {}
-        res = {'value':{}}
-        template = self.browse(cr, uid, template_id, context=context)
-        if template.date_start and template.date:
-            from_dt = datetime.strptime(template.date_start, tools.DEFAULT_SERVER_DATE_FORMAT)
-            to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT)
-            timedelta = to_dt - from_dt
-            res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT)
-        if not date_start:
-            res['value']['date_start'] = fields.date.today()
-        res['value']['quantity_max'] = template.quantity_max
-        res['value']['parent_id'] = template.parent_id and template.parent_id.id or False
-        res['value']['description'] = template.description
-        return res
-
-    def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None):
-        res={}
-        if partner_id:
-            partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
-            if partner.user_id:
-                res['manager_id'] = partner.user_id.id
-            if not name:
-                res['name'] = _('Contract: ') + partner.name
-        return {'value': res}
-
-    def _default_company(self, cr, uid, context=None):
-        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
-        if user.company_id:
-            return user.company_id.id
-        return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
-
-    def _get_default_currency(self, cr, uid, context=None):
-        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
-        return user.company_id.currency_id.id
-
-    _defaults = {
-        'type': 'normal',
-        'company_id': _default_company,
-        'code' : lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account'),
-        'state': 'open',
-        'user_id': lambda self, cr, uid, ctx: uid,
-        'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
-        'date_start': lambda *a: time.strftime('%Y-%m-%d'),
-        'currency_id': _get_default_currency,
-    }
-
-    def check_recursion(self, cr, uid, ids, context=None, parent=None):
-        return super(account_analytic_account, self)._check_recursion(cr, uid, ids, context=context, parent=parent)
-
-    _order = 'code, name asc'
-    _constraints = [
-        (check_recursion, 'Error! You cannot create recursive analytic accounts.', ['parent_id']),
-    ]
-
-    def name_create(self, cr, uid, name, context=None):
-        raise osv.except_osv(_('Warning'), _("Quick account creation disallowed."))
-
-    def copy(self, cr, uid, id, default=None, context=None):
-        if not default:
-            default = {}
-        analytic = self.browse(cr, uid, id, context=context)
-        default['name'] = _("%s (copy)") % analytic['name']
-        return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
-
-    def on_change_company(self, cr, uid, id, company_id):
-        if not company_id:
-            return {}
-        currency = self.pool.get('res.company').read(cr, uid, [company_id], ['currency_id'])[0]['currency_id']
-        return {'value': {'currency_id': currency}}
-
-    def on_change_parent(self, cr, uid, id, parent_id):
-        if not parent_id:
-            return {}
-        parent = self.read(cr, uid, [parent_id], ['partner_id','code'])[0]
-        if parent['partner_id']:
-            partner = parent['partner_id'][0]
-        else:
-            partner = False
-        res = {'value': {}}
-        if partner:
-            res['value']['partner_id'] = partner
-        return res
-
-    def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
-        if not args:
-            args=[]
-        if context is None:
-            context={}
-        if name:
-            account_ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
-            if not account_ids:
-                dom = []
-                for name2 in name.split('/'):
-                    name = name2.strip()
-                    account_ids = self.search(cr, uid, dom + [('name', 'ilike', name)] + args, limit=limit, context=context)
-                    if not account_ids: break
-                    dom = [('parent_id','in',account_ids)]
-        else:
-            account_ids = self.search(cr, uid, args, limit=limit, context=context)
-        return self.name_get(cr, uid, account_ids, context=context)
-
-class account_analytic_line(osv.osv):
-    _name = 'account.analytic.line'
-    _description = 'Analytic Line'
-
-    _columns = {
-        'name': fields.char('Description', required=True),
-        'date': fields.date('Date', required=True, select=True),
-        'amount': fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
-        'unit_amount': fields.float('Quantity', help='Specifies the amount of quantity to count.'),
-        'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='restrict', select=True, domain=[('type','<>','view')]),
-        'user_id': fields.many2one('res.users', 'User'),
-        'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
-
-    }
-
-    def _get_default_date(self, cr, uid, context=None):
-        return fields.date.context_today(self, cr, uid, context=context)
-
-    def __get_default_date(self, cr, uid, context=None):
-        return self._get_default_date(cr, uid, context=context)
-
-    _defaults = {
-        'date': __get_default_date,
-        'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
-        'amount': 0.00
-    }
-
-    _order = 'date desc'
-
-    def _check_no_view(self, cr, uid, ids, context=None):
-        analytic_lines = self.browse(cr, uid, ids, context=context)
-        for line in analytic_lines:
-            if line.account_id.type == 'view':
-                return False
-        return True
-
-    _constraints = [
-        (_check_no_view, 'You cannot create analytic line on view account.', ['account_id']),
-    ]
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/analytic_data.xml b/addons/analytic/analytic_data.xml
deleted file mode 100644 (file)
index 042c216..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="1">
-
-        <!-- Analytic-account-related subtypes for messaging / Chatter -->
-        <record id="mt_account_pending" model="mail.message.subtype">
-            <field name="name">Contract to Renew</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="default" eval="False"/>
-            <field name="description">Contract pending</field>
-        </record>
-        <record id="mt_account_closed" model="mail.message.subtype">
-            <field name="name">Contract Finished</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="default" eval="False"/>
-            <field name="description">Contract closed</field>
-        </record>
-        <record id="mt_account_opened" model="mail.message.subtype">
-            <field name="name">Contract Opened</field>
-            <field name="res_model">account.analytic.account</field>
-            <field name="default" eval="False"/>
-            <field name="description">Contract opened</field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/analytic/analytic_report.xml b/addons/analytic/analytic_report.xml
new file mode 100644 (file)
index 0000000..de2e2fe
--- /dev/null
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <report 
+            id="action_account_analytic_account_inverted_balance"
+            model="account.analytic.account"
+            string="Inverted Analytic Balance"
+            report_type="qweb-pdf"
+            name="account.report_invertedanalyticbalance"
+            file="account.report_invertedanalyticbalance"
+            menu="False"
+        />
+
+        <report 
+            id="action_report_analytic_journal"
+            model="account.analytic.journal"
+            string="Analytic Journal"
+            report_type="qweb-pdf"
+            name="account.report_analyticjournal"
+            file="account.report_analyticjournal"
+            menu="False"
+        />
+
+         <report
+            id="action_report_analytic_balance"
+            model="account.analytic.account"
+            string="Analytic Balance"
+            report_type="qweb-pdf"
+            name="account.report_analyticbalance"
+            file="account.report_analyticbalance"
+            menu="False"
+        />
+
+        <report
+            id="action_report_cost_ledger"
+            model="account.analytic.account"
+            report_type="qweb-pdf"
+            string="Cost Ledger"
+            name="account.report_analyticcostledger"
+            file="account.report_analyticcostledger"
+            menu="False"
+        />
+
+        <report
+            id="action_report_cost_ledgerquantity"
+            model="account.analytic.account"
+            report_type="qweb-pdf"
+            string="Cost Ledger (Only quantities)"
+            name="account.report_analyticcostledgerquantity"
+            file="account.report_analyticcostledgerquantity"
+            menu="False"
+        />
+    </data>
+</openerp>
diff --git a/addons/analytic/analytic_sequence.xml b/addons/analytic/analytic_sequence.xml
deleted file mode 100644 (file)
index ab36d77..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data noupdate="1">
-    <record id="seq_type_analytic_account_main" model="ir.sequence.type">
-            <field name="name">Analytic account</field>
-            <field name="code">account.analytic.account</field>
-        </record>
-        <record id="seq_analytic_account_base" model="ir.sequence">
-            <field name="name">Analytic account sequence</field>
-            <field name="code">account.analytic.account</field>
-            <field name="prefix">AA</field>
-            <field name="padding">3</field>
-        </record>
-
-    </data>
-</openerp>
diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml
deleted file mode 100644 (file)
index 7b1b160..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-
-        <record id="view_account_analytic_account_form" model="ir.ui.view">
-            <field name="name">analytic.analytic.account.form</field>
-            <field name="model">account.analytic.account</field>
-            <field name="arch" type="xml">
-                <form string="Analytic Account">
-                    <sheet string="Analytic Account">
-                        <div class="oe_right oe_button_box" name="buttons">
-                        </div>
-
-                        <div class="oe_title">
-                        <label for="name" class="oe_edit_only"/>
-                            <h1>
-                                <field name="name" class="oe_inline"/>
-                            </h1>
-                            <div name="project"/>
-                        </div>
-
-                        <group name="main">
-                            <group>
-                                <field name="partner_id" on_change="on_change_partner_id(partner_id, name)"/>
-                                <field name="manager_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_manager']}"/>
-                                <field name="currency_id" attrs="{'invisible': ['|',('type', '&lt;&gt;', 'view'), ('company_id', '&lt;&gt;', False)]}"/>
-                            </group>
-                            <group>
-                                <field name="type" invisible="context.get('default_type', False)"/>
-                                <field name="template_id" on_change="on_change_template(template_id, date_start)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
-                                <field name="code"/>
-                                <field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract'])]}"/>
-                                <field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>
-                            </group>
-                        </group>
-                        <notebook>
-                            <page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
-                                <group string="Renewal" name="contract">
-                                    <p colspan="2" class="oe_grey oe_edit_only">
-                                        Once the end date of the contract is
-                                        passed or the maximum number of service
-                                        units (e.g. support contract) is
-                                        reached, the account manager is notified 
-                                        by email to renew the contract with the
-                                        customer.
-                                    </p>
-                                    <field name="date_start"/>
-                                    <label for="date" string="End Date"/>
-                                    <div name="duration">
-                                        <field name="date" class="oe_inline"/>
-                                    </div>
-                                </group>
-                                <separator string="Terms and Conditions" name="description"/>
-                                <field name="description"/>
-                            </page>
-                        </notebook>
-                    </sheet>
-                    <div class="oe_chatter">
-                        <field name="message_follower_ids" widget="mail_followers"/>
-                        <field name="message_ids" widget="mail_thread"/>
-                    </div>
-                </form>
-            </field>
-        </record>
-     </data>
-</openerp>
diff --git a/addons/analytic/data/analytic_account_demo.xml b/addons/analytic/data/analytic_account_demo.xml
new file mode 100644 (file)
index 0000000..2c4acc6
--- /dev/null
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+        <record id="analytic_root" model="account.analytic.account">
+            <field name="name" model="res.company" use="name" search="[]"/>
+        </record>
+        <record id="analytic_absences" model="account.analytic.account">
+            <field name="name">Leaves</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_root"/>
+        </record>
+        <record id="analytic_internal" model="account.analytic.account">
+            <field name="name">Internal</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_root"/>
+        </record>
+        <record id="analytic_our_super_product" model="account.analytic.account">
+            <field name="name">Our Super Product</field>
+            <field name="state">open</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_root"/>
+        </record>
+        <record id="analytic_project_1" model="account.analytic.account">
+            <field name="name">Project 1</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_root"/>
+        </record>
+        <record id="analytic_project_2" model="account.analytic.account">
+            <field name="name">Project 2</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_root"/>
+        </record>
+        <record id="analytic_journal_trainings" model="account.analytic.account">
+            <field name="name">Training</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_internal"/>
+        </record>
+        <record id="analytic_in_house" model="account.analytic.account">
+            <field name="name">In House</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_journal_trainings"/>
+        </record>
+        <record id="analytic_online" model="account.analytic.account">
+            <field name="name">Online</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_journal_trainings"/>
+        </record>
+        <record id="analytic_support" model="account.analytic.account">
+            <field name="name">Support</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_our_super_product"/>
+        </record>
+        <record id="analytic_partners" model="account.analytic.account">
+            <field name="name">Partners</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_support"/>
+        </record>
+        <record id="analytic_customers" model="account.analytic.account">
+            <field name="name">Customers</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_support"/>
+        </record>
+        <record id="analytic_support_internal" model="account.analytic.account">
+            <field name="name">Internal</field>
+            <field name="type">contract</field>
+            <field name="parent_id" ref="analytic_support"/>
+        </record>
+        <record id="analytic_integration" model="account.analytic.account">
+            <field name="name">Integration</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_our_super_product"/>
+        </record>
+        <record id="analytic_consultancy" model="account.analytic.account">
+            <field name="name">Consultancy</field>
+            <field name="type">contract</field>
+            <field name="parent_id" ref="analytic_our_super_product"/>
+        </record>
+        <record id="analytic_super_product_trainings" model="account.analytic.account">
+            <field name="name">Training</field>
+            <field name="type">contract</field>
+            <field name="parent_id" ref="analytic_our_super_product"/>
+        </record>
+        <record id="analytic_seagate_p1" model="account.analytic.account">
+            <field name="name">Seagate P1</field>
+            <field name="parent_id" ref="analytic_integration"/>
+            <field name="type">normal</field>
+            <field name="state">open</field>
+            <field name="partner_id" ref="base.res_partner_19"/>
+        </record>
+        <record id="analytic_seagate_p2" model="account.analytic.account">
+            <field name="name">Seagate P2</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_integration"/>
+            <field name="state">open</field>
+            <field name="partner_id" ref="base.res_partner_19"/>
+        </record>
+        <record id="analytic_millennium_industries" model="account.analytic.account">
+            <field name="name">Millennium Industries</field>
+            <field name="parent_id" ref="analytic_integration"/>
+            <field name="type">normal</field>
+            <field name="partner_id" ref="base.res_partner_15"/>
+        </record>
+        <record id="analytic_integration_c2c" model="account.analytic.account">
+            <field name="name">CampToCamp</field>
+            <field name="type">normal</field>
+            <field eval="str(time.localtime()[0] - 1) + '-08-07'" name="date_start"/>
+            <field eval="time.strftime('%Y-12-31')" name="date"/>
+            <field name="parent_id" ref="analytic_integration"/>
+            <field name="partner_id" ref="base.res_partner_12"/>
+            <field name="state">open</field>
+        </record>
+        <record id="analytic_agrolait" model="account.analytic.account">
+            <field name="name">Agrolait</field>
+            <field name="parent_id" ref="analytic_customers"/>
+            <field name="type">normal</field>
+            <field name="partner_id" ref="base.res_partner_2"/>
+        </record>
+        <record id="analytic_asustek" model="account.analytic.account">
+            <field name="name">Asustek</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_customers"/>
+            <field name="partner_id" ref="base.res_partner_1"/>
+        </record>
+        <record id="analytic_deltapc" model="account.analytic.account">
+            <field name="name">Delta PC</field>
+            <field name="parent_id" ref="analytic_customers"/>
+            <field name="type">normal</field>
+            <field name="partner_id" ref="base.res_partner_4"/>
+        </record>
+        <record id="analytic_spark" model="account.analytic.account">
+            <field name="name">Spark Systems</field>
+            <field eval="str(time.localtime()[0] - 1) + '-05-09'" name="date_start"/>
+            <field eval="time.strftime('%Y-05-08')" name="date"/>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="type">normal</field>
+            <field name="partner_id" ref="base.res_partner_16"/>
+            <field name="state">open</field>
+        </record>
+        <record id="analytic_nebula" model="account.analytic.account">
+            <field name="name">Nebula</field>
+            <field eval="time.strftime('%Y-02-01')" name="date_start"/>
+            <field eval="time.strftime('%Y-07-01')" name="date"/>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="partner_id" ref="base.res_partner_17"/>
+            <field name="state">open</field>
+        </record>
+        <record id="analytic_luminous_technologies" model="account.analytic.account">
+            <field name="name">Luminous Technologies</field>
+            <field eval="time.strftime('%Y-04-24')" name="date_start"/>
+            <field eval="str(time.localtime()[0] + 1) + '-04-24'" name="date"/>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="partner_id" ref="base.res_partner_11"/>
+        </record>
+        <record id="analytic_desertic_hispafuentes" model="account.analytic.account">
+            <field name="name">Desertic - Hispafuentes</field>
+            <field eval="time.strftime('%Y-02-01')" name="date_start"/>
+            <field eval="str(time.localtime()[0] + 1) + '-02-01'" name="date"/>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="partner_id" ref="base.res_partner_12"/>
+        </record>
+        <record id="analytic_think_big_systems" model="account.analytic.account">
+            <field name="name">Think Big Systems</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="partner_id" ref="base.res_partner_18"/>
+        </record>
+        <record id="analytic_partners_camp_to_camp" model="account.analytic.account">
+            <field name="name">Camp to Camp</field>
+            <field eval="time.strftime('%Y-%m-%d', time.localtime(time.time() - 365 * 86400))" name="date_start"/>
+            <field eval="time.strftime('%Y-%m-%d')" name="date"/>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_partners"/>
+            <field name="partner_id" ref="base.res_partner_12"/>
+            <field name="state">open</field>
+        </record>
+        <record id="analytic_project_2_support" model="account.analytic.account">
+            <field name="name">Support</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_project_2"/>
+        </record>
+        <record id="analytic_project_2_development" model="account.analytic.account">
+            <field name="name">Development</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_project_2"/>
+        </record>
+        <record id="analytic_project_1_trainings" model="account.analytic.account">
+            <field name="name">Training</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_project_1"/>
+        </record>
+        <record id="analytic_project_1_development" model="account.analytic.account">
+            <field name="name">Development</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_project_1"/>
+        </record>
+        <record id="analytic_administratif" model="account.analytic.account">
+            <field name="name">Administrative</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_internal"/>
+        </record>
+        <record id="analytic_commercial_marketing" model="account.analytic.account">
+            <field name="name">Commercial &amp; Marketing</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_internal"/>
+        </record>
+        <record id="analytic_our_super_product_development" model="account.analytic.account">
+            <field name="name">Our Super Product Development</field>
+            <field name="type">view</field>
+            <field name="parent_id" ref="analytic_internal"/>
+        </record>
+        <record id="analytic_stable" model="account.analytic.account">
+            <field name="name">Stable</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_our_super_product_development"/>
+        </record>
+        <record id="analytic_trunk" model="account.analytic.account">
+            <field name="name">Trunk</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_our_super_product_development"/>
+        </record>
+        <record id="analytic_paid" model="account.analytic.account">
+            <field name="name">Paid</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_absences"/>
+        </record>
+        <record id="analytic_unpaid" model="account.analytic.account">
+            <field name="name">Unpaid</field>
+            <field name="type">normal</field>
+            <field name="parent_id" ref="analytic_absences"/>
+        </record>
+    </data>
+</openerp>
diff --git a/addons/analytic/data/analytic_data.xml b/addons/analytic/data/analytic_data.xml
new file mode 100644 (file)
index 0000000..042c216
--- /dev/null
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <!-- Analytic-account-related subtypes for messaging / Chatter -->
+        <record id="mt_account_pending" model="mail.message.subtype">
+            <field name="name">Contract to Renew</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="default" eval="False"/>
+            <field name="description">Contract pending</field>
+        </record>
+        <record id="mt_account_closed" model="mail.message.subtype">
+            <field name="name">Contract Finished</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="default" eval="False"/>
+            <field name="description">Contract closed</field>
+        </record>
+        <record id="mt_account_opened" model="mail.message.subtype">
+            <field name="name">Contract Opened</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="default" eval="False"/>
+            <field name="description">Contract opened</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/data/analytic_demo.xml b/addons/analytic/data/analytic_demo.xml
new file mode 100644 (file)
index 0000000..5ce3452
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+        <record id="cose_journal_sale" model="account.analytic.journal">
+            <field name="code">SAL</field>
+            <field name="name">Sales</field>
+            <field name="type">sale</field>
+        </record>
+        <record id="sit" model="account.analytic.journal">
+            <field name="code">START</field>
+            <field name="name">Miscellaneous Operation</field>
+            <field name="type">situation</field>
+        </record>
+    </data>
+</openerp>
diff --git a/addons/analytic/data/analytic_sequence.xml b/addons/analytic/data/analytic_sequence.xml
new file mode 100644 (file)
index 0000000..ab36d77
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+    <record id="seq_type_analytic_account_main" model="ir.sequence.type">
+            <field name="name">Analytic account</field>
+            <field name="code">account.analytic.account</field>
+        </record>
+        <record id="seq_analytic_account_base" model="ir.sequence">
+            <field name="name">Analytic account sequence</field>
+            <field name="code">account.analytic.account</field>
+            <field name="prefix">AA</field>
+            <field name="padding">3</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/models/__init__.py b/addons/analytic/models/__init__.py
new file mode 100644 (file)
index 0000000..dca9f87
--- /dev/null
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+import analytic
diff --git a/addons/analytic/models/analytic.py b/addons/analytic/models/analytic.py
new file mode 100644 (file)
index 0000000..340a37f
--- /dev/null
@@ -0,0 +1,377 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from datetime import datetime
+
+from openerp.osv import fields, osv
+from openerp import tools
+from openerp.tools.translate import _
+import openerp.addons.decimal_precision as dp
+
+class account_analytic_account(osv.osv):
+    _name = 'account.analytic.account'
+    _inherit = ['mail.thread']
+    _description = 'Analytic Account'
+    _track = {
+        'state': {
+            'analytic.mt_account_pending': lambda self, cr, uid, obj, ctx=None: obj.state == 'pending',
+            'analytic.mt_account_closed': lambda self, cr, uid, obj, ctx=None: obj.state == 'close',
+            'analytic.mt_account_opened': lambda self, cr, uid, obj, ctx=None: obj.state == 'open',
+        },
+    }
+
+    def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
+        currency_obj = self.pool.get('res.currency')
+        recres = {}
+        def recursive_computation(account):
+            result2 = res[account.id].copy()
+            for son in account.child_ids:
+                result = recursive_computation(son)
+                for field in field_names:
+                    if (account.currency_id.id != son.currency_id.id) and (field!='quantity'):
+                        result[field] = currency_obj.compute(cr, uid, son.currency_id.id, account.currency_id.id, result[field], context=context)
+                    result2[field] += result[field]
+            return result2
+        for account in self.browse(cr, uid, ids, context=context):
+            if account.id not in child_ids:
+                continue
+            recres[account.id] = recursive_computation(account)
+        return recres
+
+    def _debit_credit_bal_qtty(self, cr, uid, ids, fields, arg, context=None):
+        res = {}
+        if context is None:
+            context = {}
+        child_ids = tuple(self.search(cr, uid, [('parent_id', 'child_of', ids)]))
+        for i in child_ids:
+            res[i] =  {}
+            for n in fields:
+                res[i][n] = 0.0
+
+        if not child_ids:
+            return res
+
+        where_date = ''
+        where_clause_args = [tuple(child_ids)]
+        if context.get('from_date', False):
+            where_date += " AND l.date >= %s"
+            where_clause_args  += [context['from_date']]
+        if context.get('to_date', False):
+            where_date += " AND l.date <= %s"
+            where_clause_args += [context['to_date']]
+        cr.execute("""
+              SELECT a.id,
+                     sum(
+                         CASE WHEN l.amount > 0
+                         THEN l.amount
+                         ELSE 0.0
+                         END
+                          ) as debit,
+                     sum(
+                         CASE WHEN l.amount < 0
+                         THEN -l.amount
+                         ELSE 0.0
+                         END
+                          ) as credit,
+                     COALESCE(SUM(l.amount),0) AS balance,
+                     COALESCE(SUM(l.unit_amount),0) AS quantity
+              FROM account_analytic_account a
+                  LEFT JOIN account_analytic_line l ON (a.id = l.account_id)
+              WHERE a.id IN %s
+              """ + where_date + """
+              GROUP BY a.id""", where_clause_args)
+        for row in cr.dictfetchall():
+            res[row['id']] = {}
+            for field in fields:
+                res[row['id']][field] = row[field]
+        return self._compute_level_tree(cr, uid, ids, child_ids, res, fields, context)
+
+    def name_get(self, cr, uid, ids, context=None):
+        res = []
+        if not ids:
+            return res
+        if isinstance(ids, (int, long)):
+            ids = [ids]
+        for id in ids:
+            elmt = self.browse(cr, uid, id, context=context)
+            res.append((id, self._get_one_full_name(elmt)))
+        return res
+
+    def _get_full_name(self, cr, uid, ids, name=None, args=None, context=None):
+        if context == None:
+            context = {}
+        res = {}
+        for elmt in self.browse(cr, uid, ids, context=context):
+            res[elmt.id] = self._get_one_full_name(elmt)
+        return res
+
+    def _get_one_full_name(self, elmt, level=6):
+        if level<=0:
+            return '...'
+        if elmt.parent_id and not elmt.type == 'template':
+            parent_path = self._get_one_full_name(elmt.parent_id, level-1) + " / "
+        else:
+            parent_path = ''
+        return parent_path + elmt.name
+
+    def _child_compute(self, cr, uid, ids, name, arg, context=None):
+        result = {}
+        if context is None:
+            context = {}
+
+        for account in self.browse(cr, uid, ids, context=context):
+            result[account.id] = map(lambda x: x.id, [child for child in account.child_ids if child.state != 'template'])
+
+        return result
+
+    def _get_analytic_account(self, cr, uid, ids, context=None):
+        company_obj = self.pool.get('res.company')
+        analytic_obj = self.pool.get('account.analytic.account')
+        accounts = []
+        for company in company_obj.browse(cr, uid, ids, context=context):
+            accounts += analytic_obj.search(cr, uid, [('company_id', '=', company.id)])
+        return accounts
+
+    def _set_company_currency(self, cr, uid, ids, name, value, arg, context=None):
+        if isinstance(ids, (int, long)):
+            ids=[ids]
+        for account in self.browse(cr, uid, ids, context=context):
+            if account.company_id:
+                if account.company_id.currency_id.id != value:
+                    raise osv.except_osv(_('Error!'), _("If you set a company, the currency selected has to be the same as it's currency. \nYou can remove the company belonging, and thus change the currency, only on analytic account of type 'view'. This can be really useful for consolidation purposes of several companies charts with different currencies, for example."))
+        if value:
+            cr.execute("""update account_analytic_account set currency_id=%s where id=%s""", (value, account.id))
+            self.invalidate_cache(cr, uid, ['currency_id'], [account.id], context=context)
+
+    def _currency(self, cr, uid, ids, field_name, arg, context=None):
+        result = {}
+        for rec in self.browse(cr, uid, ids, context=context):
+            if rec.company_id:
+                result[rec.id] = rec.company_id.currency_id.id
+            else:
+                result[rec.id] = rec.currency_id.id
+        return result
+
+    _columns = {
+        'name': fields.char('Account/Contract Name', required=True, track_visibility='onchange'),
+        'complete_name': fields.function(_get_full_name, type='char', string='Full Name'),
+        'code': fields.char('Reference', select=True, track_visibility='onchange', copy=False),
+        'type': fields.selection([('view','Analytic View'), ('normal','Analytic Account'),('contract','Contract or Project'),('template','Template of Contract')], 'Type of Account', required=True,
+                                 help="If you select the View Type, it means you won\'t allow to create journal entries using that account.\n"\
+                                  "The type 'Analytic account' stands for usual accounts that you only want to use in accounting.\n"\
+                                  "If you select Contract or Project, it offers you the possibility to manage the validity and the invoicing options for this account.\n"\
+                                  "The special type 'Template of Contract' allows you to define a template with default data that you can reuse easily."),
+        'template_id': fields.many2one('account.analytic.account', 'Template of Contract'),
+        'description': fields.text('Description'),
+        'parent_id': fields.many2one('account.analytic.account', 'Parent Analytic Account', select=2),
+        'child_ids': fields.one2many('account.analytic.account', 'parent_id', 'Child Accounts'),
+        'child_complete_ids': fields.function(_child_compute, relation='account.analytic.account', string="Account Hierarchy", type='many2many'),
+        'line_ids': fields.one2many('account.analytic.line', 'account_id', 'Analytic Entries'),
+        'balance': fields.function(_debit_credit_bal_qtty, type='float', string='Balance', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
+        'debit': fields.function(_debit_credit_bal_qtty, type='float', string='Debit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
+        'credit': fields.function(_debit_credit_bal_qtty, type='float', string='Credit', multi='debit_credit_bal_qtty', digits_compute=dp.get_precision('Account')),
+        'quantity': fields.function(_debit_credit_bal_qtty, type='float', string='Quantity', multi='debit_credit_bal_qtty'),
+        'quantity_max': fields.float('Prepaid Service Units', help='Sets the higher limit of time to work on the contract, based on the timesheet. (for instance, number of hours in a limited support contract.)'),
+        'partner_id': fields.many2one('res.partner', 'Customer'),
+        'user_id': fields.many2one('res.users', 'Project Manager', track_visibility='onchange'),
+        'manager_id': fields.many2one('res.users', 'Account Manager', track_visibility='onchange'),
+        'date_start': fields.date('Start Date'),
+        'date': fields.date('Expiration Date', select=True, track_visibility='onchange'),
+        'company_id': fields.many2one('res.company', 'Company', required=False), #not required because we want to allow different companies to use the same chart of account, except for leaf accounts.
+        'state': fields.selection([('template', 'Template'),
+                                   ('draft','New'),
+                                   ('open','In Progress'),
+                                   ('pending','To Renew'),
+                                   ('close','Closed'),
+                                   ('cancelled', 'Cancelled')],
+                                  'Status', required=True,
+                                  track_visibility='onchange', copy=False),
+        'currency_id': fields.function(_currency, fnct_inv=_set_company_currency, #the currency_id field is readonly except if it's a view account and if there is no company
+            store = {
+                'res.company': (_get_analytic_account, ['currency_id'], 10),
+            }, string='Currency', type='many2one', relation='res.currency'),
+    }
+
+    def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None):
+        if not template_id:
+            return {}
+        res = {'value':{}}
+        template = self.browse(cr, uid, template_id, context=context)
+        if template.date_start and template.date:
+            from_dt = datetime.strptime(template.date_start, tools.DEFAULT_SERVER_DATE_FORMAT)
+            to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT)
+            timedelta = to_dt - from_dt
+            res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT)
+        if not date_start:
+            res['value']['date_start'] = fields.date.today()
+        res['value']['quantity_max'] = template.quantity_max
+        res['value']['parent_id'] = template.parent_id and template.parent_id.id or False
+        res['value']['description'] = template.description
+        return res
+
+    def on_change_partner_id(self, cr, uid, ids,partner_id, name, context=None):
+        res={}
+        if partner_id:
+            partner = self.pool.get('res.partner').browse(cr, uid, partner_id, context=context)
+            if partner.user_id:
+                res['manager_id'] = partner.user_id.id
+            if not name:
+                res['name'] = _('Contract: ') + partner.name
+        return {'value': res}
+
+    def _default_company(self, cr, uid, context=None):
+        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
+        if user.company_id:
+            return user.company_id.id
+        return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+
+    def _get_default_currency(self, cr, uid, context=None):
+        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
+        return user.company_id.currency_id.id
+
+    _defaults = {
+        'type': 'normal',
+        'company_id': _default_company,
+        'code' : lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'account.analytic.account'),
+        'state': 'open',
+        'user_id': lambda self, cr, uid, ctx: uid,
+        'partner_id': lambda self, cr, uid, ctx: ctx.get('partner_id', False),
+        'date_start': lambda *a: time.strftime('%Y-%m-%d'),
+        'currency_id': _get_default_currency,
+    }
+
+    def check_recursion(self, cr, uid, ids, context=None, parent=None):
+        return super(account_analytic_account, self)._check_recursion(cr, uid, ids, context=context, parent=parent)
+
+    _order = 'code, name asc'
+    _constraints = [
+        (check_recursion, 'Error! You cannot create recursive analytic accounts.', ['parent_id']),
+    ]
+
+    def name_create(self, cr, uid, name, context=None):
+        raise osv.except_osv(_('Warning'), _("Quick account creation disallowed."))
+
+    def copy(self, cr, uid, id, default=None, context=None):
+        if not default:
+            default = {}
+        analytic = self.browse(cr, uid, id, context=context)
+        default['name'] = _("%s (copy)") % analytic['name']
+        return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
+
+    def on_change_company(self, cr, uid, id, company_id):
+        if not company_id:
+            return {}
+        currency = self.pool.get('res.company').read(cr, uid, [company_id], ['currency_id'])[0]['currency_id']
+        return {'value': {'currency_id': currency}}
+
+    def on_change_parent(self, cr, uid, id, parent_id):
+        if not parent_id:
+            return {}
+        parent = self.read(cr, uid, [parent_id], ['partner_id','code'])[0]
+        if parent['partner_id']:
+            partner = parent['partner_id'][0]
+        else:
+            partner = False
+        res = {'value': {}}
+        if partner:
+            res['value']['partner_id'] = partner
+        return res
+
+    def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
+        if not args:
+            args=[]
+        if context is None:
+            context={}
+        if name:
+            account_ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context)
+            if not account_ids:
+                dom = []
+                for name2 in name.split('/'):
+                    name = name2.strip()
+                    account_ids = self.search(cr, uid, dom + [('name', 'ilike', name)] + args, limit=limit, context=context)
+                    if not account_ids: break
+                    dom = [('parent_id','in',account_ids)]
+        else:
+            account_ids = self.search(cr, uid, args, limit=limit, context=context)
+        return self.name_get(cr, uid, account_ids, context=context)
+
+class account_analytic_line(osv.osv):
+    _name = 'account.analytic.line'
+    _description = 'Analytic Line'
+
+    _columns = {
+        'name': fields.char('Description', required=True),
+        'date': fields.date('Date', required=True, select=True),
+        'amount': fields.float('Amount', required=True, help='Calculated by multiplying the quantity and the price given in the Product\'s cost price. Always expressed in the company main currency.', digits_compute=dp.get_precision('Account')),
+        'unit_amount': fields.float('Quantity', help='Specifies the amount of quantity to count.'),
+        'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='restrict', select=True, domain=[('type','<>','view')]),
+        'user_id': fields.many2one('res.users', 'User'),
+        'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
+        'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True, ondelete='restrict', select=True),
+
+    }
+
+    def _get_default_date(self, cr, uid, context=None):
+        return fields.date.context_today(self, cr, uid, context=context)
+
+    def __get_default_date(self, cr, uid, context=None):
+        return self._get_default_date(cr, uid, context=context)
+
+    _defaults = {
+        'date': __get_default_date,
+        'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
+        'amount': 0.00
+    }
+
+    _order = 'date desc'
+
+    def _check_no_view(self, cr, uid, ids, context=None):
+        analytic_lines = self.browse(cr, uid, ids, context=context)
+        for line in analytic_lines:
+            if line.account_id.type == 'view':
+                return False
+        return True
+
+    _constraints = [
+        (_check_no_view, 'You cannot create analytic line on view account.', ['account_id']),
+    ]
+
+
+class account_analytic_journal(osv.osv):
+    _name = 'account.analytic.journal'
+    _description = 'Analytic Journal'
+    _columns = {
+        'name': fields.char('Journal Name', required=True),
+        'code': fields.char('Journal Code', size=8),
+        'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the analytic journal without removing it."),
+        'type': fields.selection(
+            [('sale', 'Sale'), ('purchase', 'Purchase'), ('cash', 'Cash'),
+             ('general', 'General'), ('situation', 'Situation')],
+            'Type', required=True, help="Gives the type of the analytic journal. When it needs for a document (eg: an invoice) to create analytic entries, Odoo will look for a matching journal of the same type."),
+        'line_ids': fields.one2many('account.analytic.line', 'journal_id', 'Lines'),
+        'company_id': fields.many2one('res.company', 'Company', required=True),
+    }
+    _defaults = {
+        'active': True,
+        'type': 'general',
+        'company_id': lambda self, cr, uid, c=None: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
+    }
diff --git a/addons/analytic/report/__init__.py b/addons/analytic/report/__init__.py
new file mode 100644 (file)
index 0000000..ff72ccd
--- /dev/null
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import analytic_journal
+import analytic_balance
+import analytic_inverted_balance
+import analytic_cost_ledger
+import analytic_quantity_cost_ledger
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/analytic/report/analytic_balance.py b/addons/analytic/report/analytic_balance.py
new file mode 100644 (file)
index 0000000..b890889
--- /dev/null
@@ -0,0 +1,157 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+
+class account_analytic_balance(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_analytic_balance, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update( {
+            'time': time,
+            'get_objects': self._get_objects,
+            'lines_g': self._lines_g,
+            'move_sum': self._move_sum,
+            'sum_all': self._sum_all,
+            'sum_balance': self._sum_balance,
+            'move_sum_balance': self._move_sum_balance,
+        })
+        self.acc_ids = []
+        self.read_data = []
+        self.empty_acc = False
+        self.acc_data_dict = {}# maintains a relation with an account with its successors.
+        self.acc_sum_list = []# maintains a list of all ids
+
+    def get_children(self, ids):
+        read_data = self.pool.get('account.analytic.account').read(self.cr, self.uid, ids,['child_ids','code','complete_name','balance'])
+        for data in read_data:
+            if (data['id'] not in self.acc_ids):
+                inculde_empty =  True
+                if (not self.empty_acc) and data['balance'] == 0.00:
+                    inculde_empty = False
+                if inculde_empty:
+                    self.acc_ids.append(data['id'])
+                    self.read_data.append(data)
+                    if data['child_ids']:
+                        self.get_children(data['child_ids'])
+        return True
+
+    def _get_objects(self, empty_acc):
+        if self.read_data:
+            return self.read_data
+        self.empty_acc = empty_acc
+        self.read_data = []
+        self.get_children(self.ids)
+        return self.read_data
+
+    def _lines_g(self, account_id, date1, date2):
+        account_analytic_obj = self.pool.get('account.analytic.account')
+        ids = account_analytic_obj.search(self.cr, self.uid,
+                [('parent_id', 'child_of', [account_id])])
+        self.cr.execute("SELECT aa.name AS name, aa.code AS code, \
+                    sum(aal.amount) AS balance, sum(aal.unit_amount) AS quantity \
+                FROM account_analytic_line AS aal, account_account AS aa \
+                WHERE (aal.general_account_id=aa.id) \
+                    AND (aal.account_id IN %s)\
+                    AND (date>=%s) AND (date<=%s) AND aa.active \
+                GROUP BY aal.general_account_id, aa.name, aa.code, aal.code \
+                ORDER BY aal.code", (tuple(ids), date1, date2))
+        res = self.cr.dictfetchall()
+
+        for r in res:
+            if r['balance'] > 0:
+                r['debit'] = r['balance']
+                r['credit'] = 0.0
+            elif r['balance'] < 0:
+                r['debit'] = 0.0
+                r['credit'] = -r['balance']
+            else:
+                r['balance'] == 0
+                r['debit'] = 0.0
+                r['credit'] = 0.0
+        return res
+
+    def _move_sum(self, account_id, date1, date2, option):
+        if account_id not in self.acc_data_dict:
+            account_analytic_obj = self.pool.get('account.analytic.account')
+            ids = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', [account_id])])
+            self.acc_data_dict[account_id] = ids
+        else:
+            ids = self.acc_data_dict[account_id]
+
+        query_params = (tuple(ids), date1, date2)
+        if option == "credit":
+            self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
+                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
+        elif option == "debit":
+            self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
+                    WHERE account_id IN %s\
+                        AND date>=%s AND date<=%s AND amount>0",query_params)
+        elif option == "quantity":
+            self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
+                WHERE account_id IN %s\
+                    AND date>=%s AND date<=%s",query_params)
+        return self.cr.fetchone()[0] or 0.0
+
+    def _move_sum_balance(self, account_id, date1, date2):
+        debit = self._move_sum(account_id, date1, date2, 'debit')
+        credit = self._move_sum(account_id, date1, date2, 'credit')
+        return (debit-credit)
+
+    def _sum_all(self, accounts, date1, date2, option):
+        account_analytic_obj = self.pool.get('account.analytic.account')
+        ids = map(lambda x: x['id'], accounts)
+        if not ids:
+            return 0.0
+
+        if not self.acc_sum_list:
+            ids2 = account_analytic_obj.search(self.cr, self.uid,[('parent_id', 'child_of', ids)])
+            self.acc_sum_list = ids2
+        else:
+            ids2 = self.acc_sum_list
+
+        query_params = (tuple(ids2), date1, date2)
+        if option == "debit":
+            self.cr.execute("SELECT COALESCE(sum(amount),0.0) FROM account_analytic_line \
+                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",query_params)
+        elif option == "credit":
+            self.cr.execute("SELECT COALESCE(-sum(amount),0.0) FROM account_analytic_line \
+                    WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",query_params)
+        elif option == "quantity":
+            self.cr.execute("SELECT COALESCE(sum(unit_amount),0.0) FROM account_analytic_line \
+                    WHERE account_id IN %s AND date>=%s AND date<=%s",query_params)
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_balance(self, accounts, date1, date2):
+        debit = self._sum_all(accounts, date1, date2, 'debit') or 0.0
+        credit = self._sum_all(accounts, date1, date2, 'credit') or 0.0
+        return (debit-credit)
+
+
+class report_analyticbalance(osv.AbstractModel):
+    _name = 'report.account.report_analyticbalance'
+    _inherit = 'report.abstract_report'
+    _template = 'analytic.report_analyticbalance'
+    _wrapped_report_class = account_analytic_balance
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/report/analytic_cost_ledger.py b/addons/analytic/report/analytic_cost_ledger.py
new file mode 100644 (file)
index 0000000..77c6cad
--- /dev/null
@@ -0,0 +1,111 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+
+class account_analytic_cost_ledger(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update( {
+            'time': time,
+            'lines_g': self._lines_g,
+            'lines_a': self._lines_a,
+            'account_sum_debit': self._account_sum_debit,
+            'account_sum_credit': self._account_sum_credit,
+            'account_sum_balance': self._account_sum_balance,
+            'sum_debit': self._sum_debit,
+            'sum_credit': self._sum_credit,
+            'sum_balance': self._sum_balance,
+        })
+        self.children = {}      # a memo for the method _get_children
+
+    def _get_children(self, accounts):
+        """ return all children accounts of the given accounts
+            :param accounts: list of browse records of 'account.analytic.account'
+            :return: tuple of account ids
+        """
+        analytic_obj = self.pool.get('account.analytic.account')
+        res = set()
+        for account in accounts:
+            if account.id not in self.children:
+                self.children[account.id] = analytic_obj.search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])])
+            res.update(self.children[account.id])
+        return tuple(res)
+
+    def _lines_g(self, account, date1, date2):
+        self.cr.execute("SELECT sum(aal.amount) AS balance, aa.code AS code, aa.name AS name, aa.id AS id \
+                FROM account_account AS aa, account_analytic_line AS aal \
+                WHERE (aal.account_id IN %s) AND (aal.date>=%s) AND (aal.date<=%s) AND (aal.general_account_id=aa.id) AND aa.active \
+                GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code", (self._get_children([account]), date1, date2))
+        res = self.cr.dictfetchall()
+        for r in res:
+            r['debit'] = r['balance'] if r['balance'] > 0 else 0.0
+            r['credit'] = -r['balance'] if r['balance'] < 0 else 0.0
+        return res
+
+    def _lines_a(self, general_account, account, date1, date2):
+        self.cr.execute("SELECT aal.name AS name, aal.code AS code, aal.amount AS balance, aal.date AS date, aaj.code AS cj FROM account_analytic_line AS aal, account_analytic_journal AS aaj \
+                WHERE (aal.general_account_id=%s) AND (aal.account_id IN %s) AND (aal.date>=%s) AND (aal.date<=%s) \
+                AND (aal.journal_id=aaj.id) \
+                ORDER BY aal.date, aaj.code, aal.code", (general_account['id'], self._get_children([account]), date1, date2))
+        res = self.cr.dictfetchall()
+        for r in res:
+            r['debit'] = r['balance'] if r['balance'] > 0 else 0.0
+            r['credit'] = -r['balance'] if r['balance'] < 0 else 0.0
+        return res
+
+    def _account_sum_debit(self, account, date1, date2):
+        return self._sum_debit([account], date1, date2)
+
+    def _account_sum_credit(self, account, date1, date2):
+        return self._sum_credit([account], date1, date2)
+
+    def _account_sum_balance(self, account, date1, date2):
+        debit = self._account_sum_debit(account, date1, date2)
+        credit = self._account_sum_credit(account, date1, date2)
+        return (debit-credit)
+
+    def _sum_debit(self, accounts, date1, date2):
+        self.cr.execute("SELECT sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0",
+            (self._get_children(accounts), date1, date2,))
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_credit(self, accounts, date1, date2):
+        self.cr.execute("SELECT -sum(amount) FROM account_analytic_line WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0",
+            (self._get_children(accounts), date1, date2,))
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_balance(self, accounts, date1, date2):
+        debit = self._sum_debit(accounts, date1, date2)
+        credit = self._sum_credit(accounts, date1, date2)
+        return (debit-credit)
+
+
+class report_analyticcostledger(osv.AbstractModel):
+    _name = 'report.account.report_analyticcostledger'
+    _inherit = 'report.abstract_report'
+    _template = 'analytic.report_analyticcostledger'
+    _wrapped_report_class = account_analytic_cost_ledger
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/report/analytic_inverted_balance.py b/addons/analytic/report/analytic_inverted_balance.py
new file mode 100644 (file)
index 0000000..8a47322
--- /dev/null
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+class account_inverted_analytic_balance(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update( {
+            'time': time,
+            'lines_g': self._lines_g,
+            'lines_a': self._lines_a,
+            'sum_debit': self._sum_debit,
+            'sum_credit': self._sum_credit,
+            'sum_balance': self._sum_balance,
+            'sum_quantity': self._sum_quantity,
+        })
+
+    def _lines_g(self, accounts, date1, date2):
+        ids = map(lambda x: x.id, accounts)
+        self.cr.execute("SELECT aa.name AS name, aa.code AS code, "
+                        "sum(aal.amount) AS balance, "
+                        "sum(aal.unit_amount) AS quantity, aa.id AS id \
+                FROM account_analytic_line AS aal, account_account AS aa \
+                WHERE (aal.general_account_id=aa.id) "
+                        "AND (aal.account_id IN %s) "
+                        "AND (date>=%s) AND (date<=%s) AND aa.active \
+                GROUP BY aal.general_account_id, aa.name, aa.code, aal.code, aa.id "
+                        "ORDER BY aal.code",
+                        (tuple(ids), date1, date2))
+        res = self.cr.dictfetchall()
+        for r in res:
+            if r['balance'] > 0:
+                r['debit'] = r['balance']
+                r['credit'] = 0.0
+            elif r['balance'] < 0:
+                r['debit'] =  0.0
+                r['credit'] = -r['balance']
+            else:
+                r['debit'] = 0.0
+                r['credit'] = 0.0
+        return res
+
+    def _lines_a(self, accounts, general_account_id, date1, date2):
+        ids = map(lambda x: x.id, accounts)
+        self.cr.execute("SELECT sum(aal.amount) AS balance, "
+                        "sum(aal.unit_amount) AS quantity, "
+                        "aaa.code AS code, aaa.name AS name, account_id \
+                FROM account_analytic_line AS aal, "
+                        "account_analytic_account AS aaa \
+                WHERE aal.account_id=aaa.id AND aal.account_id IN %s "
+                        "AND aal.general_account_id=%s AND aal.date>=%s "
+                        "AND aal.date<=%s \
+                GROUP BY aal.account_id, general_account_id, aaa.code, aaa.name "
+                        "ORDER BY aal.account_id",
+                        (tuple(ids), general_account_id, date1, date2))
+        res = self.cr.dictfetchall()
+
+        aaa_obj = self.pool.get('account.analytic.account')
+        res2 = aaa_obj.read(self.cr, self.uid, ids, ['complete_name'])
+        complete_name = {}
+        for r in res2:
+            complete_name[r['id']] = r['complete_name']
+        for r in res:
+            r['complete_name'] = complete_name[r['account_id']]
+            if r['balance'] > 0:
+                r['debit'] = r['balance']
+                r['credit'] = 0.0
+            elif r['balance'] < 0:
+                r['debit'] = 0.0
+                r['credit'] = -r['balance']
+            else:
+                r['debit'] = 0.0
+                r['credit'] = 0.0
+        return res
+
+    def _sum_debit(self, accounts, date1, date2):
+        ids = map(lambda x: x.id, accounts)
+        self.cr.execute("SELECT sum(amount) \
+                FROM account_analytic_line \
+                WHERE account_id IN %s AND date>=%s AND date<=%s AND amount>0", (tuple(ids),date1, date2,))
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_credit(self, accounts, date1, date2):
+        ids = map(lambda x: x.id, accounts)
+        self.cr.execute("SELECT -sum(amount) \
+                FROM account_analytic_line \
+                WHERE account_id IN %s AND date>=%s AND date<=%s AND amount<0", (tuple(ids),date1, date2,))
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_balance(self, accounts, date1, date2):
+        debit = self._sum_debit(accounts, date1, date2)
+        credit = self._sum_credit(accounts, date1, date2)
+        return (debit-credit)
+
+    def _sum_quantity(self, accounts, date1, date2):
+        ids = map(lambda x: x.id, accounts)
+        self.cr.execute("SELECT sum(unit_amount) \
+                FROM account_analytic_line \
+                WHERE account_id IN %s AND date>=%s AND date<=%s", (tuple(ids),date1, date2,))
+        return self.cr.fetchone()[0] or 0.0
+
+
+class report_invertedanalyticbalance(osv.AbstractModel):
+    _name = 'report.account.report_invertedanalyticbalance'
+    _inherit = 'report.abstract_report'
+    _template = 'analytic.report_invertedanalyticbalance'
+    _wrapped_report_class = account_inverted_analytic_balance
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/report/analytic_journal.py b/addons/analytic/report/analytic_journal.py
new file mode 100644 (file)
index 0000000..38231b6
--- /dev/null
@@ -0,0 +1,68 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+
+import time
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+
+#
+# Use period and Journal for selection or resources
+#
+class account_analytic_journal(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_analytic_journal, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update( {
+            'time': time,
+            'lines': self._lines,
+            'lines_a': self._lines_a,
+            'sum_general': self._sum_general,
+            'sum_analytic': self._sum_analytic,
+        })
+
+    def _lines(self, journal_id, date1, date2):
+        self.cr.execute('SELECT DISTINCT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null)', (date1, date2, journal_id,))
+        ids = map(lambda x: x[0], self.cr.fetchall())
+        return self.pool.get('account.move.line').browse(self.cr, self.uid, ids)
+
+    def _lines_a(self, move_id, journal_id, date1, date2):
+        ids = self.pool.get('account.analytic.line').search(self.cr, self.uid, [('move_id','=',move_id), ('journal_id','=',journal_id), ('date','>=',date1), ('date','<=',date2)])
+        if not ids:
+            return []
+        return self.pool.get('account.analytic.line').browse(self.cr, self.uid, ids)
+        
+    def _sum_general(self, journal_id, date1, date2):
+        self.cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE id IN (SELECT move_id FROM account_analytic_line WHERE (date>=%s) AND (date<=%s) AND (journal_id=%s) AND (move_id is not null))', (date1, date2, journal_id,))
+        return self.cr.fetchall()[0][0] or 0
+
+    def _sum_analytic(self, journal_id, date1, date2):
+        self.cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE date>=%s AND date<=%s AND journal_id=%s", (date1, date2, journal_id))
+        res = self.cr.dictfetchone()
+        return res['sum'] or 0
+
+
+class report_analyticjournal(osv.AbstractModel):
+    _name = 'report.account.report_analyticjournal'
+    _inherit = 'report.abstract_report'
+    _template = 'analytic.report_analyticjournal'
+    _wrapped_report_class = account_analytic_journal
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/report/analytic_quantity_cost_ledger.py b/addons/analytic/report/analytic_quantity_cost_ledger.py
new file mode 100644 (file)
index 0000000..c4bf9ad
--- /dev/null
@@ -0,0 +1,127 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+import time
+from openerp.osv import osv
+from openerp.report import report_sxw
+
+
+class account_analytic_quantity_cost_ledger(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context)
+        self.localcontext.update( {
+            'time': time,
+            'lines_g': self._lines_g,
+            'lines_a': self._lines_a,
+            'sum_quantity': self._sum_quantity,
+            'account_sum_quantity': self._account_sum_quantity,
+        })
+
+    def _lines_g(self, account_id, date1, date2, journals):
+        if not journals:
+            self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
+                        aa.code AS code, aa.name AS name, aa.id AS id \
+                    FROM account_account AS aa, account_analytic_line AS aal \
+                    WHERE (aal.account_id=%s) AND (aal.date>=%s) \
+                        AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
+                        AND aa.active \
+                    GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
+                    (account_id, date1, date2))
+        else:
+            journal_ids = journals
+            self.cr.execute("SELECT sum(aal.unit_amount) AS quantity, \
+                        aa.code AS code, aa.name AS name, aa.id AS id \
+                    FROM account_account AS aa, account_analytic_line AS aal \
+                    WHERE (aal.account_id=%s) AND (aal.date>=%s) \
+                        AND (aal.date<=%s) AND (aal.general_account_id=aa.id) \
+                        AND aa.active \
+                        AND (aal.journal_id IN %s ) \
+                    GROUP BY aa.code, aa.name, aa.id ORDER BY aa.code",
+                    (account_id, date1, date2, tuple(journal_ids)))
+        res = self.cr.dictfetchall()
+        return res
+
+    def _lines_a(self, general_account_id, account_id, date1, date2, journals):
+        if not journals:
+            self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
+                        aal.unit_amount AS quantity, aal.date AS date, \
+                        aaj.code AS cj \
+                    FROM account_analytic_line AS aal, \
+                        account_analytic_journal AS aaj \
+                    WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \
+                        AND (aal.date>=%s) AND (aal.date<=%s) \
+                        AND (aal.journal_id=aaj.id) \
+                    ORDER BY aal.date, aaj.code, aal.code",
+                    (general_account_id, account_id, date1, date2))
+        else:
+            journal_ids = journals
+            self.cr.execute("SELECT aal.name AS name, aal.code AS code, \
+                        aal.unit_amount AS quantity, aal.date AS date, \
+                        aaj.code AS cj \
+                    FROM account_analytic_line AS aal, \
+                        account_analytic_journal AS aaj \
+                    WHERE (aal.general_account_id=%s) AND (aal.account_id=%s) \
+                        AND (aal.date>=%s) AND (aal.date<=%s) \
+                        AND (aal.journal_id=aaj.id) AND (aaj.id IN %s) \
+                        ORDER BY aal.date, aaj.code, aal.code",
+                    (general_account_id, account_id, date1, date2,tuple(journal_ids)))
+        res = self.cr.dictfetchall()
+        return res
+
+    def _account_sum_quantity(self, account_id, date1, date2, journals):
+        if not journals:
+            self.cr.execute("SELECT sum(unit_amount) \
+                    FROM account_analytic_line \
+                    WHERE account_id=%s AND date>=%s AND date<=%s",
+                    (account_id, date1, date2))
+        else:
+            journal_ids = journals
+            self.cr.execute("SELECT sum(unit_amount) \
+                    FROM account_analytic_line \
+                    WHERE account_id = %s AND date >= %s AND date <= %s \
+                        AND journal_id IN %s",
+                        (account_id, date1, date2, tuple(journal_ids),))
+        return self.cr.fetchone()[0] or 0.0
+
+    def _sum_quantity(self, accounts, date1, date2, journals):
+        ids = map(lambda x: x.id, accounts)
+        if not ids:
+            return 0.0
+        if not journals:
+            self.cr.execute("SELECT sum(unit_amount) \
+                    FROM account_analytic_line \
+                    WHERE account_id IN %s AND date>=%s AND date<=%s",
+                    (tuple(ids), date1, date2,))
+        else:
+            journal_ids = journals
+            self.cr.execute("SELECT sum(unit_amount) \
+                    FROM account_analytic_line \
+                    WHERE account_id IN %s AND date >= %s AND date <= %s \
+                        AND journal_id IN %s",(tuple(ids), date1, date2, tuple(journal_ids)))
+        return self.cr.fetchone()[0] or 0.0
+
+
+class report_analyticcostledgerquantity(osv.AbstractModel):
+    _name = 'report.account.report_analyticcostledgerquantity'
+    _inherit = 'report.abstract_report'
+    _template = 'analytic.report_analyticcostledgerquantity'
+    _wrapped_report_class = account_analytic_quantity_cost_ledger
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
index bf103ca..43bf89d 100644 (file)
         <field eval="True" name="global"/>
         <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
     </record>
+    
+    <record id="analytic_journal_comp_rule" model="ir.rule">
+        <field name="name">Analytic journal multi-company</field>
+        <field name="model_id" ref="model_account_analytic_journal"/>
+        <field name="global" eval="True"/>
+        <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
+    </record>
 
 </data>
 <data noupdate="0">
diff --git a/addons/analytic/views/analytic_view.xml b/addons/analytic/views/analytic_view.xml
new file mode 100644 (file)
index 0000000..0df238f
--- /dev/null
@@ -0,0 +1,372 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_account_analytic_account_form" model="ir.ui.view">
+            <field name="name">analytic.analytic.account.form</field>
+            <field name="model">account.analytic.account</field>
+            <field name="arch" type="xml">
+                <form string="Analytic Account" version="7.0">
+                    <sheet string="Analytic Account">
+                        <div class="oe_right oe_button_box" name="buttons">
+                        </div>
+
+                        <div class="oe_title">
+                        <label for="name" class="oe_edit_only"/>
+                            <h1>
+                                <field name="name" class="oe_inline"/>
+                            </h1>
+                            <div name="project"/>
+                        </div>
+
+                        <group name="main">
+                            <group>
+                                <field name="partner_id" on_change="on_change_partner_id(partner_id, name)"/>
+                                <field name="manager_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_manager']}"/>
+                                <field name="currency_id" attrs="{'invisible': ['|',('type', '&lt;&gt;', 'view'), ('company_id', '&lt;&gt;', False)]}"/>
+                            </group>
+                            <group>
+                                <field name="type" invisible="context.get('default_type', False)"/>
+                                <field name="template_id" on_change="on_change_template(template_id, date_start)" domain="[('type','=','template')]" attrs="{'invisible': [('type','in',['view', 'normal','template'])]}" context="{'default_type' : 'template'}"/>
+                                <field name="code"/>
+                                <field name="parent_id" on_change="on_change_parent(parent_id)" attrs="{'invisible': [('type','in',['contract'])]}"/>
+                                <field name="company_id" on_change="on_change_company(company_id)" widget="selection" groups="base.group_multi_company" attrs="{'required': [('type','&lt;&gt;','view')]}"/>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Contract Information" name="contract_page" attrs="{'invisible':[('type','not in',['contract', 'template'])]}">
+                                <group string="Renewal" name="contract">
+                                    <p colspan="2" class="oe_grey oe_edit_only">
+                                        Once the end date of the contract is
+                                        passed or the maximum number of service
+                                        units (e.g. support contract) is
+                                        reached, the account manager is notified 
+                                        by email to renew the contract with the
+                                        customer.
+                                    </p>
+                                    <field name="date_start"/>
+                                    <label for="date" string="End Date"/>
+                                    <div name="duration">
+                                        <field name="date" class="oe_inline"/>
+                                    </div>
+                                </group>
+                                <separator string="Terms and Conditions" name="description"/>
+                                <field name="description"/>
+                            </page>
+                        </notebook>
+                    </sheet>
+                    <div class="oe_chatter">
+                        <field name="message_follower_ids" widget="mail_followers"/>
+                        <field name="message_ids" widget="mail_thread"/>
+                    </div>
+                </form>
+            </field>
+        </record>
+                
+        <record id="view_account_analytic_account_list" model="ir.ui.view">
+            <field name="name">account.analytic.account.list</field>
+            <field name="model">account.analytic.account</field>
+            <field eval="8" name="priority"/>
+            <field name="arch" type="xml">
+                <tree toolbar="1" colors="red:state=='pending';grey:state in ('cancelled','close');blue:type=='view'" string="Analytic Accounts">
+                    <field name="complete_name"/>
+                    <field name="partner_id"/>
+                    <field name="code"/>
+                    <field name="date_start"/>
+                    <field name="date"/>
+                    <field name="user_id" invisible="1"/>
+                    <field name="manager_id"/>
+                    <field name="parent_id" invisible="1"/>
+                    <field name="state" invisible="1"/>
+                    <field name="type" invisible="1"/>
+                    <field name="template_id" invisible="1"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
+                </tree>
+            </field>
+        </record>
+
+        <record id="view_account_analytic_account_search" model="ir.ui.view">
+            <field name="name">account.analytic.account.search</field>
+            <field name="model">account.analytic.account</field>
+            <field name="arch" type="xml">
+                <search string="Analytic Account">
+                    <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Account"/>
+                    <field name="date"/>
+                    <field name="partner_id" operator="child_of"/>
+                    <field name="manager_id"/>
+                    <field name="parent_id"/>
+                    <field name="user_id"/>
+                    <filter string="Open" domain="[('state','=','open')]" help="Current Accounts"/>
+                    <filter string="Pending" domain="[('state','=','pending')]" help="Pending Accounts"/>
+                    <group expand="0" string="Group By...">
+                        <filter string="Associated Partner" domain="[]" context="{'group_by':'partner_id'}"/>
+                        <filter string="Type" domain="[]" context="{'group_by':'type'}"/>
+                        <filter string="Template" domain="[]" context="{'group_by':'template_id'}"/>
+                        <filter string="Parent Account" domain="[]" context="{'group_by':'parent_id'}"/>
+                        <filter string="Status" domain="[]" context="{'group_by':'state'}" groups="base.group_no_one"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
+        <record id="view_account_analytic_account_tree" model="ir.ui.view">
+            <field name="name">account.analytic.account.tree</field>
+            <field name="model">account.analytic.account</field>
+            <field name="field_parent">child_complete_ids</field>
+            <field name="arch" type="xml">
+                <tree colors="blue:state=='pending';grey:state in ('close','cancelled');blue:type=='view'" string="Analytic account" toolbar="1">
+                    <field name="name" invisible="1"/>
+                    <field name="complete_name"/>
+                    <field name="code"/>
+                    <field name="debit"/>
+                    <field name="credit"/>
+                    <field name="balance"/>
+                    <field name="state" invisible="1"/>
+                    <field name="currency_id" groups="base.group_multi_currency"/>
+                    <field name="date" invisible="1"/>
+                    <field name="user_id" invisible="1"/>
+                    <field name="partner_id" invisible="1"/>
+                    <field name="parent_id" invisible="1"/>
+                    <field name="type"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
+                    <field name="template_id" invisible="1"/>
+                </tree>
+            </field>
+        </record>
+
+
+        <record id="action_account_analytic_account_form" model="ir.actions.act_window">
+            <field name="name">Analytic Accounts</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="context">{}</field> <!-- repair invalid context by setting empty one -->
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="view_id" ref="view_account_analytic_account_tree"/>
+            <field name="search_view_id" ref="analytic.view_account_analytic_account_search"/>
+        </record>
+
+        <record id="act_account_renew_view" model="ir.actions.act_window">
+            <field name="name">Accounts to Renew</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="domain">[('date','&lt;',time.strftime('%Y-%m-%d %H:%M:%S'))]</field>
+            <field name="filter" eval="True"/>
+        </record>
+
+        <record id="action_account_analytic_account_tree2" model="ir.actions.act_window">
+            <field name="name">Chart of Analytic Accounts</field>
+            <field name="res_model">account.analytic.account</field>
+            <field name="view_type">tree</field>
+            <field name="view_id" ref="view_account_analytic_account_tree"/>
+            <field name="domain">[('parent_id','=',False)]</field>
+            <field name="help" type="html">
+              <p>
+                Click to add a new analytic account.
+              </p><p>
+                The normal chart of accounts has a structure defined by the
+                legal requirement of the country. The analytic chart of
+                accounts structure should reflect your own business needs in
+                term of costs/revenues reporting.
+              </p><p>
+                They are usually structured by contracts, projects, products or
+                departements. Most of the Odoo operations (invoices,
+                timesheets, expenses, etc) generate analytic entries on the
+                related account.
+              </p>
+            </field>
+        </record>
+
+
+        <record id="view_account_analytic_line_form" model="ir.ui.view">
+            <field name="name">account.analytic.line.form</field>
+            <field name="model">account.analytic.line</field>
+            <field name="priority">1</field>
+            <field name="arch" type="xml">
+                <form string="Analytic Entry" version="7.0">
+                    <group>
+                        <group>
+                            <field name="name"/>
+                            <field name="account_id"/>
+                            <field name="user_id" context="{'default_groups_ref': ['base.group_user', 'base.group_partner_manager', 'account.group_account_invoice']}"/>
+                        </group>
+                        <group>
+                            <field name="date"/>
+                            <field name="company_id" groups="base.group_multi_company"/>
+                        </group>
+                        <group string="Amount">
+                            <field name="amount"/>
+                        </group>
+                        <group string="Product Information" name="product_info">
+                            <label for="unit_amount"/>
+                            <div>
+                                <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
+                            </div>
+                        </group>
+                    </group>
+                </form>
+            </field>
+        </record>
+        <record id="view_account_analytic_line_tree" model="ir.ui.view">
+            <field name="name">account.analytic.line.tree</field>
+            <field name="model">account.analytic.line</field>
+            <field name="arch" type="xml">
+                <tree string="Analytic Entries">
+                    <field name="date"/>
+                    <field name="name"/>
+                    <field name="user_id"/>
+                    <field name="amount" sum="Total" invisible="context.get('to_invoice', False)"/>
+                    <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" sum="Total Quantity"/>
+                    <field domain="[('type','=','normal')]" name="account_id"/>
+                    <field name="company_id" groups="base.group_multi_company"/>
+                </tree>
+            </field>
+        </record>
+        <record id="view_account_analytic_line_filter" model="ir.ui.view">
+            <field name="name">account.analytic.line.select</field>
+            <field name="model">account.analytic.line</field>
+            <field name="arch" type="xml">
+                <search string="Search Analytic Lines">
+                    <field name="name" string="Description"/>
+                    <field name="date"/>
+                    <filter string="My Entries" domain="[('user_id','=',uid)]"/>
+                    <field name="account_id" filter_domain="[('account_id','child_of',self)]"/>
+                    <field name="user_id"/>
+                    <group string="Group By..." expand="0">
+                        <filter string="Analytic Account" context="{'group_by':'account_id'}" name="account_id"/>
+                        <filter string="User" context="{'group_by':'user_id'}" name="user_id"/>
+                        <filter string="Tasks Month" context="{'group_by':'date'}" name="group_date" help="Invoice Tasks by Month"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+        <record id="action_account_analytic_line_form" model="ir.actions.act_window">
+            <field name="name">Analytic Entries</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.line</field>
+            <field name="view_type">form</field>
+            <field name="context">{"search_default_user_id":uid}</field>
+            <field name="view_id" ref="view_account_analytic_line_tree"/>
+        </record>
+
+        <!-- Entries by Line -->
+
+        <record id="action_account_tree1" model="ir.actions.act_window">
+            <field name="name">Analytic Items</field>
+            <field name="res_model">account.analytic.line</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="domain">[('account_id','child_of',[active_id])]</field>
+            <field name="context">{'account_id':active_id}</field>
+            <field name="search_view_id" ref="view_account_analytic_line_filter"/>
+        </record>
+        <record id="ir_open_account_analytic_account" model="ir.values">
+            <field eval="'tree_but_open'" name="key2"/>
+            <field eval="'account.analytic.account'" name="model"/>
+            <field name="name">Open Account Tree</field>
+            <field eval="'ir.actions.act_window,%d'%action_account_tree1" name="value"/>
+        </record>
+
+        <record id="account_analytic_line_extended_form" model="ir.ui.view">
+            <field name="name">account.analytic.line.extended_form</field>
+            <field name="model">account.analytic.line</field>
+            <field name="arch" type="xml">
+                <form string="Project line" version="7.0">
+                    <group>
+                       <group>
+                          <field name="name"/>
+                          <field name="account_id"/>
+                       </group>
+                       <group>
+                          <field name="date" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
+                          <field name="company_id" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)"/>
+                        </group>
+                        <group string="Amount">
+                            <field name="amount"/>
+                        </group>
+                        <group string="Product Information">
+                            <label for="unit_amount"/>
+                            <div>
+                                <field name="unit_amount" on_change="on_change_unit_amount(product_id, unit_amount, company_id, product_uom_id)" class="oe_inline"/>
+                            </div>
+                        </group>
+                    </group>
+                </form>
+            </field>
+        </record>
+        <record id="action_account_analytic_account_line_extended_form" model="ir.actions.act_window">
+            <field name="name">account.analytic.line.extended</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.line</field>
+            <field name="view_type">form</field>
+            <field name="view_id" ref="view_account_analytic_line_form"/>
+        </record>
+
+        #
+        # Analytic Journal
+        #
+
+        <record id="view_account_analytic_journal_tree" model="ir.ui.view">
+           <field name="name">account.analytic.journal.tree</field>
+            <field name="model">account.analytic.journal</field>
+            <field name="arch" type="xml">
+                <tree string="Analytic Journal">
+                    <field name="code"/>
+                    <field name="name"/>
+                    <field name="type"/>
+                </tree>
+            </field>
+        </record>
+
+        <record id="view_analytic_journal_search" model="ir.ui.view">
+            <field name="name">account.analytic.journal.search</field>
+            <field name="model">account.analytic.journal</field>
+            <field name="arch" type="xml">
+                <search string="Analytic Journals">
+                    <field name="name" filter_domain="['|', ('name','ilike',self), ('code','ilike',self)]" string="Analytic Journal"/>
+                   <field name="type"/>
+                    <group expand="0" string="Group By...">
+                        <filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type'}"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
+        <record id="view_account_analytic_journal_form" model="ir.ui.view">
+            <field name="name">account.analytic.journal.form</field>
+            <field name="model">account.analytic.journal</field>
+            <field name="arch" type="xml">
+                <form string="Analytic Journal" version="7.0">
+                    <group col="4">
+                        <field name="name"/>
+                        <field name="code"/>
+                        <field name="type"/>
+                        <field name="active"/>
+                        <field name="company_id" groups="base.group_multi_company"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+        <record id="action_account_analytic_journal_form" model="ir.actions.act_window">
+            <field name="name">Analytic Journals</field>
+            <field name="res_model">account.analytic.journal</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="search_view_id" ref="view_analytic_journal_search" />
+        </record>
+
+        #
+        # Open journal entries
+        #
+
+        <record id="action_account_analytic_journal_open_form" model="ir.actions.act_window">
+            <field name="name">Analytic Journal Items</field>
+            <field name="res_model">account.analytic.line</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+        </record>
+
+     </data>
+</openerp>
diff --git a/addons/analytic/views/report_analyticbalance.xml b/addons/analytic/views/report_analyticbalance.xml
new file mode 100644 (file)
index 0000000..09cd56f
--- /dev/null
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<template id="report_analyticbalance">
+    <t t-call="report.html_container">
+        <t t-call="report.internal_layout">
+            <div class="page">
+                <h2>Analytic Balance - <span t-esc="res_company.currency_id.name"/></h2>
+
+                <table class="table table-condensed">
+                    <thead>
+                        <tr>
+                            <th>Code</th>
+                            <th>Account Name</th>
+                            <th>Debit</th>
+                            <th>Credit</th>
+                            <th>Balance</th>
+                            <th>Quantity</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr>
+                            <td colspan="2">Total</td>
+                            <td>
+                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'debit'))"/>
+                            </td>
+                            <td>
+                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'credit'))"/>
+                            </td>
+                            <td>
+                                <span t-esc="formatLang(sum_balance(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2']),currency_obj=res_company.currency_id)"/>
+                            </td>
+                            <td>
+                                <span t-esc="formatLang(sum_all(get_objects(data['form']['empty_acc']), data['form']['date1'], data['form']['date2'], 'quantity'))"/>
+                            </td>
+                        </tr>
+                        <t t-foreach="get_objects(data['form']['empty_acc'])" t-as="o">
+                            <tr>
+                                <td><span t-esc="o['code']"/></td>
+                                <td><span t-esc="o['complete_name']"/></td>
+                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'debit'))"/></td>
+                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'credit'))"/></td>
+                                <td><span t-esc="formatLang(move_sum_balance(o['id'], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
+                                <td><span t-esc="formatLang(move_sum(o['id'], data['form']['date1'], data['form']['date2'], 'quantity'))"/></td>
+                            </tr>
+                            <tr t-foreach="lines_g(o['id'], data['form']['date1'], data['form']['date2'])" t-as="move_g">
+                                <td><span t-esc="move_g['code']"/></td>
+                                <td><span t-esc="move_g['name']"/></td>
+                                <td><span t-esc="formatLang(move_g['debit'])"/></td>
+                                <td><span t-esc="formatLang(move_g['credit'])"/></td>
+                                <td><span t-esc="formatLang(move_g['balance'], currency_obj=res_company.currency_id)"/></td>
+                                <td><span t-esc="formatLang(move_g['quantity'])"/></td>
+                            </tr>    
+                        </t>
+                    </tbody>
+                </table> 
+            </div>
+        </t>
+    </t>
+</template>
+</data>
+</openerp>
diff --git a/addons/analytic/views/report_analyticcostledger.xml b/addons/analytic/views/report_analyticcostledger.xml
new file mode 100644 (file)
index 0000000..cda37d4
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<template id="report_analyticcostledger">
+    <t t-call="report.html_container">
+        <t t-call="report.internal_layout">
+            <div class="page">
+                <h2>Cost Ledger</h2>
+            
+                <div class="row mt32 mb32">
+                    <div class="col-xs-3">
+                        <strong>Period From:</strong>
+                        <p t-esc="formatLang(data['form']['date1'], date=True)"/>
+                    </div>
+                    <div class="col-xs-3">
+                        <strong>Period To:</strong>
+                        <p t-esc="formatLang(data['form']['date2'], date=True)"/>
+                    </div>
+                    <div class="col-xs-3">
+                        <strong>Printing Date:</strong>
+                        <p t-esc="formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time=True)" />
+                    </div>
+                </div>
+
+                <table class="table table-condensed">
+                    <thead>
+                        <tr>
+                            <th>Date/Code</th>
+                            <th>J.C. /Move</th>
+                            <th>Name</th>
+                            <th>Debit</th>
+                            <th>Credit</th>
+                            <th>Balance</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr style="font-weight: bold;">
+                            <td>Total:</td>
+                            <td></td>
+                            <td></td>
+                            <td><span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
+                            <td><span t-esc="formatLang(sum_credit(docs,data['form']['date1'],data['form']['date2']))"/></td>
+                            <td>
+                                <span t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']) - sum_credit(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
+                            </td>
+                        </tr>
+                
+                        <t t-foreach="docs" t-as="account">
+                            <tr style="font-weight: bold;">
+                                <td><span t-esc="account.code"/></td>
+                                <td></td>
+                                <td><span t-esc="account.complete_name"/></td>
+                                <td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']))"/></td>
+                                <td><span t-esc="formatLang(sum_credit([account], data['form']['date1'], data['form']['date2']))"/></td>
+                                <td><span t-esc="formatLang(sum_debit([account], data['form']['date1'], data['form']['date2']) - sum_credit([account], data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/></td>
+                            </tr>
+
+                            <t t-foreach="lines_g(account, data['form']['date1'], data['form']['date2'])" t-as="move_g">
+                                <tr>
+                                    <td><span t-esc="move_g['code']"/></td>
+                                    <td></td>
+                                    <td><span t-esc="move_g['name']"/></td>
+                                    <td><span t-esc="move_g['debit']"/></td>
+                                    <td><span t-esc="move_g['credit']"/></td>
+                                    <td>
+                                        <span t-esc="formatLang(move_g['balance'], currency_obj=res_company.currency_id)"/>
+                                    </td>
+                                </tr>
+                                <tr t-foreach="lines_a(move_g, account, data['form']['date1'], data['form']['date2'])" t-as="move_a">
+                                    <td>
+                                        <t t-esc="formatLang(move_a['date'], date=True)"></t> 
+                                    </td>
+                                    <td><span t-esc="move_a['cj']"/></td>
+                                    <td><span t-esc="move_a['name']"/></td>
+                                    <td><span t-esc="move_a['debit']"/></td>
+                                    <td><span t-esc="move_a['credit']"/></td>
+                                    <td>
+                                        <span t-esc="formatLang(move_a['balance'], currency_obj=res_company.currency_id)"/>
+                                    </td> 
+                                </tr>
+                            </t>
+                        </t>
+                    </tbody>
+                </table>
+            </div>
+        </t>
+    </t>
+</template>
+</data>
+</openerp>
\ No newline at end of file
diff --git a/addons/analytic/views/report_analyticcostledgerquantity.xml b/addons/analytic/views/report_analyticcostledgerquantity.xml
new file mode 100644 (file)
index 0000000..de49d49
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<template id="report_analyticcostledgerquantity">
+    <t t-call="report.html_container">
+        <t t-call="report.internal_layout">
+            <div class="page">
+                <h2>Cost Ledger</h2>
+
+                <div class="row mt32 mb32">
+                    <div class="col-xs-3">
+                        <strong>Period From:</strong>
+                        <p t-esc="formatLang(data['form']['date1'], date=True)"/>
+                    </div>
+                    <div class="col-xs-3">
+                        <strong>Period To:</strong>
+                        <p t-esc="formatLang(data['form']['date2'], date=True)"/>
+                    </div>
+                    <div class="col-xs-3">
+                        <strong>Printing Date:</strong>
+                        <p t-esc="formatLang(time.strftime('%Y-%m-%d %H:%M:%S'), date_time=True)" />
+                    </div>
+                </div>
+
+                <table class="table table-condensed">
+                    <thead>
+                        <tr>
+                            <th>Date/Code</th>
+                            <th>J.C./Move</th>
+                            <th>Name</th>
+                            <th>Quantity</th>
+                            <th>Total</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr style="font-weight:bold;">
+                            <td>Total:</td>
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                            <td>
+                                <span t-esc="sum_quantity(docs, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
+                            </td>
+                        </tr>
+                
+                        <t t-foreach="docs" t-as="account">
+                            <tr style="font-weight:bold;">
+                                <td><span t-esc="account.code"/></td>
+                                <td><span t-esc="account.complete_name"/></td>
+                                <td></td>
+                                <td>
+                                    <p t-if="account.quantity_max">
+                                        Max quantity : <span t-esc="formatLang(account.quantity_max)"/>
+                                    </p>
+                                </td>
+                                <td>
+                                    <span t-esc="account_sum_quantity(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])"/>
+                                </td>
+                            </tr>
+
+                            <t t-foreach="lines_g(account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_g">
+                                <tr style="font-weight:bold;">
+                                    <td><span t-esc="move_g['code']"/></td>
+                                    <td colspan="2"><span t-esc="move_g['name']"/></td>
+                                    <td></td>
+                                    <td class="text-right"><span t-esc="move_g['quantity']"/></td>
+                                </tr>
+                        
+                                <t t-foreach="lines_a(move_g['id'], account.id, data['form']['date1'], data['form']['date2'], data['form']['journal'])" t-as="move_a">
+                                    <tr style="font-weight:normal;">
+                                        <td><span t-esc="formatLang(move_a['date'], date=True)"/></td>
+                                        <td><span t-esc="move_a['cj']"/></td>
+                                        <td><span t-esc="move_a['name']"/></td>
+                                        <td></td>
+                                        <td class="text-right"><span t-esc="move_a['quantity']"/></td> 
+                                    </tr>
+                                </t> 
+                            </t> 
+                        </t>
+                    </tbody>
+                </table>
+            </div>
+        </t>
+    </t>
+</template>
+</data>
+</openerp>
\ No newline at end of file
diff --git a/addons/analytic/views/report_analyticjournal.xml b/addons/analytic/views/report_analyticjournal.xml
new file mode 100644 (file)
index 0000000..1b3a4fd
--- /dev/null
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<template id="report_analyticjournal">
+    <t t-call="report.html_container">
+        <t t-foreach="docs" t-as="o">
+            <t t-call="report.internal_layout">
+                <div class="page">
+                    <h2>Analytic Journal</h2>
+
+                    <div class="row mt32 mb32">
+                        <div class="col-xs-3">
+                            <strong>Period From:</strong>
+                            <p t-esc="formatLang(data['form']['date1'], date=True)"/>
+                        </div>
+                        <div class="col-xs-3">
+                            <strong>Period To:</strong>
+                            <p t-esc="formatLang(data['form']['date2'], date=True)"/>
+                        </div>
+                        <div class="col-xs-3">
+                            <strong>Currency:</strong>
+                            <p t-field="res_company.currency_id" />
+                        </div>
+                    </div>
+
+                    <table class="table table-condensed">
+                        <thead>
+                            <tr>
+                                <th>Date</th>
+                                <th>Code</th>
+                                <th>Move Name</th>
+                                <th>Account n°</th>
+                                <th>General</th>
+                                <th>Analytic</th>
+                            </tr>
+                            <tr>
+                                <th colspan="4"><t t-if="o.code"><span t-esc="o.code"/></t> - <span t-esc="o.name"/></th>
+                                <th><span t-esc="formatLang(sum_general(o.id, data['form']['date1'], data['form']['date2']))"/></th>
+                                <th><span t-esc="formatLang(sum_analytic(o.id, data['form']['date1'], data['form']['date2']))"/></th>
+                            </tr>
+                        </thead>
+                        <tbody>
+                            <t t-foreach="lines(o.id, data['form']['date1'], data['form']['date2'])" t-as="move">
+                                <tr>
+                                    <td></td>
+                                    <td></td>
+                                    <td>
+                                        <span t-esc="move.name"/>
+                                    </td>
+                                    <td>
+                                        <span t-esc="move.account_id.code"/>
+                                        <span t-esc="move.account_id.name"/>
+                                    </td>
+                                    <td>
+                                        <span t-esc="formatLang(move.debit-move.credit)"/>
+                                    </td>
+                                    <td></td>
+                                </tr>
+                                <tr t-foreach="lines_a(move.id, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
+                                    <td>
+                                        <span t-esc="formatLang(move_a.date,date = True)"/>
+                                    </td>
+                                    <td>
+                                        <p t-if="move_a.code"><span t-esc="move_a.code"/></p>
+                                    </td>
+                                    <td>
+                                        <span t-esc="move_a.name"/>
+                                    </td>
+                                    <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
+                                    <td></td>
+                                    <td><span t-esc="formatLang(move_a.amount)"/></td>
+                                </tr>
+                            </t>
+                            <tr t-foreach="lines_a(False, o.id, data['form']['date1'], data['form']['date2'])" t-as="move_a">
+                                <td><span t-esc="formatLang(move_a.date,date = True)"/></td>
+                                <td><p t-if="move_a.code"><span t-esc="move_a.code"/></p></td>
+                                <td><span t-esc="move_a.name"/></td>
+                                <td><span t-esc="move_a.account_id.code"/> - <span t-esc="move_a.account_id.name"/></td>
+                                <td></td>
+                                <td><span t-esc="formatLang(move_a.amount)"/></td>
+                            </tr>
+                        </tbody>
+                    </table>
+                </div>
+            </t>
+        </t>
+    </t>
+</template>
+</data>
+</openerp>
diff --git a/addons/analytic/views/report_invertedanalyticbalance.xml b/addons/analytic/views/report_invertedanalyticbalance.xml
new file mode 100644 (file)
index 0000000..e545ec8
--- /dev/null
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<template id="report_invertedanalyticbalance">
+    <t t-call="report.html_container">
+        <t t-call="report.internal_layout">
+            <div class="page">
+                <h2>Inverted Analytic Balance - <span t-esc="res_company.currency_id.name"/></h2>
+
+                <table class="table table-condensed">
+                    <thead>
+                        <tr>
+                            <th>Code</th>
+                            <th>Account Name</th>
+                            <th>Debit</th>
+                            <th>Credit</th>
+                            <th>Balance</th>
+                            <th>Quantity</th>
+                        </tr>
+                    </thead>
+                    <tbody>
+                        <tr>
+                            <td><strong>Total</strong></td>
+                            <td></td>
+                            <td><strong t-esc="formatLang(sum_debit(docs, data['form']['date1'], data['form']['date2']))"/></td>
+                            <td><strong t-esc="formatLang(sum_credit(docs, data['form']['date1'], data['form']['date2']))"/></td>
+                            <td>
+                                <strong t-esc="formatLang(sum_balance(docs, data['form']['date1'], data['form']['date2']), currency_obj=res_company.currency_id)"/>
+                            </td>
+                            <td><strong><span t-esc="formatLang(sum_quantity(docs, data['form']['date1'], data['form']['date2']))"/></strong></td>
+                        </tr>
+                        <t t-foreach="lines_g(docs, data['form']['date1'], data['form']['date2'])" t-as="move_g">
+                            <tr>
+                                <td>
+                                    <strong t-esc="move_g['code']"/>
+                                </td>
+                                <td>
+                                    <strong t-esc="move_g['name']"/>
+                                </td>
+                                <td class="text-right">
+                                    <strong>
+                                        <span t-esc="formatLang(move_g['debit'])"/>
+                                    </strong>
+                                </td>
+                                <td class="text-right">
+                                    <strong>
+                                        <span t-esc="formatLang(move_g['credit'])"/>
+                                    </strong>
+                                </td>
+                                <td class="text-right">
+                                    <strong>
+                                        <span t-esc="formatLang(move_g['balance'], currency_obj = res_company.currency_id)"/>
+                                    </strong>
+                                </td>
+                                <td class="text-right">
+                                    <strong>
+                                        <span t-esc="formatLang(move_g['quantity'])"/>
+                                    </strong>
+                                </td>
+                            </tr>
+                            <t t-foreach="lines_a(docs, move_g['id'], data['form']['date1'], data['form']['date2'])" t-as="move_a">
+                                <tr>
+                                    <td>
+                                        <span t-esc="move_a['code']"/>
+                                    </td>
+                                    <td>
+                                        <span t-esc="move_a['complete_name']"/>
+                                    </td>
+                                    <td class="text-right">
+                                        <span t-esc="formatLang(move_a['debit'])"/>
+                                    </td>
+                                    <td class="text-right">
+                                        <span t-esc="formatLang(move_a['credit'])"/>
+                                    </td>
+                                    <td class="text-right">
+                                        <span t-esc="formatLang(move_a['balance'], currency_obj = res_company.currency_id)"/>
+                                    </td>
+                                    <td class="text-right">
+                                        <span t-esc="formatLang(move_a['quantity'])"/>
+                                    </td>
+                                </tr>
+                            </t>
+                        </t>
+                    </tbody>
+                </table> 
+            </div>
+        </t>
+    </t>
+</template>
+</data>
+</openerp>
diff --git a/addons/analytic/wizard/__init__.py b/addons/analytic/wizard/__init__.py
new file mode 100644 (file)
index 0000000..de0737e
--- /dev/null
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import account_analytic_journal_report
+import account_analytic_balance_report
+import account_analytic_inverted_balance_report
+import account_analytic_cost_ledger_report
+import account_analytic_cost_ledger_for_journal_report
+import account_analytic_chart
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_balance_report.py b/addons/analytic/wizard/account_analytic_balance_report.py
new file mode 100644 (file)
index 0000000..062945f
--- /dev/null
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import fields, osv
+
+
+class account_analytic_balance(osv.osv_memory):
+    _name = 'account.analytic.balance'
+    _description = 'Account Analytic Balance'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+        'empty_acc': fields.boolean('Empty Accounts ? ', help='Check if you want to display Accounts with 0 balance too.'),
+    }
+
+    _defaults = {
+        'date1': lambda *a: time.strftime('%Y-01-01'),
+        'date2': lambda *a: time.strftime('%Y-%m-%d')
+    }
+
+    def check_report(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        datas = {
+            'ids': context.get('active_ids', []),
+            'model': 'account.analytic.account',
+            'form': data
+        }
+
+        datas['form']['active_ids'] = context.get('active_ids', False)
+
+        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticbalance', data=datas, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_balance_report_view.xml b/addons/analytic/wizard/account_analytic_balance_report_view.xml
new file mode 100644 (file)
index 0000000..d4d5d65
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_balance_view" model="ir.ui.view">
+            <field name="name">Account Analytic Balance</field>
+            <field name="model">account.analytic.balance</field>
+            <field name="arch" type="xml">
+            <form string="Select Period">
+                <header>
+                    <button name="check_report" string="Print" type="object" class="oe_highlight"/>
+                    or
+                    <button string="Cancel" class="oe_link" special="cancel"/>
+                </header>
+                <group col="4">
+                    <field name="date1"/>
+                    <field name="date2"/>
+                    <newline/>
+                    <field name="empty_acc"/>
+                </group>
+            </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_balance" model="ir.actions.act_window">
+            <field name="name">Analytic Balance</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.balance</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_balance_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <record model="ir.values" id="account_analytic_balance_values">
+            <field name="model_id" ref="analytic.model_account_analytic_account" />
+            <field name="name">Account Analytic Balance</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_balance'))" />
+            <field name="key">action</field>
+            <field name="model">account.analytic.account</field>
+        </record>
+
+    </data>
+</openerp>
+
diff --git a/addons/analytic/wizard/account_analytic_chart.py b/addons/analytic/wizard/account_analytic_chart.py
new file mode 100644 (file)
index 0000000..410830a
--- /dev/null
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.osv import fields, osv
+
+class account_analytic_chart(osv.osv_memory):
+    _name = 'account.analytic.chart'
+    _description = 'Account Analytic Chart'
+
+    _columns = {
+        'from_date': fields.date('From'),
+        'to_date': fields.date('To'),
+    }
+
+    def analytic_account_chart_open_window(self, cr, uid, ids, context=None):
+        mod_obj = self.pool.get('ir.model.data')
+        act_obj = self.pool.get('ir.actions.act_window')
+        result_context = {}
+        if context is None:
+            context = {}
+        result = mod_obj.get_object_reference(cr, uid, 'analytic', 'action_account_analytic_account_tree2')
+        id = result and result[1] or False
+        result = act_obj.read(cr, uid, [id], context=context)[0]
+        data = self.read(cr, uid, ids, [])[0]
+        if data['from_date']:
+            result_context.update({'from_date': data['from_date']})
+        if data['to_date']:
+            result_context.update({'to_date': data['to_date']})
+        result['context'] = str(result_context)
+        return result
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_chart_view.xml b/addons/analytic/wizard/account_analytic_chart_view.xml
new file mode 100644 (file)
index 0000000..8cbab1d
--- /dev/null
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_chart_view" model="ir.ui.view">
+            <field name="name">Chart of Analytic Accounts</field>
+            <field name="model">account.analytic.chart</field>
+            <field name="arch" type="xml">
+                <form string="Analytic Account Charts">
+                    <group string="Select the Period for Analysis" col="4">
+                        <field name="from_date"/>
+                        <field name="to_date"/>
+                        <label string="(Keep empty to open the current situation)" colspan="4"/>
+                    </group>
+                    <footer>
+                        <button name="analytic_account_chart_open_window" string="Open Charts" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel"/>
+                    </footer>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_chart" model="ir.actions.act_window">
+            <field name="name">Chart of Analytic Accounts</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.chart</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_chart_view"/>
+            <field name="target">new</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report.py b/addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report.py
new file mode 100644 (file)
index 0000000..ab84af4
--- /dev/null
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import fields, osv
+
+
+class account_analytic_cost_ledger_journal_report(osv.osv_memory):
+    _name = 'account.analytic.cost.ledger.journal.report'
+    _description = 'Account Analytic Cost Ledger For Journal Report'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+        'journal': fields.many2many('account.analytic.journal', 'ledger_journal_rel', 'ledger_id', 'journal_id', 'Journals'),
+    }
+
+    _defaults = {
+        'date1': lambda *a: time.strftime('%Y-01-01'),
+        'date2': lambda *a: time.strftime('%Y-%m-%d')
+    }
+
+    def check_report(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        datas = {
+            'ids': context.get('active_ids', []),
+            'model': 'account.analytic.account',
+            'form': data
+        }
+
+        datas['form']['active_ids'] = context.get('active_ids', False)
+        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticcostledgerquantity', data=datas, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report_view.xml b/addons/analytic/wizard/account_analytic_cost_ledger_for_journal_report_view.xml
new file mode 100644 (file)
index 0000000..55b13e3
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_cost_ledger_journal_view" model="ir.ui.view">
+            <field name="name">Account Analytic Cost Ledger Journal</field>
+            <field name="model">account.analytic.cost.ledger.journal.report</field>
+            <field name="arch" type="xml">
+                <form string="Select period">
+                    <header>
+                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel"/>
+                    </header>
+                    <group string="Cost Ledger for Period" col="4">
+                        <field name="date1"/>
+                        <field name="date2"/>
+                        <field name="journal" colspan="4"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_cost_ledger_journal" model="ir.actions.act_window">
+            <field name="name">Cost Ledger (Only quantities)</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.cost.ledger.journal.report</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_cost_ledger_journal_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <record model="ir.values" id="account_analytic_cost_ledger_journal_values">
+            <field name="model_id" ref="analytic.model_account_analytic_account" />
+            <field name="name">Account Analytic Cost Ledger Journal</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost_ledger_journal'))" />
+            <field name="key">action</field>
+            <field name="model">account.analytic.account</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/wizard/account_analytic_cost_ledger_report.py b/addons/analytic/wizard/account_analytic_cost_ledger_report.py
new file mode 100644 (file)
index 0000000..978863f
--- /dev/null
@@ -0,0 +1,54 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import osv, fields
+
+
+class account_analytic_cost_ledger(osv.osv_memory):
+    _name = 'account.analytic.cost.ledger'
+    _description = 'Account Analytic Cost Ledger'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+    }
+
+    _defaults = {
+        'date1': lambda *a: time.strftime('%Y-01-01'),
+        'date2': lambda *a: time.strftime('%Y-%m-%d')
+    }
+
+    def check_report(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        datas = {
+            'ids': context.get('active_ids',[]),
+            'model': 'account.analytic.account',
+            'form': data
+        }
+
+        datas['form']['active_ids'] = context.get('active_ids', False)
+
+        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticcostledger', data=datas, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_cost_ledger_view.xml b/addons/analytic/wizard/account_analytic_cost_ledger_view.xml
new file mode 100644 (file)
index 0000000..25ab748
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_cost_view" model="ir.ui.view">
+            <field name="name">Account Analytic Check</field>
+            <field name="model">account.analytic.cost.ledger</field>
+            <field name="arch" type="xml">
+            <form string="Select Period">
+                <header>
+                     <button name="check_report" string="Print" type="object" class="oe_highlight"/>
+                     or
+                     <button string="Cancel" class="oe_link" special="cancel"/>
+                </header>
+                <group col="4">
+                    <field name="date1"/>
+                    <field name="date2"/>
+                </group>
+            </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_cost" model="ir.actions.act_window">
+            <field name="name">Cost Ledger</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.cost.ledger</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_cost_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <record model="ir.values" id="account_analytic_cost_values">
+            <field name="model_id" ref="analytic.model_account_analytic_account" />
+            <field name="name">Account Analytic Cost</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_cost'))" />
+            <field name="key">action</field>
+            <field name="model">account.analytic.account</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/wizard/account_analytic_inverted_balance_report.py b/addons/analytic/wizard/account_analytic_inverted_balance_report.py
new file mode 100644 (file)
index 0000000..9394696
--- /dev/null
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import fields, osv
+
+
+class account_analytic_inverted_balance(osv.osv_memory):
+    _name = 'account.analytic.inverted.balance'
+    _description = 'Account Analytic Inverted Balance'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+    }
+
+    _defaults = {
+        'date1': lambda *a: time.strftime('%Y-01-01'),
+        'date2': lambda *a: time.strftime('%Y-%m-%d')
+    }
+
+    def check_report(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        datas = {
+            'ids': context.get('active_ids', []),
+            'model': 'account.analytic.account',
+            'form': data
+        }
+        datas['form']['active_ids'] = context.get('active_ids', False)
+        return self.pool['report'].get_action(cr, uid, [], 'account.report_invertedanalyticbalance', data=datas, context=context)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_inverted_balance_report.xml b/addons/analytic/wizard/account_analytic_inverted_balance_report.xml
new file mode 100644 (file)
index 0000000..5188c01
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_invert_balance_view" model="ir.ui.view">
+            <field name="name">Account Analytic Inverted Balance</field>
+            <field name="model">account.analytic.inverted.balance</field>
+            <field name="arch" type="xml">
+                <form string="Select Period">
+                    <header>
+                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel"/>
+                    </header>
+                    <group col="4">
+                        <field name="date1"/>
+                        <field name="date2"/>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_invert_balance" model="ir.actions.act_window">
+            <field name="name">Inverted Analytic Balance</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.inverted.balance</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_invert_balance_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <record model="ir.values" id="account_analytic_invert_balance_values">
+            <field name="model_id" ref="analytic.model_account_analytic_account" />
+            <field name="name">Account Analytic Inverted Balance</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_invert_balance'))" />
+            <field name="key">action</field>
+            <field name="model">account.analytic.account</field>
+        </record>
+
+    </data>
+</openerp>
diff --git a/addons/analytic/wizard/account_analytic_journal_report.py b/addons/analytic/wizard/account_analytic_journal_report.py
new file mode 100644 (file)
index 0000000..d8790e8
--- /dev/null
@@ -0,0 +1,74 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from openerp.osv import fields, osv
+
+
+class account_analytic_journal_report(osv.osv_memory):
+    _name = 'account.analytic.journal.report'
+    _description = 'Account Analytic Journal'
+
+    _columns = {
+        'date1': fields.date('Start of period', required=True),
+        'date2': fields.date('End of period', required=True),
+        'analytic_account_journal_id': fields.many2many('account.analytic.journal', 'account_analytic_journal_name', 'journal_line_id', 'journal_print_id', 'Analytic Journals', required=True),
+    }
+
+    _defaults = {
+        'date1': lambda *a: time.strftime('%Y-01-01'),
+        'date2': lambda *a: time.strftime('%Y-%m-%d')
+    }
+
+    def check_report(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        data = self.read(cr, uid, ids)[0]
+        ids_list = []
+        if context.get('active_id',False):
+            ids_list.append(context.get('active_id',False))
+        else:
+            record = self.browse(cr,uid,ids[0],context=context)
+            for analytic_record in record.analytic_account_journal_id:
+                ids_list.append(analytic_record.id)
+        datas = {
+            'ids': ids_list,
+            'model': 'account.analytic.journal',
+            'form': data
+        }
+        context2 = context.copy()
+        context2['active_model'] = 'account.analytic.journal'
+        context2['active_ids'] = ids_list
+        return self.pool['report'].get_action(cr, uid, [], 'account.report_analyticjournal', data=datas, context=context2)
+
+    def default_get(self, cr, uid, fields, context=None):
+        if context is None:
+            context = {}
+        res = super(account_analytic_journal_report, self).default_get(cr, uid, fields, context=context)
+        if not context.has_key('active_ids'):
+            journal_ids = self.pool.get('account.analytic.journal').search(cr, uid, [], context=context)
+        else:
+            journal_ids = context.get('active_ids')
+        if 'analytic_account_journal_id' in fields:
+            res.update({'analytic_account_journal_id': journal_ids})
+        return res
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/analytic/wizard/account_analytic_journal_report_view.xml b/addons/analytic/wizard/account_analytic_journal_report_view.xml
new file mode 100644 (file)
index 0000000..3aaea71
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="account_analytic_journal_view" model="ir.ui.view">
+            <field name="name">Account Analytic Journal</field>
+            <field name="model">account.analytic.journal.report</field>
+            <field name="arch" type="xml">
+                <form string="Select Period">
+                    <group col="4">
+                        <field name="date1"/>
+                        <field name="date2"/>
+                        <field name="analytic_account_journal_id" widget="many2many_tags" class="oe_inline" required="1" colspan="4"/>
+                    </group>
+                    <footer>
+                        <button name="check_report" string="Print" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel"/>
+                    </footer>
+                </form>
+            </field>
+        </record>
+
+        <record id="action_account_analytic_journal" model="ir.actions.act_window">
+            <field name="name">Analytic Journal</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.analytic.journal.report</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="view_id" ref="account_analytic_journal_view"/>
+            <field name="target">new</field>
+        </record>
+
+        <record model="ir.values" id="account_analytic_journal_values">
+            <field name="model_id" ref="analytic.model_account_analytic_journal" />
+            <field name="name">Account Analytic Journal</field>
+            <field name="key2">client_print_multi</field>
+            <field name="value" eval="'ir.actions.act_window,' + str(ref('action_account_analytic_journal'))" />
+            <field name="key">action</field>
+            <field name="model">account.analytic.journal</field>
+        </record>
+        
+    </data>
+</openerp>
index 1cdfc5e..322119c 100644 (file)
@@ -140,7 +140,7 @@ class hr_expense_expense(osv.osv):
     def expense_confirm(self, cr, uid, ids, context=None):
         for expense in self.browse(cr, uid, ids):
             if not expense.line_ids:
-                raise osv.except_osv(_('Error!'),_('You cannot submit expense which has no expense line.'))
+                raise osv.except_osv(_('Error!'), _('You cannot submit expense which has no expense line.'))
             if expense.employee_id and expense.employee_id.parent_id.user_id:
                 self.message_subscribe_users(cr, uid, [expense.id], user_ids=[expense.employee_id.parent_id.user_id.id])
         return self.write(cr, uid, ids, {'state': 'confirm', 'date_confirm': time.strftime('%Y-%m-%d')}, context=context)
index 0e92e78..84df423 100644 (file)
@@ -45,7 +45,7 @@
         <record id="expenses_line0" model="hr.expense.line">
             <field name="name">Travel Expenses</field>
             <field name="date_value" eval="time.strftime('%Y-08-10')"/>
-            <field name="analytic_account" ref="account.analytic_consultancy"/>
+            <field name="analytic_account" ref="analytic.analytic_consultancy"/>
             <field name="expense_id" ref="expenses0"/>
             <field eval="200.0" name="unit_amount"/>
             <field name="uom_id" ref="product.product_uom_unit"/>
@@ -61,7 +61,7 @@
         <record id="travel_by_air_sep" model="hr.expense.line">
             <field name="name">Travel by Air</field>
             <field name="date_value" eval="time.strftime('%Y-09-03')"/>
-            <field name="analytic_account" ref="account.analytic_consultancy"/>
+            <field name="analytic_account" ref="analytic.analytic_consultancy"/>
             <field name="product_id" ref="air_ticket"/>
             <field name="expense_id" ref="sep_expenses"/>
             <field eval="700.0" name="unit_amount"/>
@@ -72,7 +72,7 @@
         <record id="hotel_bill_sep" model="hr.expense.line">
             <field name="name">Hotel Expenses - Thymbra</field>
             <field name="date_value" eval="time.strftime('%Y-09-20')"/>
-            <field name="analytic_account" ref="account.analytic_nebula"/>
+            <field name="analytic_account" ref="analytic.analytic_nebula"/>
             <field name="product_id" ref="hotel_rent"/>
             <field name="expense_id" ref="sep_expenses"/>
             <field eval="400.0" name="unit_amount"/>
@@ -83,7 +83,7 @@
         <record id="car_travel_sep" model="hr.expense.line">
                 <field name="name">Bruxelles - Paris</field>
                 <field name="date_value" eval="time.strftime('%Y-09-15')"/>
-                <field name="analytic_account" ref="account.analytic_nebula"/>
+                <field name="analytic_account" ref="analytic.analytic_nebula"/>
                 <field name="product_id" ref="car_travel"/>
                 <field name="expense_id" ref="sep_expenses"/>
                 <field eval="0.30" name="unit_amount"/>
index 2d72636..6d284d2 100644 (file)
@@ -67,8 +67,8 @@
                     <button name="validate" states="confirm" string="Approve" type="workflow" groups="base.group_hr_user" class="oe_highlight"/>
                     <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" groups="base.group_hr_user" />
                     <button name="draft" states="confirm,cancelled" string="Set to Draft" type="workflow" groups="base.group_hr_user" />
-                    <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice" class="oe_highlight"/>
-                    <button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice"/>
+                    <button name="done" states="accepted" string="Generate Accounting Entries" type="workflow" groups="account.group_account_invoice,account.group_account_user" class="oe_highlight"/>
+                    <button name="action_view_move" states="done" string="Open Accounting Entries" type="object" groups="account.group_account_invoice,account.group_account_user"/>
                     <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,done,paid" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
                 </header>
                 <sheet>
index c01bb4c..f8f2e99 100644 (file)
@@ -84,7 +84,6 @@
             <field name="act_from" ref="act_accepted"/>
             <field name="act_to" ref="act_done"/>
             <field name="signal">done</field>
-            <field name="group_id" ref="base.group_hr_user"/>
         </record>
 
         <record id="t10" model="workflow.transition">
index 361a3d8..a5b8602 100644 (file)
@@ -12,7 +12,7 @@ access_account_journal_user,account.journal.user,account.model_account_journal,b
 access_account_journal_employee,account.journal.employee,account.model_account_journal,base.group_user,1,0,0,0\r
 access_account_invoice_user,account.invoice.user,account.model_account_invoice,base.group_hr_user,1,1,1,1\r
 access_account_invoice_line_user,account.invoice.line.user,account.model_account_invoice_line,base.group_hr_user,1,1,1,1\r
-access_account_analytic_journal_user,account.ianalytic.journal.user,account.model_account_analytic_journal,base.group_hr_user,1,1,1,1\r
+access_account_analytic_journal_user,account.ianalytic.journal.user,analytic.model_account_analytic_journal,base.group_hr_user,1,1,1,1\r
 access_account_invoice_tax_user,account.invoice.tax.user,account.model_account_invoice_tax,base.group_hr_user,1,1,1,1\r
 access_account_period_user,account.period.user,account.model_account_period,base.group_hr_user,1,1,1,1\r
 access_account_fiscalyear_user,account.fiscalyear.user,account.model_account_fiscalyear,base.group_hr_user,1,1,1,1\r
index 2abea3a..bccd7aa 100644 (file)
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="journal_id" ref="analytic_journal"/>
         </record>
-        <record id="account.analytic_administratif" model="account.analytic.account">
+        <record id="analytic.analytic_administratif" model="account.analytic.account">
             <field name="use_timesheets">True</field>
         </record>
-         <record id="account.analytic_partners" model="account.analytic.account">
+         <record id="analytic.analytic_partners" model="account.analytic.account">
             <field name="use_timesheets">True</field>
         </record>
-        <record id="account.analytic_consultancy" model="account.analytic.account">
+        <record id="analytic.analytic_consultancy" model="account.analytic.account">
             <field name="use_timesheets">True</field>
         </record>
-        <record id="account.analytic_super_product_trainings" model="account.analytic.account">
+        <record id="analytic.analytic_super_product_trainings" model="account.analytic.account">
             <field name="use_timesheets">True</field>
         </record>
 
@@ -32,7 +32,7 @@
             <field eval="2.00" name="unit_amount"/>
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="product_uom_id" ref="product.product_uom_hour"/>
-            <field name="account_id" ref="account.analytic_administratif"></field>
+            <field name="account_id" ref="analytic.analytic_administratif"></field>
             <field eval="-60.00" name="amount"/>
             <field name="general_account_id" ref="account.a_expense"/>
             <field name="journal_id" ref="analytic_journal"/>
@@ -45,7 +45,7 @@
             <field eval="1.00" name="unit_amount"/>
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="product_uom_id" ref="product.product_uom_hour"/>
-            <field name="account_id" ref="account.analytic_administratif"></field>
+            <field name="account_id" ref="analytic.analytic_administratif"></field>
             <field eval="-30.00" name="amount"/>
             <field name="general_account_id" ref="account.a_expense"/>
             <field name="journal_id" ref="analytic_journal"/>
@@ -58,7 +58,7 @@
             <field eval="03.00" name="unit_amount"/>
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="product_uom_id" ref="product.product_uom_hour"/>
-            <field name="account_id" ref="account.analytic_administratif"></field>
+            <field name="account_id" ref="analytic.analytic_administratif"></field>
             <field eval="-90.00" name="amount"/>
             <field name="general_account_id" ref="account.a_expense"/>
             <field name="journal_id" ref="analytic_journal"/>
@@ -71,7 +71,7 @@
             <field eval="01.00" name="unit_amount"/>
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="product_uom_id" ref="product.product_uom_hour"/>
-            <field name="account_id" ref="account.analytic_administratif"></field>
+            <field name="account_id" ref="analytic.analytic_administratif"></field>
             <field eval="-30.00" name="amount"/>
             <field name="general_account_id" ref="account.a_expense"/>
             <field name="journal_id" ref="analytic_journal"/>
@@ -84,7 +84,7 @@
             <field eval="01.00" name="unit_amount"/>
             <field name="product_id" ref="product.product_product_consultant"/>
             <field name="product_uom_id" ref="product.product_uom_hour"/>
-            <field name="account_id" ref="account.analytic_administratif"></field>
+            <field name="account_id" ref="analytic.analytic_administratif"></field>
             <field eval="-30.00" name="amount"/>
             <field name="general_account_id" ref="account.a_expense"/>
             <field name="journal_id" ref="analytic_journal"/>
index 689d425..b489887 100644 (file)
@@ -3,10 +3,10 @@ access_hr_analytic_timesheet,hr.analytic.timesheet,model_hr_analytic_timesheet,b
 access_hr_analytic_timesheet_employee,hr.analytic.timesheet,model_hr_analytic_timesheet,base.group_user,1,1,1,1\r
 access_hr_account_analytic_line,account.account.analytic.line,account.model_account_analytic_line,base.group_hr_user,1,1,1,1\r
 access_hr_account_analytic_line_employee,account.account.analytic.line employee,account.model_account_analytic_line,base.group_user,1,1,1,1\r
-access_account_analytic_journal,account.account.analytic.journal,account.model_account_analytic_journal,base.group_hr_user,1,1,1,1\r
+access_account_analytic_journal,account.account.analytic.journal,analytic.model_account_analytic_journal,base.group_hr_user,1,1,1,1\r
 access_product_product_user,product.product user,product.model_product_product,base.group_hr_user,1,1,1,1\r
 access_product_template_hr_timesheet,product.template.hr.timesheet,product.model_product_template,base.group_hr_user,1,1,1,1\r
 access_product_uom_hr_timesheet,product.uom.hr.timesheet,product.model_product_uom,base.group_hr_user,1,1,1,1\r
 access_account_fiscalyear_hr_user,account.account.fiscalyear.user,account.model_account_fiscalyear,base.group_hr_user,1,1,1,1\r
 access_hr_analytic_timesheet_user,hr.analytic.timesheet.user,model_hr_analytic_timesheet,base.group_user,1,1,1,0\r
-access_account_analytic_journal_user,account.account.analytic.journal.user,account.model_account_analytic_journal,base.group_user,1,0,0,0\r
+access_account_analytic_journal_user,account.account.analytic.journal.user,analytic.model_account_analytic_journal,base.group_user,1,0,0,0\r
index 723e3a1..2c81912 100644 (file)
@@ -7,5 +7,5 @@
   !record {model: hr.analytic.timesheet, id: working_hours_coding, view: False}:
     user_id: base.user_demo
     date: !eval time.strftime('%Y-%m-%d')
-    account_id: account.analytic_administratif
+    account_id: analytic.analytic_administratif
     unit_amount: 1.0
index e518ba6..4f0cd11 100644 (file)
@@ -42,7 +42,7 @@
     import time
     from datetime import datetime, date, timedelta
     uid = ref('base.user_demo')
-    new_id = self.create(cr, uid, {'account_id': ref('account.analytic_nebula'),'analytic_amount': 7.0,
+    new_id = self.create(cr, uid, {'account_id': ref('analytic.analytic_nebula'),'analytic_amount': 7.0,
     'date': (datetime.now()+timedelta(1)).strftime('%Y-%m-%d %H:%M:%S') ,
     'date_start': time.strftime('%Y-%m-%d %H:%M:%S'), 'info': 'Create Yaml for hr module',
     'name': 'Gilles Gravie', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'present'})
@@ -55,7 +55,7 @@
     import time
     from datetime import datetime, date, timedelta
     uid = ref('base.user_demo')
-    new_id = self.create(cr, uid, {'account_id': ref('account.analytic_spark'), 'analytic_amount': 7.0,
+    new_id = self.create(cr, uid, {'account_id': ref('analytic.analytic_spark'), 'analytic_amount': 7.0,
     'date': (datetime.now()+timedelta(2)).strftime('%Y-%m-%d %H:%M:%S'),
     'date_start': time.strftime('%Y-%m-%d %H:%M:%S'), 'info': 'Create Yaml for hr module',
     'name': 'Gilles Gravie', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
index 0ebe16a..0795967 100644 (file)
             <field name="customer_name">Offered developments</field>
             <field name="factor">100.0</field>
         </record>
-        <record id="account.analytic_spark" model="account.analytic.account">
+        <record id="analytic.analytic_spark" model="account.analytic.account">
             <field name="to_invoice" ref="timesheet_invoice_factor1"/>
         </record>
-        <record id="account.analytic_nebula" model="account.analytic.account">
+        <record id="analytic.analytic_nebula" model="account.analytic.account">
             <field name="to_invoice" ref="timesheet_invoice_factor1"/>
         </record>
-        <record id="account.analytic_partners_camp_to_camp" model="account.analytic.account">
+        <record id="analytic.analytic_partners_camp_to_camp" model="account.analytic.account">
             <field name="to_invoice" ref="timesheet_invoice_factor1"/>
         </record>
     </data>
index bc06ed1..f1a1f6f 100644 (file)
@@ -80,9 +80,9 @@
         <record id="view_account_analytic_line_search_inherit" model="ir.ui.view">
             <field name="name">account.analytic.line.search.to_invoice</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_filter"/>
             <field name="arch" type="xml">
-                <xpath expr="//filter[@name='others']" position="after">
+                <xpath expr="//field[@name='date']" position="after">
                     <separator/>
                     <filter name="to_invoice" string="To Invoice" context="{'to_invoice': 1}" domain="[('invoice_id','=',False), ('to_invoice','&lt;&gt;',False)]" icon="terp-dolar"/>
                     <filter name="invoiced" string="Invoiced" domain="[('invoice_id','!=',False), ('to_invoice','&lt;&gt;',False)]" icon="terp-dolar"/> 
         <record id="view_account_analytic_line_tree_inherit" model="ir.ui.view">
             <field name="name">account.analytic.line.tree.to_invoice</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_tree"/>
             <field name="arch" type="xml">
                 <field name="account_id" position="after">
                     <field name="to_invoice"/>
           <record id="view_account_analytic_line_form_inherit" model="ir.ui.view">
             <field name="name">account.analytic.line.form.to_invoice</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_form"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_form"/>
             <field name="arch" type="xml">
                 <field name="amount" position="before">
                     <field name="to_invoice"/>
index aac83b7..6ac9baf 100644 (file)
@@ -35,7 +35,7 @@ class report_timesheet_line(osv.osv):
         'cost': fields.float('Cost', readonly=True),
         'product_id': fields.many2one('product.product', 'Product',readonly=True),
         'account_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True),
-        'general_account_id': fields.many2one('account.account', 'General Account', readonly=True),
+        'general_account_id': fields.many2one('account.account', 'Financial Account', readonly=True),
         'invoice_id': fields.many2one('account.invoice', 'Invoiced', readonly=True),
         'month': fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
                                   ('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month', readonly=True),
index 3a18573..2f9b4e2 100644 (file)
@@ -4,7 +4,7 @@
   I create an account analytic line.
 -
   !record {model: account.analytic.line, id: account_analytic_line_developyamlforhrmodule0 }:
-    account_id: account.analytic_agrolait
+    account_id: analytic.analytic_agrolait
     amount: -1.0
     general_account_id: account.a_expense
     journal_id: hr_timesheet.analytic_journal
 -
   Assign partner name and price list in analytic account.
 -
-  !record {model: account.analytic.account, id: account.analytic_agrolait}:
+  !record {model: account.analytic.account, id: analytic.analytic_agrolait}:
     partner_id: base.res_partner_2
     pricelist_id: product.list0
 -
   I open this account and make the state as pending.
 -
   !python {model: account.analytic.account}: |
-    self.set_open(cr, uid, [ref('account.analytic_agrolait')], None)
-    self.set_pending(cr, uid, [ref('account.analytic_agrolait')], None)
+    self.set_open(cr, uid, [ref('analytic.analytic_agrolait')], None)
+    self.set_pending(cr, uid, [ref('analytic.analytic_agrolait')], None)
 -
   I assign account on analytic account line.
 -
   !python {model: hr.analytic.timesheet}: |
-    self.on_change_account_id(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')], ref('account.analytic_agrolait'))
+    self.on_change_account_id(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')], ref('analytic.analytic_agrolait'))
 
 -
   I create a Tax Codes
index dac550a..15b243d 100644 (file)
@@ -4,7 +4,7 @@
   I create an account analytic line.
 -
   !record {model: account.analytic.line, id: account_analytic_line_developyamlforhrmodule1 }:
-    account_id: account.analytic_agrolait
+    account_id: analytic.analytic_agrolait
     amount: -1.0
     general_account_id: account.a_expense
     journal_id: hr_timesheet.analytic_journal
 -
   Assign partner name and price list in analytic account.
 -
-  !record {model: account.analytic.account, id: account.analytic_agrolait}:
+  !record {model: account.analytic.account, id: analytic.analytic_agrolait}:
     partner_id: base.res_partner_2
     pricelist_id: product.list0
 -
   I open this account and make the state as pending.
 -
   !python {model: account.analytic.account}: |
-    self.set_open(cr, uid, [ref('account.analytic_agrolait')], None)
-    self.set_pending(cr, uid, [ref('account.analytic_agrolait')], None)
+    self.set_open(cr, uid, [ref('analytic.analytic_agrolait')], None)
+    self.set_pending(cr, uid, [ref('analytic.analytic_agrolait')], None)
 -
   I assign account on analytic account line.
 -
   !python {model: hr.analytic.timesheet}: |
-    self.on_change_account_id(cr, uid, [ref('account_analytic_line_developyamlforhrmodule1')], ref('account.analytic_agrolait'))
+    self.on_change_account_id(cr, uid, [ref('account_analytic_line_developyamlforhrmodule1')], ref('analytic.analytic_agrolait'))
 -
   I create a Tax Code
 -
index c63133b..7b27387 100644 (file)
@@ -45,7 +45,7 @@
 -
   !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
     timesheet_ids:
-      - account_id: account.analytic_agrolait
+      - account_id: analytic.analytic_agrolait
         date: !eval time.strftime('%Y-%m-%d')
         name: 'Develop yaml for hr module'
         user_id: base.user_demo
@@ -74,7 +74,7 @@
 -
   !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
     timesheet_ids:
-      - account_id: account.analytic_agrolait
+      - account_id: analytic.analytic_agrolait
         date: !eval time.strftime('%Y-%m-%d')
         name: 'Develop yaml for hr module'
         unit_amount: 2.00
index 61f62fd..820bb5d 100644 (file)
@@ -20,7 +20,7 @@ access_stock_location_mrp_worker,stock.location mrp_worker,stock.model_stock_loc
 access_stock_move_mrp_worker,stock.move mrp_worker,stock.model_stock_move,mrp.group_mrp_user,1,1,1,0
 access_stock_picking_mrp_worker,stock.picking mrp_worker,stock.model_stock_picking,mrp.group_mrp_user,1,1,1,1
 access_stock_warehouse,stock.warehouse mrp_worker,stock.model_stock_warehouse,mrp.group_mrp_user,1,0,0,0
-access_account_analytic_journal_mrp_worker,account.analytic.journal mrp_worker,account.model_account_analytic_journal,mrp.group_mrp_user,1,0,0,0
+access_account_analytic_journal_mrp_worker,account.analytic.journal mrp_worker,analytic.model_account_analytic_journal,mrp.group_mrp_user,1,0,0,0
 access_account_account,account.account mrp_worker,account.model_account_account,mrp.group_mrp_user,1,0,0,0
 access_hr_timesheet_group_mrp_worker,resource.calendar mrp_manager,resource.model_resource_calendar,mrp.group_mrp_manager,1,1,1,1
 access_procurement_user,procurement.order.user,model_procurement_order,base.group_user,1,1,1,1
index 6287fd2..e2c3afe 100644 (file)
             <field name="sequence_id" ref="account.sequence_sale_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_in"/>
         </record>
             <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_in"/>
         </record>
             <field name="sequence_id" ref="account.sequence_bank_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_in"/>
         </record>
             <field name="sequence_id" ref="account.sequence_check_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_in"/>
         </record>
             <field name="sequence_id" ref="account.sequence_cash_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_in"/>
         </record>
             <field name="sequence_id" ref="account.sequence_sale_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_us"/>
         </record>
             <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_us"/>
         </record>
             <field name="sequence_id" ref="account.sequence_bank_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_us"/>
         </record>
             <field name="sequence_id" ref="account.sequence_check_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_us"/>
         </record>
             <field name="sequence_id" ref="account.sequence_cash_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_us"/>
         </record>
             <field name="sequence_id" ref="account.sequence_sale_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_be"/>
         </record>
             <field name="sequence_id" ref="account.sequence_refund_sales_journal"/>
             <field name="default_credit_account_id" ref="account.a_sale"/>
             <field name="default_debit_account_id" ref="account.a_sale"/>
-            <field name="analytic_journal_id" ref="account.cose_journal_sale"/>
+            <field name="analytic_journal_id" ref="analytic.cose_journal_sale"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_be"/>
         </record>
             <field name="sequence_id" ref="account.sequence_bank_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_be"/>
         </record>
             <field name="sequence_id" ref="account.sequence_check_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_be"/>
         </record>
             <field name="sequence_id" ref="account.sequence_cash_journal"/>
             <field name="default_debit_account_id" ref="account.cash"/>
             <field name="default_credit_account_id" ref="account.cash"/>
-            <field name="analytic_journal_id" ref="account.sit"/>
+            <field name="analytic_journal_id" ref="analytic.sit"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="company_id" ref="res_company_oerp_be"/>
         </record>
index e9a92a1..8709233 100644 (file)
@@ -166,14 +166,18 @@ class project(osv.osv):
     def unlink(self, cr, uid, ids, context=None):
         alias_ids = []
         mail_alias = self.pool.get('mail.alias')
+        analytic_account_to_delete = set()
         for proj in self.browse(cr, uid, ids, context=context):
             if proj.tasks:
                 raise osv.except_osv(_('Invalid Action!'),
                                      _('You cannot delete a project containing tasks. You can either delete all the project\'s tasks and then delete the project or simply deactivate the project.'))
             elif proj.alias_id:
                 alias_ids.append(proj.alias_id.id)
+            if proj.analytic_account_id and not proj.analytic_account_id.line_ids:
+                analytic_account_to_delete.add(proj.analytic_account_id.id)
         res = super(project, self).unlink(cr, uid, ids, context=context)
         mail_alias.unlink(cr, uid, alias_ids, context=context)
+        self.pool['account.analytic.account'].unlink(cr, uid, list(analytic_account_to_delete), context=context)
         return res
 
     def _get_attached_docs(self, cr, uid, ids, field_name, arg, context):
@@ -1221,12 +1225,12 @@ class account_analytic_account(osv.osv):
             self.project_create(cr, uid, account.id, vals_for_project, context=context)
         return super(account_analytic_account, self).write(cr, uid, ids, vals, context=context)
 
-    def unlink(self, cr, uid, ids, *args, **kwargs):
-        project_obj = self.pool.get('project.project')
-        analytic_ids = project_obj.search(cr, uid, [('analytic_account_id','in',ids)])
-        if analytic_ids:
-            raise osv.except_osv(_('Warning!'), _('Please delete the project linked with this account first.'))
-        return super(account_analytic_account, self).unlink(cr, uid, ids, *args, **kwargs)
+    def unlink(self, cr, uid, ids, context=None):
+        proj_ids = self.pool['project.project'].search(cr, uid, [('analytic_account_id', 'in', ids)])
+        has_tasks = self.pool['project.task'].search(cr, uid, [('project_id', 'in', proj_ids)], count=True, context=context)
+        if has_tasks:
+            raise osv.except_osv(_('Warning!'), _('Please remove existing tasks in the project linked to the accounts you want to delete.'))
+        return super(account_analytic_account, self).unlink(cr, uid, ids, context=context)
 
     def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=100):
         if args is None:
index 016313b..56a9799 100644 (file)
@@ -517,6 +517,13 @@ class account_analytic_account(osv.Model):
         res = super(account_analytic_account, self)._trigger_project_creation(cr, uid, vals, context=context)
         return res or (vals.get('use_issues') and not 'project_creation_in_progress' in context)
 
+    def unlink(self, cr, uid, ids, context=None):
+        proj_ids = self.pool['project.project'].search(cr, uid, [('analytic_account_id', 'in', ids)])
+        has_issues = self.pool['project.issue'].search(cr, uid, [('project_id', 'in', proj_ids)], count=True, context=context)
+        if has_issues:
+            raise osv.except_osv(_('Warning!'), _('Please remove existing issues in the project linked to the accounts you want to delete.'))
+        return super(account_analytic_account, self).unlink(cr, uid, ids, context=context)
+
 
 class project_project(osv.Model):
     _inherit = 'project.project'
index a524f4c..3273f1f 100644 (file)
@@ -4,12 +4,12 @@ access_hr_analytic_timesheet_project_user,hr_analytic_timesheet user,hr_timeshee
 access_hr_analytic_timesheet_project_manager,hr_analytic_timesheet manager,hr_timesheet_sheet.model_hr_analytic_timesheet,project.group_project_manager,1,0,0,0\r
 access_hr_timesheet_sheet_sheet_project_manager,hr_timesheet_sheet.sheet manager,hr_timesheet_sheet.model_hr_timesheet_sheet_sheet,project.group_project_manager,1,0,0,0\r
 access_hr_analytic_timesheet_project_manager,account.analytic.line.timesheet.project.manager,account.model_account_analytic_line,project.group_project_manager,1,1,1,1\r
-access_account_analytic_journal_project_manager,account.analytic.journal.project.manager,account.model_account_analytic_journal,project.group_project_manager,1,1,1,1\r
+access_account_analytic_journal_project_manager,account.analytic.journal.project.manager,analytic.model_account_analytic_journal,project.group_project_manager,1,1,1,1\r
 access_account_fiscalyear_project_manager,account.fiscalyear.project.manager,account.model_account_fiscalyear,project.group_project_manager,1,1,1,1\r
 access_hr_timesheet_invoice_factor_project_manager,hr_timesheet_invoice.factor.project.manager,hr_timesheet_invoice.model_hr_timesheet_invoice_factor,project.group_project_manager,1,1,1,1\r
 access_account_invoice_project_manager,account.invoice.project.manager,account.model_account_invoice,project.group_project_manager,1,1,1,1\r
 access_analytic_account_line_project_user,analytic_account_line_timesheet user,analytic.model_account_analytic_line,project.group_project_user,1,1,1,0\r
-access_account_analytic_journal_project_user,account.analytic.journal.project.user,account.model_account_analytic_journal,project.group_project_user,1,1,1,0\r
+access_account_analytic_journal_project_user,account.analytic.journal.project.user,analytic.model_account_analytic_journal,project.group_project_user,1,1,1,0\r
 access_account_fiscalyear_project_user,account.fiscalyear.project.user,account.model_account_fiscalyear,project.group_project_user,1,1,1,0\r
 access_hr_timesheet_invoice_factor_project_user,hr_timesheet_invoice.factor.project.user,hr_timesheet_invoice.model_hr_timesheet_invoice_factor,project.group_project_user,1,1,1,0\r
 access_account_invoice_project_user,account.invoice.project.user,account.model_account_invoice,project.group_project_user,1,1,1,0\r
index 368d772..f9a7163 100644 (file)
@@ -49,7 +49,7 @@
         <record id="view_account_analytic_line_search_account_inherit" model="ir.ui.view">
             <field name="name">account.analytic.line.search.account_id</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_filter"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_filter"/>
             <field name="arch" type="xml">
                  <field name="account_id" position="replace">
                      <field name="account_id" string="Analytic account/project"/>
@@ -59,7 +59,7 @@
         <record id="view_account_analytic_line_form_inherit_account_id" model="ir.ui.view">
             <field name="name">account.analytic.line.form.account_id</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_form"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_form"/>
             <field name="arch" type="xml">
                 <field name="account_id"  position="replace">
                    <field name="account_id" string="Analytic Account/Project" on_change="on_change_account_id(account_id)"/>
@@ -69,7 +69,7 @@
        <record id="view_account_analytic_line_tree_inherit_account_id" model="ir.ui.view">
             <field name="name">account.analytic.line.tree.account_id</field>
             <field name="model">account.analytic.line</field>
-            <field name="inherit_id" ref="account.view_account_analytic_line_tree"/>
+            <field name="inherit_id" ref="analytic.view_account_analytic_line_tree"/>
             <field name="arch" type="xml">
                 <field name="account_id"  position="replace">
                     <field name="account_id" string="Analytic account/project" on_change="on_change_account_id(account_id)"/>