From 0cca14a5d265443a79b3b235c209cdbc7cd38d27 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 14 Dec 2011 18:31:48 +0530 Subject: [PATCH 1/7] [IMP] account_followup:Optimize and Improve code bzr revid: aag@tinyerp.com-20111214130148-i3s68735ufnrfak5 --- addons/account/demo/account_invoice_demo.xml | 1 + .../test/account_followup.yml | 95 ++++--------------- 2 files changed, 18 insertions(+), 78 deletions(-) diff --git a/addons/account/demo/account_invoice_demo.xml b/addons/account/demo/account_invoice_demo.xml index 3a3c7751b89..6778fffd363 100644 --- a/addons/account/demo/account_invoice_demo.xml +++ b/addons/account/demo/account_invoice_demo.xml @@ -18,6 +18,7 @@ 2011-06-01 + diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index 2650a40a7ad..93a8db0c531 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -1,91 +1,23 @@ - - In order to test account followup module in OpenERP I create a FollowUp structure + In order to test account followup module in OpenERP, I perform action to change the state of invoice to "open". - - !record {model: res.company, id: ymltest_company_2}: - name: Acme 2 + !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - - !record {model: account_followup.followup, id: account_followup_followup_testfollowups0}: - description: First letter after 15 net days, 30 net days and 45 days end of month levels. - company_id: ymltest_company_2 - followup_line: - - delay: 15 - name: 'level 0: 15 days' - sequence: 0 - start: days - description: Dear %(partner_name)s,\n\nException made if there was a mistake - of ours, it seems that the following amount staid unpaid. Please, take appropriate - measures in order to carry out this payment in the next 1 days.\n\nWould your - payment have been carried out after this mail was sent, please consider the - present one as void. Do not hesitate to contact our accounting department at - (+32).10.68.94.39.\n\nBest Regards,\n - - delay: 30 - name: 'level1: 30 days' - sequence: 1 - start: days - description: Dear %(partner_name)s,\n\nException made if there was a mistake - of ours, it seems that the following amount staid unpaid. Please, take appropriate - measures in order to carry out this payment in the next 2 days.\n\nWould your - payment have been carried out after this mail was sent, please consider the - present one as void. Do not hesitate to contact our accounting department at - (+32).10.68.94.39.\n\nBest Regards,\n - - delay: 45 - name: 'level 2: 45 days' - sequence: 2 - start: days - description: Dear %(partner_name)s,\n\nException made if there was a mistake - of ours, it seems that the following amount staid unpaid. Please, take appropriate - measures in order to carry out this payment in the next 3 days.\n\nWould your - payment have been carried out after this mail was sent, please consider the - present one as void. Do not hesitate to contact our accounting department at - (+32).10.68.94.39.\n\nBest Regards, - name: My followups - -- - I create an invoice -- - !record {model: account.invoice, id: account_invoice_followup}: - account_id: account.a_recv - address_contact_id: base.res_partner_address_3000 - address_invoice_id: base.res_partner_address_3000 - company_id: base.main_company - currency_id: base.EUR - invoice_line: - - account_id: account.a_sale - name: '[PC1] Basic PC' - price_unit: 450.0 - quantity: 1.0 - product_id: product.product_product_pc1 - uos_id: product.product_uom_unit - journal_id: account.sales_journal - partner_id: base.res_partner_desertic_hispafuentes - reference_type: none - - -- - I change the state of the invoice using create button -- - !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_followup} - -- - I create a send followup record + I create a send followup record. - !record {model: account.followup.print, id: account_followup_print_0}: date: !eval time.strftime('%Y-%m-%d') - followup_id: account_followup_followup_testfollowups0 - - + followup_id: account_followup.demo_followup1 - - I Select Followup and clicked on Continue Button + I perform action to continue followup. - !python {model: account.followup.print}: | self.do_continue(cr, uid, [ref("account_followup_print_0")], {"lang": 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account_followup.account_followup_print_menu")], "tz": False, "active_id": ref("account_followup.account_followup_print_menu"), }) - - - - I select partners whom I want to send followups + I select partners whom I want to send followups. - !record {model: account.followup.print.all, id: account_followup_print_all_0}: email_body: 'Date : %(date)s\n\nDear %(partner_name)s,\n\nPlease find in attachment @@ -95,15 +27,22 @@ partner_ids: - base.res_partner_desertic_hispafuentes partner_lang: 1 - - - - I clicked on Print Follow Ups to print Followups reports + I perform action to print followups reports. - !python {model: account.followup.print.all}: | import time self.do_print(cr, uid, [ref("account_followup_print_all_0")], {"lang": 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account_followup.account_followup_print_menu")], - "tz": False, "date": time.strftime('%Y-%m-%d'), "followup_id": ref("account_followup_followup_testfollowups0"), "active_id": ref("account_followup.account_followup_print_menu"), + "tz": False, "date": time.strftime('%Y-%m-%d'), "followup_id": ref("account_followup.demo_followup1"), "active_id": ref("account_followup.account_followup_print_menu"), "company_id": ref('base.main_company'), }) +- + I perform action to send a mail to partner. +- + !python {model: account.followup.print.all}: | + import time + self.do_mail(cr, uid, [ref("account_followup_print_all_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account_followup.account_followup_print_menu")], + "tz": False, "date": time.strftime('%Y-%m-%d'), "followup_id": ref("account_followup.demo_followup1"), "active_id": ref("account_followup.account_followup_print_menu"), + }) From 805974d2977c319bffaec9d34f33cab48f8f072e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 14:39:48 +0530 Subject: [PATCH 2/7] [IMP] account_followup:Test to Print Follow Ups bzr revid: aag@tinyerp.com-20111215090948-rtomvfhs06cex1au --- addons/account_followup/__openerp__.py | 4 +++- addons/account_followup/test/account_followup_report.yml | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 addons/account_followup/test/account_followup_report.yml diff --git a/addons/account_followup/__openerp__.py b/addons/account_followup/__openerp__.py index 3fe52186f03..def1c0727ba 100644 --- a/addons/account_followup/__openerp__.py +++ b/addons/account_followup/__openerp__.py @@ -57,7 +57,9 @@ Note that if you want to check the followup level for a given partner/account en 'account_followup_data.xml', ], 'demo_xml': [], - 'test': ['test/account_followup.yml'], + 'test': ['test/account_followup.yml', + 'test/account_followup_report.yml'], + 'installable': True, 'active': False, 'certificate': '0072481076453', diff --git a/addons/account_followup/test/account_followup_report.yml b/addons/account_followup/test/account_followup_report.yml new file mode 100644 index 00000000000..d1b3bbbd0f0 --- /dev/null +++ b/addons/account_followup/test/account_followup_report.yml @@ -0,0 +1,9 @@ +- + In order to test the report i will print a followup report. +- + !python {model: account.followup.print.all}: | + import time + ctx = {'form_view_ref':'account_followup.view_account_followup_print_all', 'followup_id': ref('account_followup.demo_followup1'),'date': time.strftime('%Y-%m-%d'),'model': 'account_followup.followup','active_ids':[ref('account_followup_print_all_0')], 'company_id':ref('base.main_company')} + data_dict = {'email_conf': 1} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_account_followup_print_all', context=ctx, wiz_data=data_dict,wiz_buttons=["Print Follow Ups"], our_module='account_followup') From 9f6a350e59c037f4428f87be47f1eb26d54f86c5 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 14:19:21 +0530 Subject: [PATCH 3/7] [IMP] account_followup:Optimize code bzr revid: aag@tinyerp.com-20111219084921-k1bk2s1dca6vxbh3 --- addons/account_followup/test/account_followup.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index 93a8db0c531..b55a574c3e6 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -9,7 +9,7 @@ date: !eval time.strftime('%Y-%m-%d') followup_id: account_followup.demo_followup1 - - I perform action to continue followup. + I continue followup. - !python {model: account.followup.print}: | self.do_continue(cr, uid, [ref("account_followup_print_0")], {"lang": 'en_US', @@ -28,17 +28,7 @@ - base.res_partner_desertic_hispafuentes partner_lang: 1 - - I perform action to print followups reports. -- - !python {model: account.followup.print.all}: | - import time - self.do_print(cr, uid, [ref("account_followup_print_all_0")], {"lang": 'en_US', - "active_model": "ir.ui.menu", "active_ids": [ref("account_followup.account_followup_print_menu")], - "tz": False, "date": time.strftime('%Y-%m-%d'), "followup_id": ref("account_followup.demo_followup1"), "active_id": ref("account_followup.account_followup_print_menu"), - "company_id": ref('base.main_company'), - }) -- - I perform action to send a mail to partner. + I send a mail to partner. - !python {model: account.followup.print.all}: | import time From 13de087955855a2bbcd91a2e70bda85939e1343e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 17:00:33 +0530 Subject: [PATCH 4/7] [IMP] account_followup:Improve the test statement bzr revid: aag@tinyerp.com-20111219113033-010wkkqjteafg7xl --- addons/account_followup/test/account_followup.yml | 8 +++----- addons/account_followup/test/account_followup_report.yml | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index b55a574c3e6..4f57605a950 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -1,15 +1,13 @@ - - In order to test account followup module in OpenERP, I perform action to change the state of invoice to "open". + In order to test account followup module in OpenERP, I change the state of invoice to "open". - !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} -- - I create a send followup record. - !record {model: account.followup.print, id: account_followup_print_0}: date: !eval time.strftime('%Y-%m-%d') followup_id: account_followup.demo_followup1 - - I continue followup. + I select the followup to send it to the partner. - !python {model: account.followup.print}: | self.do_continue(cr, uid, [ref("account_followup_print_0")], {"lang": 'en_US', @@ -28,7 +26,7 @@ - base.res_partner_desertic_hispafuentes partner_lang: 1 - - I send a mail to partner. + I send a followup mail to partner. - !python {model: account.followup.print.all}: | import time diff --git a/addons/account_followup/test/account_followup_report.yml b/addons/account_followup/test/account_followup_report.yml index d1b3bbbd0f0..e46d97704be 100644 --- a/addons/account_followup/test/account_followup_report.yml +++ b/addons/account_followup/test/account_followup_report.yml @@ -1,5 +1,5 @@ - - In order to test the report i will print a followup report. + In order to test the report i print a followup report. - !python {model: account.followup.print.all}: | import time From a694e09803cf1ff682a62cbacb532d601cb4ba6c Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 17:46:33 +0530 Subject: [PATCH 5/7] [IMP] account_followup:Optimize code bzr revid: aag@tinyerp.com-20111219121633-0b76kfco9h14idej --- addons/account_followup/test/account_followup.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index 4f57605a950..d799697c869 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -4,8 +4,7 @@ !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - !record {model: account.followup.print, id: account_followup_print_0}: - date: !eval time.strftime('%Y-%m-%d') - followup_id: account_followup.demo_followup1 + {} - I select the followup to send it to the partner. - From 586251083411a9b34d85454ad0905906f2a649b7 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 17:59:32 +0530 Subject: [PATCH 6/7] [IMP] account_followup:Optimize code bzr revid: aag@tinyerp.com-20111219122932-qo0wmgdiapkfg3tl --- addons/account/demo/account_invoice_demo.xml | 1 - addons/account_followup/test/account_followup.yml | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/account/demo/account_invoice_demo.xml b/addons/account/demo/account_invoice_demo.xml index 6778fffd363..3a3c7751b89 100644 --- a/addons/account/demo/account_invoice_demo.xml +++ b/addons/account/demo/account_invoice_demo.xml @@ -18,7 +18,6 @@ 2011-06-01 - diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index d799697c869..749cf473d39 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -1,5 +1,8 @@ - In order to test account followup module in OpenERP, I change the state of invoice to "open". +- + !python {model: account.invoice}: | + self.write(cr, uid, [ref("account.demo_invoice_0")], {"check_total": 14.0}) - !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - From 22087c3bfe06b30da526835593effac73fcbb1d5 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Mon, 19 Dec 2011 18:48:23 +0530 Subject: [PATCH 7/7] [IMP] account_followup: Improved ymls. bzr revid: uco@tinyerp.com-20111219131823-1l8yszpp7fq5p3y2 --- addons/account_followup/test/account_followup.yml | 4 ++-- addons/account_followup/test/account_followup_report.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account_followup/test/account_followup.yml b/addons/account_followup/test/account_followup.yml index 749cf473d39..86eabb4d994 100644 --- a/addons/account_followup/test/account_followup.yml +++ b/addons/account_followup/test/account_followup.yml @@ -1,8 +1,8 @@ - In order to test account followup module in OpenERP, I change the state of invoice to "open". - - !python {model: account.invoice}: | - self.write(cr, uid, [ref("account.demo_invoice_0")], {"check_total": 14.0}) + !record {model: account.invoice, id: account.demo_invoice_0}: + check_total: 14.0 - !workflow {model: account.invoice, action: invoice_open, ref: account.demo_invoice_0} - diff --git a/addons/account_followup/test/account_followup_report.yml b/addons/account_followup/test/account_followup_report.yml index e46d97704be..e63d61030bd 100644 --- a/addons/account_followup/test/account_followup_report.yml +++ b/addons/account_followup/test/account_followup_report.yml @@ -1,5 +1,5 @@ - - In order to test the report i print a followup report. + In order to test the report I print followup report. - !python {model: account.followup.print.all}: | import time