openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #02720
[Merge] lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3
Purnendu Singh (OpenERP) has proposed merging lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
Requested reviews:
OpenERP R&D Team (openerp-dev)
Related bugs:
#568537 The __compute method of account_account needs optmization to improve Accounting Performance!
https://bugs.launchpad.net/bugs/568537
#588776 Error when closing fiscal year
https://bugs.launchpad.net/bugs/588776
#686508 Not able to validate sales receipt
https://bugs.launchpad.net/bugs/686508
#686513 Not able to validate supplier vouchers
https://bugs.launchpad.net/bugs/686513
#691218 add an employee to a department
https://bugs.launchpad.net/bugs/691218
#692139 Account Journal onchange_type method context undefined error
https://bugs.launchpad.net/bugs/692139
#692962 In hr contract, shouldn't be able to enter an end date lower than a start date
https://bugs.launchpad.net/bugs/692962
#693476 [6.0] sale manager dashboard - "Sales by Customer" - incomplete
https://bugs.launchpad.net/bugs/693476
#693810 [RC1]Pay button when you pay directly in Sales receipt form
https://bugs.launchpad.net/bugs/693810
#693833 [6.0] performance issues - stock_move, account_move_lines and others
https://bugs.launchpad.net/bugs/693833
#694937 [6.0] account entry analysis - unreconciled does not filter
https://bugs.launchpad.net/bugs/694937
#695439 membership: can't open members via GTK client
https://bugs.launchpad.net/bugs/695439
#697080 Payment Invoice is not considering the currency in Invoice
https://bugs.launchpad.net/bugs/697080
#697207 Bug when sending followups without specifying any email address
https://bugs.launchpad.net/bugs/697207
#697714 Unclear warning on cancel opening entries
https://bugs.launchpad.net/bugs/697714
#699809 [6.0 and 5.0] Installing account_analytic_analysis you have a maximu of 2147 analytic accounts
https://bugs.launchpad.net/bugs/699809
#701895 [Trunk] account_analytic_plan break the creation of inovice from analytic lines
https://bugs.launchpad.net/bugs/701895
#702027 [trunk]hr_payroll minor typos
https://bugs.launchpad.net/bugs/702027
#705043 Selection of multi-company products account in invoices lines
https://bugs.launchpad.net/bugs/705043
For more details, see:
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2/+merge/47791
Hello sir,
accounting: improve the generation of journals and periods
backlog id: 991
Thanks
PSI
--
https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2/+merge/47791
Your team OpenERP R&D Team is requested to review the proposed merge of lp:~openerp-commiter/openobject-addons/trunk-dev-addons3-psi2 into lp:~openerp-dev/openobject-addons/trunk-dev-addons3.
=== modified file 'account/account.py'
--- account/account.py 2011-01-25 07:27:43 +0000
+++ account/account.py 2011-01-28 11:22:58 +0000
@@ -805,19 +805,28 @@
(_check_fiscal_year, 'Error! You cannot define overlapping fiscal years',['date_start', 'date_stop'])
]
- def create_period3(self,cr, uid, ids, context=None):
+ def create_period3(self, cr, uid, ids, context=None):
return self.create_period(cr, uid, ids, context, 3)
- def create_period(self,cr, uid, ids, context=None, interval=1):
+ def create_period(self, cr, uid, ids, context=None, interval=1):
+ period_obj = self.pool.get('account.period')
for fy in self.browse(cr, uid, ids, context=context):
ds = datetime.strptime(fy.date_start, '%Y-%m-%d')
- while ds.strftime('%Y-%m-%d')<fy.date_stop:
+ period_obj.create(cr, uid, {
+ 'name': 'Opening Period',
+ 'code': ds.strftime('00/%Y'),
+ 'date_start': ds + relativedelta(years=-1, days=-1),
+ 'date_stop': ds + relativedelta(years=-1),
+ 'special': True,
+ 'fiscalyear_id': fy.id,
+ })
+ while ds.strftime('%Y-%m-%d') < fy.date_stop:
de = ds + relativedelta(months=interval, days=-1)
- if de.strftime('%Y-%m-%d')>fy.date_stop:
+ if de.strftime('%Y-%m-%d') > fy.date_stop:
de = datetime.strptime(fy.date_stop, '%Y-%m-%d')
- self.pool.get('account.period').create(cr, uid, {
+ period_obj.create(cr, uid, {
'name': ds.strftime('%m/%Y'),
'code': ds.strftime('%m/%Y'),
'date_start': ds.strftime('%Y-%m-%d'),
@@ -2449,6 +2458,8 @@
'property_account_expense': fields.many2one('account.account.template','Expense Account on Product Template'),
'property_account_income': fields.many2one('account.account.template','Income Account on Product Template'),
'property_reserve_and_surplus_account': fields.many2one('account.account.template', 'Reserve and Profit/Loss Account', domain=[('type', '=', 'payable')], help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss: Amount will be deducted.), Which is calculated from Profilt & Loss Report'),
+ 'property_account_income_opening': fields.many2one('account.account.template','Opening Entries Income Account'),
+ 'property_account_expense_opening': fields.many2one('account.account.template','Opening Entries Expense Account'),
}
account_chart_template()
@@ -2681,6 +2692,7 @@
obj_data = self.pool.get('ir.model.data')
analytic_journal_obj = self.pool.get('account.analytic.journal')
obj_tax_code = self.pool.get('account.tax.code')
+ obj_tax_code_template = self.pool.get('account.tax.code.template')
# Creating Account
obj_acc_root = obj_multi.chart_template_id.account_root_id
tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id
@@ -2693,9 +2705,9 @@
todo_dict = {}
#create all the tax code
- children_tax_code_template = self.pool.get('account.tax.code.template').search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
+ children_tax_code_template = obj_tax_code_template.search(cr, uid, [('parent_id','child_of',[tax_code_root_id])], order='id')
children_tax_code_template.sort()
- for tax_code_template in self.pool.get('account.tax.code.template').browse(cr, uid, children_tax_code_template, context=context):
+ for tax_code_template in obj_tax_code_template.browse(cr, uid, children_tax_code_template, context=context):
vals={
'name': (tax_code_root_id == tax_code_template.id) and obj_multi.company_id.name or tax_code_template.name,
'code': tax_code_template.code,
@@ -2806,11 +2818,15 @@
seq_id_purchase_refund = obj_sequence.search(cr, uid, [('name','=','Purchase Refund Journal')])
if seq_id_purchase_refund:
seq_id_purchase_refund = seq_id_purchase_refund[0]
+ seq_id_opening = obj_sequence.search(cr, uid, [('name','=','Opening Entries Journal')])
+ if seq_id_opening:
+ seq_id_opening = seq_id_opening[0]
else:
seq_id_sale = seq_id
seq_id_purchase = seq_id
seq_id_sale_refund = seq_id
seq_id_purchase_refund = seq_id
+ seq_id_opening = seq_id
vals_journal['view_id'] = view_id
@@ -2903,6 +2919,21 @@
# })
obj_journal.create(cr, uid, vals_journal, context=context)
+ # Opening Entries Journal
+ if obj_multi.chart_template_id.property_account_income_opening and obj_multi.chart_template_id.property_account_expense_opening:
+ vals_journal = {
+ 'view_id': view_id,
+ 'name': _('Opening Entries Journal'),
+ 'type': 'situation',
+ 'code': _('TOEJ'),
+ 'sequence_id': seq_id_opening,
+ 'analytic_journal_id': analitical_journal_purchase,
+ 'company_id': company_id,
+ 'default_credit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_income_opening.id],
+ 'default_debit_account_id': acc_template_ref[obj_multi.chart_template_id.property_account_expense_opening.id]
+ }
+ obj_journal.create(cr, uid, vals_journal, context=context)
+
# Bank Journals
data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')])
data = obj_data.browse(cr, uid, data_id[0], context=context)
=== modified file 'account/account_view.xml'
--- account/account_view.xml 2011-01-24 16:13:46 +0000
+++ account/account_view.xml 2011-01-28 11:22:58 +0000
@@ -2150,6 +2150,8 @@
<field name="property_account_income_categ" domain="[('id', 'child_of', [account_root_id])]" />
<field name="property_account_expense" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_account_income" domain="[('id', 'child_of', [account_root_id])]"/>
+ <field name="property_account_income_opening" domain="[('id', 'child_of', [account_root_id])]"/>
+ <field name="property_account_expense_opening" domain="[('id', 'child_of', [account_root_id])]"/>
<field name="property_reserve_and_surplus_account" />
</group>
</form>
=== modified file 'account/configurable_account_chart.xml'
--- account/configurable_account_chart.xml 2011-01-14 00:11:01 +0000
+++ account/configurable_account_chart.xml 2011-01-28 11:22:58 +0000
@@ -191,6 +191,14 @@
<field name="user_type" ref="conf_account_type_asset"/>
</record>
+ <record id="conf_o_income" model="account.account.template">
+ <field name="code">1106</field>
+ <field name="name">Opening Income Account</field>
+ <field ref="conf_cas" name="parent_id"/>
+ <field name="type">closed</field>
+ <field name="user_type" ref="conf_account_type_income"/>
+ </record>
+
<record id="conf_cli" model="account.account.template">
<field name="code">111</field>
<field name="name">Current Liabilities</field>
@@ -225,6 +233,13 @@
<field name="user_type" ref="conf_account_type_liability"/>
</record>
+ <record id="conf_o_expense" model="account.account.template">
+ <field name="code">1114</field>
+ <field name="name">Opening Expense Account</field>
+ <field ref="conf_cli" name="parent_id"/>
+ <field name="type">closed</field>
+ <field name="user_type" ref="conf_account_type_expense"/>
+ </record>
<!-- Profit and Loss -->
@@ -431,6 +446,8 @@
<field name="property_account_payable" ref="conf_a_pay"/>
<field name="property_account_expense_categ" ref="conf_a_expense"/>
<field name="property_account_income_categ" ref="conf_a_sale"/>
+ <field name="property_account_income_opening" ref="conf_o_income"/>
+ <field name="property_account_expense_opening" ref="conf_o_expense"/>
<field name="property_reserve_and_surplus_account" ref="conf_a_reserve_and_surplus"/>
</record>
=== modified file 'account/demo/account_minimal.xml'
--- account/demo/account_minimal.xml 2011-01-14 00:11:01 +0000
+++ account/demo/account_minimal.xml 2011-01-28 11:22:58 +0000
@@ -421,6 +421,15 @@
<field name="analytic_journal_id" ref="sit"/>
<field name="user_id" ref="base.user_root"/>
</record>
+ <record id="miscellaneous_journal" model="account.journal">
+ <field name="name">Miscellaneous Journal - (test)</field>
+ <field name="code">TMIS</field>
+ <field name="type">general</field>
+ <field name="view_id" ref="account_journal_bank_view"/>
+ <field name="sequence_id" ref="sequence_journal"/>
+ <field name="analytic_journal_id" ref="sit"/>
+ <field name="user_id" ref="base.user_root"/>
+ </record>
<!--
Product income and expense accounts, default parameters
=== modified file 'account/installer.py'
--- account/installer.py 2011-01-24 16:13:46 +0000
+++ account/installer.py 2011-01-28 11:22:58 +0000
@@ -416,11 +416,20 @@
'company_id': company_id.id
}
seq_id_purchase_refund = obj_sequence.create(cr, uid, seq_refund_purchase, context=context)
+ seq_opening_journal = {
+ 'name': 'Opening Entries Journal',
+ 'code': 'account.journal',
+ 'prefix': 'TOEJ/%(year)s/',
+ 'padding': 3,
+ 'company_id': company_id.id
+ }
+ seq_id_opening = obj_sequence.create(cr, uid, seq_opening_journal, context=context)
else:
seq_id_sale = seq_id
seq_id_purchase = seq_id
seq_id_sale_refund = seq_id
seq_id_purchase_refund = seq_id
+ seq_id_opening = seq_id
vals_journal['view_id'] = view_id
@@ -508,6 +517,21 @@
})
obj_journal.create(cr, uid, vals_journal, context=context)
+ # Opening Entries Journal
+ if obj_multi.property_account_income_opening and obj_multi.property_account_expense_opening:
+ vals_journal = {
+ 'view_id': view_id,
+ 'name': _('Opening Entries Journal'),
+ 'type': 'situation',
+ 'code': _('TOEJ'),
+ 'sequence_id': seq_id_opening,
+ 'analytic_journal_id': analitical_journal_purchase,
+ 'company_id': company_id.id,
+ 'default_credit_account_id': acc_template_ref[obj_multi.property_account_income_opening.id],
+ 'default_debit_account_id': acc_template_ref[obj_multi.property_account_expense_opening.id]
+ }
+ obj_journal.create(cr, uid, vals_journal, context=context)
+
# Bank Journals
view_id_cash = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal View')], context=context)[0] #TOFIX: Why put fixed name ?
view_id_cur = obj_acc_journal_view.search(cr, uid, [('name', '=', 'Bank/Cash Journal (Multi-Currency) View')], context=context)[0] #TOFIX: why put fixed name?