From d36a90b39e264be4716ce81087ab4a0fe08c4c2b Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 15 Oct 2013 14:10:15 +0200 Subject: [PATCH 1/3] [FIX] account: correctly compute debit/credit for partner including previous moves reported to new fiscal year lp bug: https://launchpad.net/bugs/1219381 fixed bzr revid: mat@openerp.com-20131015121015-jdwkzv9tjicg2m1u --- addons/account/partner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/account/partner.py b/addons/account/partner.py index 4914a17dd2b..64896338476 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -116,7 +116,8 @@ class res_partner(osv.osv): LEFT JOIN account_account a ON (l.account_id=a.id) WHERE a.type IN ('receivable','payable') AND l.partner_id IN %s - AND l.reconcile_id IS NULL + AND (l.reconcile_id IS NULL OR + reconcile_id in (SELECT id FROM account_move_reconcile WHERE opening_reconciliation is TRUE)) AND """ + query + """ GROUP BY l.partner_id, a.type """, From afaa1159ad1ee8dda0aee373e0fd64f34380e348 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 15 Oct 2013 16:14:08 +0200 Subject: [PATCH 2/3] [ADD] account: test for added check bzr revid: mat@openerp.com-20131015141408-rpdp110btoc0wll3 --- addons/account/__openerp__.py | 3 +- .../account/test/account_fiscalyear_close.yml | 43 +++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 43aaa2f58c1..18277dbb4dd 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -153,12 +153,11 @@ for a particular financial year and for preparation of vouchers there is a modul 'test/account_period_close.yml', 'test/account_use_model.yml', 'test/account_validate_account_move.yml', - 'test/account_fiscalyear_close.yml', #'test/account_bank_statement.yml', #'test/account_cash_statement.yml', 'test/test_edi_invoice.yml', 'test/account_report.yml', - 'test/account_fiscalyear_close_state.yml', #last test, as it will definitively close the demo fiscalyear + 'test/account_fiscalyear_close.yml', #last test, as it will definitively close the demo fiscalyear ], 'installable': True, 'auto_install': False, diff --git a/addons/account/test/account_fiscalyear_close.yml b/addons/account/test/account_fiscalyear_close.yml index 1c3547ccefd..40d1b1a6a7b 100644 --- a/addons/account/test/account_fiscalyear_close.yml +++ b/addons/account/test/account_fiscalyear_close.yml @@ -17,7 +17,23 @@ fiscalyear_id: account_fiscalyear_fiscalyear0 name: !eval "'OP %s' %(datetime.now().year+1)" special: 1 - +- + I create a new account invoice a the partner in current fiscalyear +- + !record {model: account.invoice, id: account_invoice_current1}: + partner_id: base.res_partner_2 + invoice_line: + - partner_id: base.res_partner_2 + quantity: 1.0 + price_unit: 15.00 + name: Bying stuff +- + I validate it the invoice +- + !python {model: account.invoice}: | + import netsvc + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'account.invoice', ref('account.account_invoice_current1'), 'invoice_open', cr) - I made modification in journal so it can move entries - @@ -41,9 +57,30 @@ report_name: End of Fiscal Year Entry - I clicked on create Button - - !python {model: account.fiscalyear.close}: | self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")], - "tz": False, "active_id": ref("account.menu_wizard_fy_close"), }) \ No newline at end of file + "tz": False, "active_id": ref("account.menu_wizard_fy_close"), }) +- + I close the previous fiscalyear +- + !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}: + fy_id: data_fiscalyear +- + I clicked on Close States Button to close fiscalyear +- + !python {model: account.fiscalyear.close.state}: | + self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")], + "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), }) +- + I check that the fiscalyear state is now "Done" +- + !assert {model: account.fiscalyear, id: data_fiscalyear, string: Fiscal Year is in Done state}: + - state == 'done' +- + I check that the past accounts are taken into account in partner credit +- + !assert {model: res.partner, id: base.res_partner_2}: + - credit == 15.0, "Total Receivable does not takes unreconciled previous moves" From 345f6739ebc5e5847175a9ab944c695c6b0d2fe3 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 15 Oct 2013 16:14:53 +0200 Subject: [PATCH 3/3] [REM] account: unused test (merged with account_fiscalyear_close.yml) bzr revid: mat@openerp.com-20131015141453-dbznqlqfo4beglz9 --- .../test/account_fiscalyear_close_state.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 addons/account/test/account_fiscalyear_close_state.yml diff --git a/addons/account/test/account_fiscalyear_close_state.yml b/addons/account/test/account_fiscalyear_close_state.yml deleted file mode 100644 index 18c7dd570ed..00000000000 --- a/addons/account/test/account_fiscalyear_close_state.yml +++ /dev/null @@ -1,19 +0,0 @@ -- - I run the Close a Fiscalyear wizard to close the demo fiscalyear -- - !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}: - fy_id: data_fiscalyear -- - I clicked on Close States Button to close fiscalyear - -- - !python {model: account.fiscalyear.close.state}: | - self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US', - "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")], - "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), }) -- - I check that the fiscalyear state is now "Done" -- - !assert {model: account.fiscalyear, id: data_fiscalyear, string: Fiscal Year is in Done state}: - - state == 'done' -