From 721b855e34a998fa454434e82aeae2f49da16d9f Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 21 Nov 2011 18:57:35 +0530 Subject: [PATCH 002/113] [IMP] updated openerp descriptor for the adding test case bzr revid: jam@tinyerp.com-20111121132735-lw9gfa02gu5p5y6a --- addons/resource/__openerp__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index f1e020215a6..92091221d85 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -45,6 +45,7 @@ It also manages the leaves of every resource. ], 'demo_xml': ['resource_demo.xml' ], + 'test': [],#TODO: Add Resource test cases 'installable': True, 'active': False, 'certificate': '00746371192190459469', From f33ac6c84a3e77c098337b104da91b39c33d586e Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 22 Nov 2011 12:34:40 +0530 Subject: [PATCH 005/113] [ADD] Added Demo data for the on change bzr revid: jam@tinyerp.com-20111122070440-2o9sbpud5zxe0eek --- addons/resource/__openerp__.py | 2 +- addons/resource/resource_demo.xml | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 92091221d85..f6cdb178e83 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -45,7 +45,7 @@ It also manages the leaves of every resource. ], 'demo_xml': ['resource_demo.xml' ], - 'test': [],#TODO: Add Resource test cases + 'test': ['test/on_chnage_resource.yml'],#TODO: Add Resource test cases 'installable': True, 'active': False, 'certificate': '00746371192190459469', diff --git a/addons/resource/resource_demo.xml b/addons/resource/resource_demo.xml index 2d1b6622e07..989a029f93f 100644 --- a/addons/resource/resource_demo.xml +++ b/addons/resource/resource_demo.xml @@ -79,5 +79,30 @@ + + + + Demo Resource + + + user + + + + Morning 2 Hours On Leave + + + + + + + + Half Day Seak Leave + + + + + + From aaf8819e97452f6ea1938bae34e7aeccbee50ae9 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 22 Nov 2011 12:35:56 +0530 Subject: [PATCH 006/113] [ADD] Added the On Change Resource YAML for the Resource Leave bzr revid: jam@tinyerp.com-20111122070556-hxp192kapzurhk5b --- addons/resource/test/on_chnage_resource.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 addons/resource/test/on_chnage_resource.yml diff --git a/addons/resource/test/on_chnage_resource.yml b/addons/resource/test/on_chnage_resource.yml new file mode 100644 index 00000000000..429e9328939 --- /dev/null +++ b/addons/resource/test/on_chnage_resource.yml @@ -0,0 +1,6 @@ +- + I changing the Working Calendarof 'Demo Resource' +- + !record {model: resource.calendar.leaves, id: resource_calendar_leaves_demoleave1}: + calendar_id: resource.timesheet_group1 + resource_id: resource.resource_resource_demorsource From 545889f2bb05178975384e090f70dc8818f647e4 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 22 Nov 2011 12:37:08 +0530 Subject: [PATCH 007/113] [FIX] yaml typo bzr revid: jam@tinyerp.com-20111122070708-qwixijixoght6qvn --- addons/resource/test/on_chnage_resource.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/resource/test/on_chnage_resource.yml b/addons/resource/test/on_chnage_resource.yml index 429e9328939..ade15fb1ade 100644 --- a/addons/resource/test/on_chnage_resource.yml +++ b/addons/resource/test/on_chnage_resource.yml @@ -1,5 +1,5 @@ - - I changing the Working Calendarof 'Demo Resource' + I changing the Resource of the Leave of 'Demo Resource'. - !record {model: resource.calendar.leaves, id: resource_calendar_leaves_demoleave1}: calendar_id: resource.timesheet_group1 From becbd5b33d0a20708adc78130a5e3f9a4f74c4e7 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 22 Nov 2011 17:15:27 +0530 Subject: [PATCH 008/113] [IMP] Added yaml udner test section bzr revid: jam@tinyerp.com-20111122114527-1e9uqmt80b6g4ldw --- addons/resource/__openerp__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index f6cdb178e83..77ce9da3c2c 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -45,7 +45,10 @@ It also manages the leaves of every resource. ], 'demo_xml': ['resource_demo.xml' ], - 'test': ['test/on_chnage_resource.yml'],#TODO: Add Resource test cases + 'test': [ + 'test/on_chnage_resource.yml', + 'test/test_resource.yml', + ], 'installable': True, 'active': False, 'certificate': '00746371192190459469', From 221973ba63797cf08e1eb572fec708173a919327 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 22 Nov 2011 17:16:28 +0530 Subject: [PATCH 009/113] [ADD] Added the yaml for the resource fucntion validation bzr revid: jam@tinyerp.com-20111122114628-zgaq98cjy17pndf8 --- addons/resource/test/test_resource.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 addons/resource/test/test_resource.yml diff --git a/addons/resource/test/test_resource.yml b/addons/resource/test/test_resource.yml new file mode 100644 index 00000000000..c1eb392c8b6 --- /dev/null +++ b/addons/resource/test/test_resource.yml @@ -0,0 +1,23 @@ +- + I generate resource detail for the User "Demo" +- + !python {model: resource.resource}: | + res = self.generate_resources(cr, uid, [ref('base.user_demo')], ref('timesheet_group1')) + assert res, "Resource is not generated." + for resource in res.values(): + assert resource.get('efficiency') == 0.8, "Wrong resource has been Generated" + assert resource.get('vacation'), 'No vaction calculated' + +- + I compute vecation for the reource "Demo Resource" +- + !python {model: resource.resource}: | + res= self.compute_vacation(cr, uid, ref('timesheet_group1'), ref('resource_resource_demorsource')) + assert res, "No vacation generated for the resource 'Demo Resource'." + +- + I compute the working calendar for the resource 'Demo Resource'. +- + !python {model: resource.resource}: | + res= self.compute_working_calendar(cr, uid, ref('timesheet_group1')) + assert res, "No working calendar generated for the resource 'Demo Resource'." From 5b8be84377a9ee5b899d6c7928ce140f939d6d7b Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Mon, 28 Nov 2011 18:20:46 +0530 Subject: [PATCH 010/113] [IMP]account_asset: remove a unused a record and a set a demo data & improve a file, added a new yml file for wizard and add a yml demo data for account_asset bzr revid: mma@tinyerp.com-20111128125046-p8go329rsmcwya8d --- addons/account_asset/__openerp__.py | 4 +- addons/account_asset/account_asset_demo.xml | 2 +- addons/account_asset/account_asset_demo.yml | 17 ++++++ addons/account_asset/test/account_asset.yml | 53 +++++++------------ .../test/account_asset_wizard.yml | 32 +++++++++++ 5 files changed, 71 insertions(+), 37 deletions(-) create mode 100644 addons/account_asset/account_asset_demo.yml create mode 100644 addons/account_asset/test/account_asset_wizard.yml diff --git a/addons/account_asset/__openerp__.py b/addons/account_asset/__openerp__.py index f3d00b08893..14d109eb1b0 100644 --- a/addons/account_asset/__openerp__.py +++ b/addons/account_asset/__openerp__.py @@ -34,7 +34,9 @@ ], "demo_xml" : [ 'account_asset_demo.xml' ], - 'test': ['test/account_asset.yml', + 'test': ['account_asset_demo.yml', + 'test/account_asset.yml', + 'test/account_asset_wizard.yml', ], "update_xml" : [ "security/account_asset_security.xml", diff --git a/addons/account_asset/account_asset_demo.xml b/addons/account_asset/account_asset_demo.xml index 77185081848..0a21788795b 100644 --- a/addons/account_asset/account_asset_demo.xml +++ b/addons/account_asset/account_asset_demo.xml @@ -39,7 +39,7 @@ - open + draft CEO's Car diff --git a/addons/account_asset/account_asset_demo.yml b/addons/account_asset/account_asset_demo.yml new file mode 100644 index 00000000000..161aaaa9d8b --- /dev/null +++ b/addons/account_asset/account_asset_demo.yml @@ -0,0 +1,17 @@ +- + !record {model: account.asset.category, id: account_asset_category_01}: + name: Hardware - 3 Years + journal_id: account.expenses_journal + account_depreciation_id: account.xfa + method_number: 3 + account_asset_id: account.xfa + account_expense_depreciation_id: account.a_expense + +- + !record {model: account.asset.asset, id: account_asset_asset_01}: + name: CEO's Car + category_id: account_asset.account_asset_category_01 + purchase_value: 12000.0 + salvage_value: 2000.0 + method_number: 10 + \ No newline at end of file diff --git a/addons/account_asset/test/account_asset.yml b/addons/account_asset/test/account_asset.yml index b56aa028c61..df939922914 100644 --- a/addons/account_asset/test/account_asset.yml +++ b/addons/account_asset/test/account_asset.yml @@ -1,55 +1,38 @@ - - In order to test Account Asset I create Asset and confirm it and check it's Depriciation lines -- - I Create an Asset Category -- - !record {model: account.asset.category, id: account_asset_category_landbuildings0}: - account_asset_id: account.xfa - account_depreciation_id: account.xfa - account_expense_depreciation_id: account.a_expense - journal_id: account.expenses_journal - name: Land & Buildings -- - I Create an Account Asset -- - !record {model: account.asset.asset, id: account_asset_asset_Land0}: - category_id: account_asset_category_landbuildings0 - code: land - name: Land - partner_id: base.res_partner_14 - purchase_value: 5000.0 - state: draft + In order to test the process of Account Asset - - I check Initially that Account Asset is in the "Draft" state -- - !assert {model: account.asset.asset, id: account_asset_asset_Land0}: - - state == 'draft' -- - I Confirm Account Asset using Confirm Asset button + I perform a action to confirm Account Asset - !python {model: account.asset.asset}: | - self.validate(cr, uid, [ref("account_asset_asset_Land0")]) + self.validate(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")]) - - I check Asset is in running state after pressing Confirm button on asset + I check Asset is now 'open' - - !assert {model: account.asset.asset, id: account_asset_asset_Land0}: + !assert {model: account.asset.asset, id: account_asset.account_asset_asset_vehicles0}: - state == 'open' - - I Compute Account Asset using Compute button and check the number of depreciation lines created + I perform a action to compute Account Asset and check the number of depreciation lines created - !python {model: account.asset.asset}: | - self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_Land0")]) + self.compute_depreciation_board(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")]) # pressing computation button can be remove if creation of depreciation lines while asset is created - value = self.browse(cr, uid, [ref("account_asset_asset_Land0")])[0] + value = self.browse(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")])[0] assert value.method_number == len(value.depreciation_line_ids) - - I Create Account Move using create move button on depreciation lines + I create account move for all depreciation lines - !python {model: account.asset.depreciation.line}: | - ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_Land0'))]) + ids = self.search(cr, uid, [('asset_id','=',ref('account_asset.account_asset_asset_vehicles0'))]) self.create_move(cr, uid, ids) + +- + I check the move line is created +- + !python {model: account.asset.asset}: | + asset = self.browse(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")])[0] + assert len(asset.depreciation_line_ids) == len(asset.account_move_line_ids) - I Check that After creating all the moves of depreciation lines the state is in "Close" state - - !assert {model: account.asset.asset, id: account_asset_asset_Land0}: + !assert {model: account.asset.asset, id: account_asset.account_asset_asset_vehicles0}: - state == 'close' diff --git a/addons/account_asset/test/account_asset_wizard.yml b/addons/account_asset/test/account_asset_wizard.yml new file mode 100644 index 00000000000..776b8b1428c --- /dev/null +++ b/addons/account_asset/test/account_asset_wizard.yml @@ -0,0 +1,32 @@ +- + In order to change the duration, I create a record of it +- + !record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset.account_asset_asset_office0')}"}: + +- + I changed the method_number 10.0 +- + !record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset.account_asset_asset_office0')}"}: + method_number: 10.0 +- + I perform a action to modify it +- + !python {model: asset.modify}: | + context = {"lang": 'en_US', "active_model":"account.asset.asset", "active_ids": [ref("account_asset.account_asset_asset_office0")], "tz": False, "active_id":ref('account_asset.account_asset_asset_office0')} + self.modify(cr, uid, [ref("asset_modify_number_0")], context=context) +- + I check the proper depreciation lines created +- + !assert {model: account.asset.asset, id: account_asset.account_asset_asset_office0}: + - method_number == len(depreciation_line_ids) -1 +- + In order to compute a asset on period ,I create a period of it +- + !record {model: asset.depreciation.confirmation.wizard, id: asset_compute_period_0}: + {} +- + I perform a action to compute it +- + !python {model: asset.depreciation.confirmation.wizard}: | + context = {"lang": 'en_US', "active_model":"ir.ui.menu", "active_ids": [ref("menu_asset_depreciation_confirmation_wizard")], "tz": False, "active_id":ref('menu_asset_depreciation_confirmation_wizard')} + self.asset_compute(cr, uid, [ref("asset_compute_period_0")], context=context) From 46348ccf3150a8b68d03f1f7147e936996d22659 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 10:08:49 +0530 Subject: [PATCH 011/113] [RM/ADD] rearragned the yaml and refcetored the yamls bzr revid: jam@tinyerp.com-20111129043849-i0k4udno1x2jklz1 --- addons/resource/__openerp__.py | 2 +- .../test/{ => process}/test_resource.yml | 18 ++++++++++-------- .../test/{ => ui}/on_chnage_resource.yml | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) rename addons/resource/test/{ => process}/test_resource.yml (74%) rename addons/resource/test/{ => ui}/on_chnage_resource.yml (65%) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 77ce9da3c2c..10626110324 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -46,8 +46,8 @@ It also manages the leaves of every resource. 'demo_xml': ['resource_demo.xml' ], 'test': [ - 'test/on_chnage_resource.yml', 'test/test_resource.yml', + 'test/on_chnage_resource.yml', ], 'installable': True, 'active': False, diff --git a/addons/resource/test/test_resource.yml b/addons/resource/test/process/test_resource.yml similarity index 74% rename from addons/resource/test/test_resource.yml rename to addons/resource/test/process/test_resource.yml index c1eb392c8b6..df9fd9e2708 100644 --- a/addons/resource/test/test_resource.yml +++ b/addons/resource/test/process/test_resource.yml @@ -1,5 +1,7 @@ +- | + In Order to Test resource : I use the 'Demo resource' from Demo Record, with 38 Hours / week and 9 Hours / Day working calendar scheduled. - - I generate resource detail for the User "Demo" + First, I generate resource detail for the User "Demo" - !python {model: resource.resource}: | res = self.generate_resources(cr, uid, [ref('base.user_demo')], ref('timesheet_group1')) @@ -8,16 +10,16 @@ assert resource.get('efficiency') == 0.8, "Wrong resource has been Generated" assert resource.get('vacation'), 'No vaction calculated' -- - I compute vecation for the reource "Demo Resource" -- - !python {model: resource.resource}: | - res= self.compute_vacation(cr, uid, ref('timesheet_group1'), ref('resource_resource_demorsource')) - assert res, "No vacation generated for the resource 'Demo Resource'." - - I compute the working calendar for the resource 'Demo Resource'. - !python {model: resource.resource}: | res= self.compute_working_calendar(cr, uid, ref('timesheet_group1')) assert res, "No working calendar generated for the resource 'Demo Resource'." + +- + I compute vacation for the resource "Demo Resource" based on his Resource Leave Request(s). +- + !python {model: resource.resource}: | + res= self.compute_vacation(cr, uid, ref('timesheet_group1'), ref('resource_resource_demorsource')) + assert res, "No vacation generated for the resource 'Demo Resource'." diff --git a/addons/resource/test/on_chnage_resource.yml b/addons/resource/test/ui/on_chnage_resource.yml similarity index 65% rename from addons/resource/test/on_chnage_resource.yml rename to addons/resource/test/ui/on_chnage_resource.yml index ade15fb1ade..821b3efa5e4 100644 --- a/addons/resource/test/on_chnage_resource.yml +++ b/addons/resource/test/ui/on_chnage_resource.yml @@ -1,5 +1,5 @@ - - I changing the Resource of the Leave of 'Demo Resource'. + I create resource calendar leave record to call event resource onchange event for "Demo Resource". - !record {model: resource.calendar.leaves, id: resource_calendar_leaves_demoleave1}: calendar_id: resource.timesheet_group1 From a3e243fee4f72c70885633963cbf7cd4634501e1 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 10:10:37 +0530 Subject: [PATCH 012/113] [FIX] Refectored the test case file reference bzr revid: jam@tinyerp.com-20111129044037-px01nteee4b9opid --- addons/resource/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 10626110324..3fc4b4b7cfc 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -46,8 +46,8 @@ It also manages the leaves of every resource. 'demo_xml': ['resource_demo.xml' ], 'test': [ - 'test/test_resource.yml', - 'test/on_chnage_resource.yml', + 'test/process/test_resource.yml', + 'test/ui/on_chnage_resource.yml', ], 'installable': True, 'active': False, From 6f9262a9f6e663789af80f4e4e645310016d77c9 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 10:24:32 +0530 Subject: [PATCH 013/113] [ADD] Added test case to check resource duplicate bzr revid: jam@tinyerp.com-20111129045432-3asz2skngzh8mh3t --- addons/resource/__openerp__.py | 3 ++- addons/resource/test/ui/duplicate_resource.yml | 6 ++++++ .../ui/{on_chnage_resource.yml => on_change_resource.yml} | 0 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 addons/resource/test/ui/duplicate_resource.yml rename addons/resource/test/ui/{on_chnage_resource.yml => on_change_resource.yml} (100%) diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 3fc4b4b7cfc..3d08b81494b 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -47,7 +47,8 @@ It also manages the leaves of every resource. ], 'test': [ 'test/process/test_resource.yml', - 'test/ui/on_chnage_resource.yml', + 'test/ui/on_change_resource.yml', + 'test/ui/duplicate_resource.yml', ], 'installable': True, 'active': False, diff --git a/addons/resource/test/ui/duplicate_resource.yml b/addons/resource/test/ui/duplicate_resource.yml new file mode 100644 index 00000000000..45f1f5aa28e --- /dev/null +++ b/addons/resource/test/ui/duplicate_resource.yml @@ -0,0 +1,6 @@ +- + I duplicate the resource "Demo resource" +- + !python {model: resource.resource}: | + copied_id = self.copy(cr, uid, ref("resource_resource_demorsource")) + assert copied_id, "Unablr to Duplicate Reousrce" diff --git a/addons/resource/test/ui/on_chnage_resource.yml b/addons/resource/test/ui/on_change_resource.yml similarity index 100% rename from addons/resource/test/ui/on_chnage_resource.yml rename to addons/resource/test/ui/on_change_resource.yml From f0ddecdb8fc2d11f3a751095d69360e090d7558f Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 10:25:59 +0530 Subject: [PATCH 014/113] [FIX] Removed the fuction def prototype of check_availability in resource_resource bzr revid: jam@tinyerp.com-20111129045559-31vm4mzvmvkwnak5 --- addons/resource/resource.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/addons/resource/resource.py b/addons/resource/resource.py index bd62c449d2b..59844da4c36 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -366,13 +366,6 @@ class resource_resource(osv.osv): wktime_cal.append((non_working[:-1], time_range)) return wktime_cal - #TODO: Write optimized alogrothem for resource availability. : Method Yet not implemented - def check_availability(self, cr, uid, ids, start, end, context=None): - if context == None: - contex = {} - allocation = {} - return allocation - resource_resource() class resource_calendar_leaves(osv.osv): From d75cd905a7a41a26943e3a6a841e0eb81c15f2ef Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 10:27:36 +0530 Subject: [PATCH 015/113] [RM] rmoved the Unused import stmt bzr revid: jam@tinyerp.com-20111129045736-0ev604ced41napfq --- addons/resource/resource.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 59844da4c36..9229d7293eb 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -22,7 +22,6 @@ from datetime import datetime, timedelta import math from faces import * -from new import classobj from osv import fields, osv from tools.translate import _ From 630271cbbbb3c5735f953e8f2facf1c91f1baa07 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 11:06:02 +0530 Subject: [PATCH 016/113] [ADD] Added test case to check the resource calandar fucntion bzr revid: jam@tinyerp.com-20111129053602-nf19mwtk8ya19ahi --- addons/resource/__openerp__.py | 1 + .../test/process/test_resource_calendar.yml | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 addons/resource/test/process/test_resource_calendar.yml diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 3d08b81494b..e27d9be8fe6 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -47,6 +47,7 @@ It also manages the leaves of every resource. ], 'test': [ 'test/process/test_resource.yml', + 'test/process/test_resource_calendar.yml', 'test/ui/on_change_resource.yml', 'test/ui/duplicate_resource.yml', ], diff --git a/addons/resource/test/process/test_resource_calendar.yml b/addons/resource/test/process/test_resource_calendar.yml new file mode 100644 index 00000000000..04f54c746eb --- /dev/null +++ b/addons/resource/test/process/test_resource_calendar.yml @@ -0,0 +1,29 @@ +- | + In order to test resource calendar, I use the Demo record '38 Hours/Week'. +- + I check the working hour on day for resoruce 'Demo Resource' using calendar '38 Hours/Week' . +- + !python {model: resource.calendar}: | + from datetime import datetime + dt = datetime.now() + calendar = self.browse(cr, uid, ref('timesheet_group1')) + result = self.working_hours_on_day(cr, uid, calendar, dt, context) + assert result, "No Working Our on Day for Resource has been Generated." +- + I Check the Resource 6.0 Hours Working Internal Timeming Based on Resource Calendar. +- + !python {model: resource.calendar}: | + from datetime import datetime + dt = datetime.now() + result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0) + assert result, 'No Working Internal Timeming Generated' + +- + I check total number of working hours on resource in between three dates based on resource working calendar. +- + !python {model: resource.calendar}: | + from datetime import datetime, timedelta + dt_from = datetime.now() + dt_to = dt_from + timedelta(days=3) + hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to) + assert hours, 'No Working Hours Generated' From 477becd62aa2485a4353cbcb7a41e327621d3af6 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 11:24:53 +0530 Subject: [PATCH 017/113] [IMP] Added the test case to calculate resource working schedule bzr revid: jam@tinyerp.com-20111129055453-zh6akbwvm7vniivr --- .../resource/test/process/test_resource_calendar.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/resource/test/process/test_resource_calendar.yml b/addons/resource/test/process/test_resource_calendar.yml index 04f54c746eb..04310d72f26 100644 --- a/addons/resource/test/process/test_resource_calendar.yml +++ b/addons/resource/test/process/test_resource_calendar.yml @@ -1,7 +1,7 @@ - | In order to test resource calendar, I use the Demo record '38 Hours/Week'. - - I check the working hour on day for resoruce 'Demo Resource' using calendar '38 Hours/Week' . + I check the working hour on day for resource 'Demo Resource' using calendar '38 Hours/Week' . - !python {model: resource.calendar}: | from datetime import datetime @@ -27,3 +27,11 @@ dt_to = dt_from + timedelta(days=3) hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to) assert hours, 'No Working Hours Generated' +- + I check resource working schedule based on resource calendar for 30 Hours. +- + !python {model: resource.calendar}: | + from datetime import datetime, timedelta + dt_from = datetime.now() + hours = self.interval_min_get(cr, uid, ref('timesheet_group1'), dt_from, 30.0, resource=ref('resource_resource_demorsource')) + assert hours, 'No Working Schedule Generated.' From e726b6ee40153f5201d4815089285709a93130a8 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 29 Nov 2011 12:00:28 +0530 Subject: [PATCH 018/113] [IMP/FIX] YAMl typos and missing docstring for the reosurce calendar def bzr revid: jam@tinyerp.com-20111129063028-0k7zkk1hrr1jd0vp --- addons/resource/resource.py | 52 ++++++++++++++++++- .../test/process/test_resource_calendar.yml | 4 +- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 9229d7293eb..edb900bf2fc 100644 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -43,9 +43,12 @@ class resource_calendar(osv.osv): } def working_hours_on_day(self, cr, uid, resource_calendar_id, day, context=None): - """ + """Calculates the Working Total Hours based on Resource Calendar and + given working day (datetime object). + @param resource_calendar_id: resource.calendar browse record @param day: datetime object + @return: returns the working hours (as float) men should work on the given day if is in the attendance_ids of the resource_calendar_id (i.e if that day is a working day), returns 0.0 otherwise """ res = 0.0 @@ -55,9 +58,16 @@ class resource_calendar(osv.osv): return res def _get_leaves(self, cr, uid, id, resource): + """Private Method to Calculate resource Leaves days + + @param id: resource calendar id + @param resource: resource id for which leaves will ew calculated + + @return : returns the list of dates, where resource on leave in + resource.calendar.leaves object (e.g.['%Y-%m-%d', '%Y-%m-%d']) + """ resource_cal_leaves = self.pool.get('resource.calendar.leaves') dt_leave = [] - resource_leave_ids = resource_cal_leaves.search(cr, uid, [('calendar_id','=',id), '|', ('resource_id','=',False), ('resource_id','=',resource)]) #res_leaves = resource_cal_leaves.read(cr, uid, resource_leave_ids, ['date_from', 'date_to']) res_leaves = resource_cal_leaves.browse(cr, uid, resource_leave_ids) @@ -72,6 +82,21 @@ class resource_calendar(osv.osv): return dt_leave def interval_min_get(self, cr, uid, id, dt_from, hours, resource=False): + """ + Calculates the working Schedule from supplied from date to till hours + will be satisfied based or resource calendar id. If resource is also + given then it will consider the resource leave also and than will + calculates resource working schedule + + @param dt_from: datetime object, start of working scheduled + @param hours: float, total number working hours needed scheduled from + start date + @param resource : Optional Resource id, if supplied than resource leaves + will also taken into consideration for calculating working + schedule. + @return : List datetime object of working schedule based on supplies + params + """ if not id: td = int(hours)*3 return [(dt_from - timedelta(hours=td), dt_from)] @@ -161,10 +186,32 @@ class resource_calendar(osv.osv): return results def interval_get(self, cr, uid, id, dt_from, hours, resource=False, byday=True): + """Calculates Resource Working Internal Timing Based on Resource Calendar. + + @param dt_from: start resource schedule calculation. + @param hours : total number of working hours to be scheduled. + @param resource: optional resource id, If supplied it will take care of + resource leave while scheduling. + @param byday: boolean flag bit enforce day wise scheduling + + @return : list of scheduled working timing based on resource calendar. + """ res = self.interval_get_multi(cr, uid, [(dt_from.strftime('%Y-%m-%d %H:%M:%S'), hours, id)], resource, byday)[(dt_from.strftime('%Y-%m-%d %H:%M:%S'), hours, id)] return res def interval_hours_get(self, cr, uid, id, dt_from, dt_to, resource=False): + """ Calculates the Total Working hours based on given start_date to + end_date, If resource id is supplied that it will consider the source + leaves also in calculating the hours. + + @param dt_from : date start to calculate hours + @param dt_end : date end to calculate hours + @param resource: optional resource id, If given resource leave will be + considered. + + @return : Total number of working hours based dt_from and dt_end and + resource if supplied. + """ if not id: return 0.0 dt_leave = self._get_leaves(cr, uid, id, resource) @@ -289,6 +336,7 @@ class resource_resource(osv.osv): def compute_vacation(self, cr, uid, calendar_id, resource_id=False, resource_calendar=False, context=None): """ Compute the vacation from the working calendar of the resource. + @param calendar_id : working calendar of the project @param resource_id : resource working on phase/task @param resource_calendar : working calendar of the resource diff --git a/addons/resource/test/process/test_resource_calendar.yml b/addons/resource/test/process/test_resource_calendar.yml index 04310d72f26..7c117e74128 100644 --- a/addons/resource/test/process/test_resource_calendar.yml +++ b/addons/resource/test/process/test_resource_calendar.yml @@ -10,12 +10,12 @@ result = self.working_hours_on_day(cr, uid, calendar, dt, context) assert result, "No Working Our on Day for Resource has been Generated." - - I Check the Resource 6.0 Hours Working Internal Timeming Based on Resource Calendar. + I Check the Resource 6.0 Hours Working Internal Timing Based on Resource Calendar. - !python {model: resource.calendar}: | from datetime import datetime dt = datetime.now() - result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0) + result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0, ref('resource_resource_demorsource')) assert result, 'No Working Internal Timeming Generated' - From e5bc35d12f9743a16852e4627a455b0ccba9f45a Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 5 Dec 2011 14:18:38 +0530 Subject: [PATCH 019/113] [MOV] moved yaml file bzr revid: jam@tinyerp.com-20111205084838-urtohfj8zb2puv51 --- .../test/{process/test_resource_calendar.yml => resource.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/resource/test/{process/test_resource_calendar.yml => resource.yml} (100%) diff --git a/addons/resource/test/process/test_resource_calendar.yml b/addons/resource/test/resource.yml similarity index 100% rename from addons/resource/test/process/test_resource_calendar.yml rename to addons/resource/test/resource.yml From 85770076fb58eb998f480db9536d020328219371 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 5 Dec 2011 14:59:20 +0530 Subject: [PATCH 020/113] [ADD/RM] Removed useless file, added the demo resource record bzr revid: jam@tinyerp.com-20111205092920-ephr4ictr36fgvmd --- addons/resource/__openerp__.py | 5 +-- addons/resource/resource_demo.xml | 41 ++++++++++++++----- .../resource/test/process/test_resource.yml | 25 ----------- addons/resource/test/resource.yml | 13 ++++-- .../resource/test/ui/duplicate_resource.yml | 6 --- .../resource/test/ui/on_change_resource.yml | 6 --- 6 files changed, 40 insertions(+), 56 deletions(-) delete mode 100644 addons/resource/test/process/test_resource.yml delete mode 100644 addons/resource/test/ui/duplicate_resource.yml delete mode 100644 addons/resource/test/ui/on_change_resource.yml diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index e27d9be8fe6..4e522470f18 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -46,10 +46,7 @@ It also manages the leaves of every resource. 'demo_xml': ['resource_demo.xml' ], 'test': [ - 'test/process/test_resource.yml', - 'test/process/test_resource_calendar.yml', - 'test/ui/on_change_resource.yml', - 'test/ui/duplicate_resource.yml', + 'test/resource.yml', ], 'installable': True, 'active': False, diff --git a/addons/resource/resource_demo.xml b/addons/resource/resource_demo.xml index 989a029f93f..6a3c186a44c 100644 --- a/addons/resource/resource_demo.xml +++ b/addons/resource/resource_demo.xml @@ -88,21 +88,40 @@ user - - Morning 2 Hours On Leave - + + + + Analyst + + + user + + + + + + Designer + + + user + + + + + + Developer + + + user + + + + 2 Hours On Leave + - - Half Day Seak Leave - - - - - - diff --git a/addons/resource/test/process/test_resource.yml b/addons/resource/test/process/test_resource.yml deleted file mode 100644 index df9fd9e2708..00000000000 --- a/addons/resource/test/process/test_resource.yml +++ /dev/null @@ -1,25 +0,0 @@ -- | - In Order to Test resource : I use the 'Demo resource' from Demo Record, with 38 Hours / week and 9 Hours / Day working calendar scheduled. -- - First, I generate resource detail for the User "Demo" -- - !python {model: resource.resource}: | - res = self.generate_resources(cr, uid, [ref('base.user_demo')], ref('timesheet_group1')) - assert res, "Resource is not generated." - for resource in res.values(): - assert resource.get('efficiency') == 0.8, "Wrong resource has been Generated" - assert resource.get('vacation'), 'No vaction calculated' - -- - I compute the working calendar for the resource 'Demo Resource'. -- - !python {model: resource.resource}: | - res= self.compute_working_calendar(cr, uid, ref('timesheet_group1')) - assert res, "No working calendar generated for the resource 'Demo Resource'." - -- - I compute vacation for the resource "Demo Resource" based on his Resource Leave Request(s). -- - !python {model: resource.resource}: | - res= self.compute_vacation(cr, uid, ref('timesheet_group1'), ref('resource_resource_demorsource')) - assert res, "No vacation generated for the resource 'Demo Resource'." diff --git a/addons/resource/test/resource.yml b/addons/resource/test/resource.yml index 7c117e74128..1fc2e1b19b9 100644 --- a/addons/resource/test/resource.yml +++ b/addons/resource/test/resource.yml @@ -1,5 +1,10 @@ -- | - In order to test resource calendar, I use the Demo record '38 Hours/Week'. +- + In order to test resource calendar. + I assign workig calendar '38 Hours/Week' to human resource. +- + !python {model: resource.resource}: | + self.write(cr, uid, [ref('resource_analyst'), ref('resource_designer'), ref('resource_developer')], {'calendar_id' : ref('timesheet_group1')}) + - I check the working hour on day for resource 'Demo Resource' using calendar '38 Hours/Week' . - @@ -15,7 +20,7 @@ !python {model: resource.calendar}: | from datetime import datetime dt = datetime.now() - result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0, ref('resource_resource_demorsource')) + result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0, ref('resource_analyst')) assert result, 'No Working Internal Timeming Generated' - @@ -33,5 +38,5 @@ !python {model: resource.calendar}: | from datetime import datetime, timedelta dt_from = datetime.now() - hours = self.interval_min_get(cr, uid, ref('timesheet_group1'), dt_from, 30.0, resource=ref('resource_resource_demorsource')) + hours = self.interval_min_get(cr, uid, ref('timesheet_group1'), dt_from, 30.0, resource=ref('resource_analyst')) assert hours, 'No Working Schedule Generated.' diff --git a/addons/resource/test/ui/duplicate_resource.yml b/addons/resource/test/ui/duplicate_resource.yml deleted file mode 100644 index 45f1f5aa28e..00000000000 --- a/addons/resource/test/ui/duplicate_resource.yml +++ /dev/null @@ -1,6 +0,0 @@ -- - I duplicate the resource "Demo resource" -- - !python {model: resource.resource}: | - copied_id = self.copy(cr, uid, ref("resource_resource_demorsource")) - assert copied_id, "Unablr to Duplicate Reousrce" diff --git a/addons/resource/test/ui/on_change_resource.yml b/addons/resource/test/ui/on_change_resource.yml deleted file mode 100644 index 821b3efa5e4..00000000000 --- a/addons/resource/test/ui/on_change_resource.yml +++ /dev/null @@ -1,6 +0,0 @@ -- - I create resource calendar leave record to call event resource onchange event for "Demo Resource". -- - !record {model: resource.calendar.leaves, id: resource_calendar_leaves_demoleave1}: - calendar_id: resource.timesheet_group1 - resource_id: resource.resource_resource_demorsource From 9b384b626a0e31624d522401af5cd4513434cd0a Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:59:30 +0530 Subject: [PATCH 021/113] [FIX]:MRP report for product price requires currency symbol lp bug: https://launchpad.net/bugs/898478 fixed bzr revid: ksa@tinyerp.com-20111205112930-txhakrami8z4rgth --- addons/mrp/report/price.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index c072b821196..5ca53a2d95c 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -62,7 +62,7 @@ class report_custom(report_rml): 'uom': prod.uom_po_id.id, 'date': time.strftime('%Y-%m-%d'), })[pricelist.id] - main_sp_price = """"""+rml_obj.formatLang(price)+' '+ company_currency.symbol+"""\r\n""" + main_sp_price = """"""+rml_obj.formatLang(price)+' '+ (company_currency.symbol or company_currency.name)+"""\r\n""" sum += prod_qtty*price std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id) main_strd_price = str(std_price) + '\r\n' @@ -75,11 +75,11 @@ class report_custom(report_rml): 'uom': prod.uom_po_id.id, 'date': time.strftime('%Y-%m-%d'), })[pricelist.id] - sellers_price += """"""+rml_obj.formatLang(price) +' '+ company_currency.symbol +"""\r\n""" + sellers_price += """"""+rml_obj.formatLang(price) +' '+ (company_currency.symbol or company_currency.name) +"""\r\n""" xml += """ """+ prod_name +""" """+ main_sp_name + sellers + """ """+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +""" - """+ rml_obj.formatLang(float(main_strd_price)) +' '+ company_currency.symbol +""" + """+ rml_obj.formatLang(float(main_strd_price)) +' '+ (company_currency.symbol or company_currency.name) +""" """ + main_sp_price + sellers_price + """'""" xml += '' @@ -93,9 +93,9 @@ class report_custom(report_rml): xml = '' xml += "" + to_xml(workcenter.name) + '' xml += "" - xml += """"""+rml_obj.formatLang(cost_cycle)+' '+ company_currency.symbol + """""" - xml += """"""+rml_obj.formatLang(cost_hour)+' '+ company_currency.symbol + """""" - xml += """"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ company_currency.symbol + """""" + xml += """"""+rml_obj.formatLang(cost_cycle)+' '+ (company_currency.symbol or company_currency.name) + """""" + xml += """"""+rml_obj.formatLang(cost_hour)+' '+ (company_currency.symbol or company_currency.name) + """""" + xml += """"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ (company_currency.symbol or company_currency.name) + """""" xml += '' return xml, total @@ -159,8 +159,8 @@ class report_custom(report_rml): """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """ - """+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ company_currency.symbol + """ + """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ + """+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ '""" else: bom = bom_pool.browse(cr, uid, bom_id, context=context) @@ -186,7 +186,7 @@ class report_custom(report_rml): """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ company_currency.symbol + """ + """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ '""" @@ -204,13 +204,13 @@ class report_custom(report_rml): - """+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ company_currency.symbol +""" + """+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) +""" '""" xml += """ """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ company_currency.symbol + """ + """+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ '""" From 6e5e699b6ebed8802b9c6b9b1d6772b856edd99e Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 5 Dec 2011 17:22:18 +0530 Subject: [PATCH 022/113] [IMP] imporved test case scenario bzr revid: jam@tinyerp.com-20111205115218-95ol3r8mw3uxdi5u --- addons/resource/resource_demo.xml | 42 ++++++++-------- addons/resource/test/resource.yml | 80 +++++++++++++++++++------------ 2 files changed, 70 insertions(+), 52 deletions(-) diff --git a/addons/resource/resource_demo.xml b/addons/resource/resource_demo.xml index 6a3c186a44c..acd96cd992b 100644 --- a/addons/resource/resource_demo.xml +++ b/addons/resource/resource_demo.xml @@ -5,73 +5,73 @@ - 38 Hours/Week + 45 Hours/Week - + Monday morning 0 08 12 - + Monday evening 0 13 18 - + Tuesday morning 1 08 12 - + Tuesday evening 1 13 18 - + Wednesday morning 2 08 12 - + Wednesday evening 2 13 18 - + Thursday morning 3 08 12 - + Thursday evening 13 18 3 - + Friday morning 4 08 12 - + Friday evening 4 13 @@ -79,15 +79,6 @@ - - - - Demo Resource - - - user - - @@ -98,7 +89,7 @@ - + Designer @@ -107,7 +98,7 @@ - + Developer @@ -122,6 +113,13 @@ + + + Dummy Resource Leave + + + + diff --git a/addons/resource/test/resource.yml b/addons/resource/test/resource.yml index 1fc2e1b19b9..42468681e69 100644 --- a/addons/resource/test/resource.yml +++ b/addons/resource/test/resource.yml @@ -1,42 +1,62 @@ - - In order to test resource calendar. - I assign workig calendar '38 Hours/Week' to human resource. + In order to test resource. +- + I assign workig calendar '45 Hours/Week' to human resource. - !python {model: resource.resource}: | - self.write(cr, uid, [ref('resource_analyst'), ref('resource_designer'), ref('resource_developer')], {'calendar_id' : ref('timesheet_group1')}) + self.write(cr, uid, [ref('resource_analyst'), ref('resource_designer'), ref('resource_developer')], {'calendar_id' : ref('timesheet_group1'), 'resource_type': 'user'}) - - I check the working hour on day for resource 'Demo Resource' using calendar '38 Hours/Week' . + I had Project of OpenERP Integration of 50 Hours with three human resource assigned on it. I have started project from this week start. +- + First, I generate the resource detail and check the resource Efficiency assigned. +- + !python {model: resource.resource}: | + resources = self.generate_resources(cr, uid, [ref('base.user_root'),ref('base.user_demo')], ref('timesheet_group1'), context) + for resource in resources.values(): + print resource + assert resource.get('efficiency', 0.0) == 1.0, 'Invalid resource generated.' +- + I check per day work hour availability of the Resource based on Working Calendar Assigned to each resource, for first day of the week. +- + !python {model: resource.resource}: | + calendar_pool = self.pool.get('resource.calendar') + resources = self.browse(cr, uid, [ref('resource_analyst'), ref('resource_designer'), ref('resource_developer')], context) + from datetime import datetime, timedelta + now = datetime.now() + dt = now - timedelta(days=now.weekday()) + for resource in resources: + result = calendar_pool.working_hours_on_day(cr, uid, resource.calendar_id, dt, context) + assert result == 9.0, 'Wrong calculation of day work hour availability of the Resource.' +- + Now, resource "Developer" drafted leave on Thursday in this week. +- + !python {model: resource.calendar.leaves}: | + from datetime import datetime,timedelta + now = datetime.now() + dt = (now - timedelta(days=now.weekday()) ) + timedelta(days=3) + self.write(cr, uid, [ref('resource_dummyleave')], {'resource_id': ref('resource_developer'), 'calendar_id': ref('timesheet_group1'), 'date_from': dt.strftime("%Y-%m-%d 09:00:00"), 'date_to': dt.strftime("%Y-%m-%d 18:00:00")}) + +- + I check Actual working hours on resource 'Developer' from this week - !python {model: resource.calendar}: | - from datetime import datetime - dt = datetime.now() - calendar = self.browse(cr, uid, ref('timesheet_group1')) - result = self.working_hours_on_day(cr, uid, calendar, dt, context) - assert result, "No Working Our on Day for Resource has been Generated." -- - I Check the Resource 6.0 Hours Working Internal Timing Based on Resource Calendar. -- - !python {model: resource.calendar}: | - from datetime import datetime - dt = datetime.now() - result = self.interval_get(cr, uid, ref('timesheet_group1'), dt, 6.0, ref('resource_analyst')) - assert result, 'No Working Internal Timeming Generated' + from datetime import datetime, timedelta + now = datetime.now() + dt_from = now - timedelta(days=now.weekday()) + dt_to = dt_from+ timedelta(days=6) + hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to, resource=ref('resource_developer')) + assert hours > 27 , 'Invalid Total Week working hour calculated' + - - I check total number of working hours on resource in between three dates based on resource working calendar. + Project Analysis work is of 20 hours which will start from Week startso i will calculate working schedule for resource Analyst for the same. - !python {model: resource.calendar}: | + from datetime import datetime, timedelta - dt_from = datetime.now() - dt_to = dt_from + timedelta(days=3) - hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to) - assert hours, 'No Working Hours Generated' -- - I check resource working schedule based on resource calendar for 30 Hours. -- - !python {model: resource.calendar}: | - from datetime import datetime, timedelta - dt_from = datetime.now() - hours = self.interval_min_get(cr, uid, ref('timesheet_group1'), dt_from, 30.0, resource=ref('resource_analyst')) - assert hours, 'No Working Schedule Generated.' + now = datetime.now() + work_intreval = self.interval_min_get(cr, uid, ref('timesheet_group1'), now, 20.0, resource=ref('resource_designer')) + assert len(work_intreval) >= 5, 'Wrong Schedule Calculated' + + From cd99a7eeb698c4671a2c1071a19c728ff5e87e02 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 5 Dec 2011 17:26:37 +0530 Subject: [PATCH 023/113] [ADD/FIX] Duplicate reosurce yaml and added the references for the same bzr revid: jam@tinyerp.com-20111205115637-473yq421xc5w6ag2 --- addons/resource/__openerp__.py | 1 + addons/resource/test/duplicate_resource.yml | 6 ++++++ addons/resource/test/resource.yml | 2 -- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 addons/resource/test/duplicate_resource.yml diff --git a/addons/resource/__openerp__.py b/addons/resource/__openerp__.py index 4e522470f18..c95cb6d29b5 100644 --- a/addons/resource/__openerp__.py +++ b/addons/resource/__openerp__.py @@ -47,6 +47,7 @@ It also manages the leaves of every resource. ], 'test': [ 'test/resource.yml', + 'test/duplicate_resource.yml', ], 'installable': True, 'active': False, diff --git a/addons/resource/test/duplicate_resource.yml b/addons/resource/test/duplicate_resource.yml new file mode 100644 index 00000000000..5869530e2f4 --- /dev/null +++ b/addons/resource/test/duplicate_resource.yml @@ -0,0 +1,6 @@ +- + I duplicate the resource "Analyst" +- + !python {model: resource.resource}: | + copied_id = self.copy(cr, uid, ref("resource_analyst")) + assert copied_id, "Unable to Duplicate Resource" diff --git a/addons/resource/test/resource.yml b/addons/resource/test/resource.yml index 42468681e69..df4e84e58b1 100644 --- a/addons/resource/test/resource.yml +++ b/addons/resource/test/resource.yml @@ -47,8 +47,6 @@ dt_to = dt_from+ timedelta(days=6) hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to, resource=ref('resource_developer')) assert hours > 27 , 'Invalid Total Week working hour calculated' - - - Project Analysis work is of 20 hours which will start from Week startso i will calculate working schedule for resource Analyst for the same. - From bbe95e2694fade1a3fc1e6fd1c0fafc4f2c765c9 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 5 Dec 2011 17:32:10 +0530 Subject: [PATCH 024/113] [FIX] removed print stme bzr revid: jam@tinyerp.com-20111205120210-vqnxzmxk38pc2l07 --- addons/resource/test/resource.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/resource/test/resource.yml b/addons/resource/test/resource.yml index df4e84e58b1..4c9a47ed6e5 100644 --- a/addons/resource/test/resource.yml +++ b/addons/resource/test/resource.yml @@ -14,7 +14,6 @@ !python {model: resource.resource}: | resources = self.generate_resources(cr, uid, [ref('base.user_root'),ref('base.user_demo')], ref('timesheet_group1'), context) for resource in resources.values(): - print resource assert resource.get('efficiency', 0.0) == 1.0, 'Invalid resource generated.' - I check per day work hour availability of the Resource based on Working Calendar Assigned to each resource, for first day of the week. From 78dcac034ade311fef136b1a87131a868d1173b2 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 6 Dec 2011 12:33:25 +0530 Subject: [PATCH 025/113] [IMP]:changed expected in PO bzr revid: ksa@tinyerp.com-20111206070325-m6rayl7d6rw4li7e --- addons/purchase/test/process/cancel_order.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/purchase/test/process/cancel_order.yml b/addons/purchase/test/process/cancel_order.yml index 4ac8e09443f..9ef5597b2d2 100644 --- a/addons/purchase/test/process/cancel_order.yml +++ b/addons/purchase/test/process/cancel_order.yml @@ -4,6 +4,13 @@ I confirm the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase4} +- + I changed Expected Date to Next Day. +- + !python {model: purchase.order}: | + import datetime + next_day = (datetime.date.today()+datetime.timedelta(days=1)) + self.write(cr, uid, [ref("order_purchase4")], {'minimum_planned_date': next_day}) - I check the "Approved" status after confirmed RFQ. - From 07f69837f5483ab2442568fb1565c7cd0eccbe88 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 6 Dec 2011 16:38:04 +0530 Subject: [PATCH 026/113] [IMP]:create invoice on po line bzr revid: ksa@tinyerp.com-20111206110804-ydk9e2cyuk2erejn --- addons/purchase/__openerp__.py | 1 + .../purchase/test/process/invoice_on_poline.yml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 addons/purchase/test/process/invoice_on_poline.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index b4f3a9adf30..ab188d8f95c 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -67,6 +67,7 @@ Dashboard for purchase management that includes: 'test/process/run_scheduler.yml', 'test/process/merge_order.yml', 'test/process/edi_purchase_order.yml', + 'test/process/invoice_on_poline.yml', 'test/ui/print_report.yml', 'test/ui/duplicate_order.yml', 'test/ui/delete_order.yml', diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml new file mode 100644 index 00000000000..7cdfd3c259f --- /dev/null +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -0,0 +1,17 @@ +- + In order to test the flow, I start it from confirmed purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase6} +- + In order to test create invoice for purchase order line. +- + !python {model: purchase.order}: | + invoice_line_obj = self.pool.get('purchase.order.line_invoice') + purchase_order = self.browse(cr, uid, ref("order_purchase6")) + context.update({'active_model': 'purchase.order', 'active_ids': [ref("order_purchase6")]}) + for purchase_line in purchase_order.order_line: + invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." + assert purchase_line.invoiced == True + assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." + From 7e52c28d5f401299fde5e75dfe8001d50dc4311e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 6 Dec 2011 17:15:41 +0530 Subject: [PATCH 027/113] [IMP] CRM: Merge opportunities by Wizard record bzr revid: aag@tinyerp.com-20111206114541-ghgwoe3zkh74d59s --- addons/crm/test/process/merge_opportunity.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 463e330fc10..d43441953d6 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -13,13 +13,22 @@ res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context) self.make_opportunity(cr, uid, [res_id], context=context) - - Now I merge all opportunities of customer. + For merge all opportunities of customer. - !python {model: crm.lead}: | opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) - self.merge_opportunity(cr, uid, opportunity_ids, context=context) + context.update({'active_model': 'crm.lead','active_ids': opportunity_ids}) - - I check for merged opportunities for customer. + I create record for merge. +- + !record {model: crm.merge.opportunity, id: opportunity_merge_id }: +- + I Merged opportunities of customer.. +- + !python {model: crm.merge.opportunity}: | + self.action_merge(cr, uid, [ref("opportunity_merge_id")], context=context) +- + I check for merged opportunities for customer. - !python {model: crm.lead}: | merge_id = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) From 7083f2b49d56bc19c60a2117eaffc43361643b49 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 6 Dec 2011 18:06:05 +0530 Subject: [PATCH 028/113] [ADD] CRM: create partner From Lead bzr revid: aag@tinyerp.com-20111206123605-6ya63mw6l73fztjr --- addons/crm/test/process/lead2opportunity2win.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index dbc04abae19..30577862270 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -5,11 +5,21 @@ - !python {model: crm.lead}: | self.case_open(cr, uid, [ref("crm_case_qrecorp0")]) + context.update({'active_model': 'crm.lead','active_ids': [ref("crm_case_qrecorp0")]}) - I check lead state is "Open". - !assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}: - state == "open" +- + I create record for Partner. +- + !record {model: crm.lead2partner, id: crm_lead2partner_id1 }: +- + I create partner from lead. +- + !python {model: crm.lead2partner}: | + self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context) - I convert lead into opportunity for exiting customer. - From 8889e1ba683aef4fc746a25ca45a83e7746e950f Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 6 Dec 2011 18:46:17 +0530 Subject: [PATCH 029/113] [ADD] CRM: create partner From Lead - Optimize Code bzr revid: aag@tinyerp.com-20111206131617-y8j13ket9x1xv01o --- addons/crm/test/process/lead2opportunity2win.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index 30577862270..9abcbcbea37 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -7,16 +7,14 @@ self.case_open(cr, uid, [ref("crm_case_qrecorp0")]) context.update({'active_model': 'crm.lead','active_ids': [ref("crm_case_qrecorp0")]}) - - I check lead state is "Open". + I check lead state is "Open". - !assert {model: crm.lead, id: crm.crm_case_qrecorp0, string: Lead in open state}: - state == "open" - - I create record for Partner. + I create partner from lead. - !record {model: crm.lead2partner, id: crm_lead2partner_id1 }: -- - I create partner from lead. - !python {model: crm.lead2partner}: | self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context) From 7d6e5d09b7dc0e92bf32eb8cf1fde1bb4ec1683c Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 6 Dec 2011 18:50:21 +0530 Subject: [PATCH 030/113] [IMP] CRM: Merge opportunities by Wizard record - Optimize Code bzr revid: aag@tinyerp.com-20111206132021-a8a88ocplpj4ygvs --- addons/crm/test/process/merge_opportunity.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index d43441953d6..b3e11d519cd 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -13,17 +13,13 @@ res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context) self.make_opportunity(cr, uid, [res_id], context=context) - - For merge all opportunities of customer. + Now I merge all opportunities of customer. - !python {model: crm.lead}: | opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) context.update({'active_model': 'crm.lead','active_ids': opportunity_ids}) -- - I create record for merge. - !record {model: crm.merge.opportunity, id: opportunity_merge_id }: -- - I Merged opportunities of customer.. - !python {model: crm.merge.opportunity}: | self.action_merge(cr, uid, [ref("opportunity_merge_id")], context=context) From 401271fad8dc63dbd4c9bf22703aeae4ee20f780 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 7 Dec 2011 11:14:07 +0530 Subject: [PATCH 031/113] [IMP] CRM: Update Active id in Context bzr revid: aag@tinyerp.com-20111207054407-us90huju1qm9dixd --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index b3e11d519cd..a8dd19e69cb 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -9,7 +9,7 @@ I make another opportunity from phonecall for same customer. - !python {model: crm.phonecall2opportunity}: | - context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context) self.make_opportunity(cr, uid, [res_id], context=context) - From 067e49739dd0a3d75af36fc1ffa1d274954de7ed Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:48:31 +0530 Subject: [PATCH 032/113] [ADD]:demo data for purchase double validation bzr revid: ksa@tinyerp.com-20111207061831-37z6bwtvrcu6393m --- .../process/purchase_double_validation_demo.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml new file mode 100644 index 00000000000..7c074675b75 --- /dev/null +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml @@ -0,0 +1,13 @@ +- + !record {model: purchase.order, id: order_purchase11}: + partner_id: base.res_partner_desertic_hispafuentes + order_line: + - product_id: product.product_product_pc4 + product_qty: 10 + +- + !record {model: purchase.order, id: order_purchase12}: + partner_id: base.res_partner_vickingdirect0 + order_line: + - product_id: product.product_product_hdd2 + product_qty: 10 From 0b687827bd7b770774e9c230139b9fd4bf91a8db Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:50:31 +0530 Subject: [PATCH 033/113] [IMP]:yml for double validation bzr revid: ksa@tinyerp.com-20111207062031-lxtpm8bvx09ehp0l --- .../purchase_double_validation/__openerp__.py | 5 +- .../purchase_double_validation_test.yml | 62 ++++++++++ .../test/purchase_double_validation_test.yml | 117 ------------------ 3 files changed, 66 insertions(+), 118 deletions(-) create mode 100755 addons/purchase_double_validation/test/process/purchase_double_validation_test.yml delete mode 100755 addons/purchase_double_validation/test/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py index cd379afdb59..82a18cba335 100644 --- a/addons/purchase_double_validation/__openerp__.py +++ b/addons/purchase_double_validation/__openerp__.py @@ -41,7 +41,10 @@ that exceeds minimum amount set by configuration wizard. 'purchase_double_validation_installer.xml', 'board_purchase_view.xml' ], - 'test': ['test/purchase_double_validation_test.yml'], + 'test': [ + 'test/process/purchase_double_validation_demo.yml', + 'test/process/purchase_double_validation_test.yml' + ], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml new file mode 100755 index 00000000000..a2582553bc1 --- /dev/null +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml @@ -0,0 +1,62 @@ +- + I Create new limit amount from Configure Limit Amount for Purchase wizard. +- + !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: + limit_amount: 3000 +- + Then I set the Limit Amount. +- + !python {model: purchase.double.validation.installer}: | + self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) +- + Test for purchase double validation in which Total > = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase11")) + assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" +- + In order to test the flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase11}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase11}: + - state == 'approved' +- + Test for purchase double validation in which Total < = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase12")) + assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Less then the Limit Amount" +- + I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase12}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase12}: + - state == 'approved' + + diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml deleted file mode 100755 index ecc8d08a493..00000000000 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ /dev/null @@ -1,117 +0,0 @@ -- - I Create new limit amount from Configure Limit Amount for Purchase wizard. -- - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: - limit_amount: 3000 -- - Then I set the Limit Amount -- - !python {model: purchase.double.validation.installer}: | - self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - In order to test the purchase double validation flow,I start by creating a new product 'MOB1' -- - !record {model: product.product, id: product_product_mob1}: - categ_id: 'product.product_category_3' - cost_method: standard - mes_type: fixed - name: MOB1 - price_margin: 2.0 - procure_method: make_to_stock - property_stock_inventory: stock.location_inventory - property_stock_procurement: stock.location_procurement - property_stock_production: stock.location_production - seller_delay: '1' - standard_price: 2000.0 - supply_method: buy - type: product - uom_id: product.product_uom_unit - uom_po_id: product.product_uom_unit - volume: 0.0 - warranty: 0.0 - weight: 0.0 - weight_net: 0.0 -- - In order to test the purchase double validation flow,I create a new record where "invoice_method" is From Order. -- - Test for purchase double validation in which Total > = Limit Amount. -- - I create purchase order for MOB1 for 3 quantity. -- - !record {model: purchase.order, id: purchase_order_po11}: - company_id: base.main_company - date_order: '2011-01-1' - invoice_method: order - location_id: stock.stock_location_stock - order_line: - - date_planned: '2011-01-11' - name: MOB1 - price_unit: 2000.0 - product_id: 'product_product_mob1' - product_qty: 3.0 - product_uom: product.product_uom_unit - state: draft - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 - pricelist_id: purchase.list0 -- - Initially purchase order is in the draft state. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'draft' -- - I confirm the purchase order for MOB1. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po11} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'confirmed' -- - I Approved purchase order by Supplier for MOB1. -- - !workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po11} -- - I check that the order which was initially in the confirmed state has transmit to approved state. -- - !assert {model: purchase.order, id: purchase_order_po11}: - - state == 'approved' -- - Test for purchase double validation in which Total < Limit Amount. -- - I create purchase order for MOB1 for 1 quantity. -- - !record {model: purchase.order, id: purchase_order_po12}: - company_id: base.main_company - date_order: '2011-01-02' - invoice_method: order - location_id: stock.stock_location_stock - order_line: - - date_planned: '2011-01-12' - name: MOB1 - price_unit: 2000.0 - product_id: 'product_product_mob1' - product_qty: 1.0 - product_uom: product.product_uom_unit - state: draft - partner_address_id: base.res_partner_address_7 - partner_id: base.res_partner_4 - pricelist_id: purchase.list0 -- - Initially purchase order is in the draft state. -- - !assert {model: purchase.order, id: purchase_order_po12}: - - state == 'draft' -- - I confirm the purchase order for MOB1. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po12} -- - I check that the order which was initially in the draft state has transmit to approved state. -- - !assert {model: purchase.order, id: purchase_order_po12}: - - state == 'approved' - - - \ No newline at end of file From ab67c3db61ff0fdeb591686badc269863ec45202 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 11:55:00 +0530 Subject: [PATCH 034/113] [IMP]: improved the statement bzr revid: ksa@tinyerp.com-20111207062500-4rztx35ds937lbsj --- .../test/process/purchase_double_validation_test.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml index a2582553bc1..634c1976ea2 100755 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml @@ -44,17 +44,12 @@ I confirmed the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: order_purchase12}: - - state == 'confirmed' - I Approved the purchase order. - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} - - I check that the order which was initially in the confirmed state has transmit to approved state. + I check that the order has transmit to approved state. - !assert {model: purchase.order, id: order_purchase12}: - state == 'approved' From 7170412c7225a7d7ef9c5886ef5d830a4fed9652 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 7 Dec 2011 12:31:39 +0530 Subject: [PATCH 035/113] [IMP] CRM: crm_phonecall_to_partner - crate partner by wiz bzr revid: aag@tinyerp.com-20111207070139-85umali79jzukepd --- addons/crm/test/process/communication_with_customer.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/crm/test/process/communication_with_customer.yml b/addons/crm/test/process/communication_with_customer.yml index 92e711ce016..5b973f8b46d 100644 --- a/addons/crm/test/process/communication_with_customer.yml +++ b/addons/crm/test/process/communication_with_customer.yml @@ -41,10 +41,12 @@ partner_ids = self.message_partner_by_email(cr, uid, 'Mr. John Right ') assert partner_ids.get('partner_id'), "Customer is not found in regular customer list." - - I convert one phonecall request as a customer and put into regular customer list. + I convert one phonecall request as a customer and put into regular customer list. - - !python {model: crm.phonecall}: | - self.convert_partner(cr, uid, [ref('crm.crm_case_phone06')], context=context) + !python {model: crm.phonecall2partner}: | + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) + new_id = self.create(cr, uid, {}, context=context) + self.make_partner(cr, uid, [new_id], context=context) - I check converted phonecall to partner. - From 2d8a2e5f6c357ca6aebeec04710075eb04f2f2df Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 7 Dec 2011 12:32:10 +0530 Subject: [PATCH 036/113] [IMP]:store the value in variable bzr revid: ksa@tinyerp.com-20111207070210-adb7ur2i1jxdd9vb --- addons/mrp/report/price.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 5ca53a2d95c..fc32eeeed9e 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -41,6 +41,7 @@ class report_custom(report_rml): rml_obj=report_sxw.rml_parse(cr, uid, product_pool._name,context) rml_obj.localcontext.update({'lang':context.get('lang',False)}) company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id + company_currency_symbol = company_currency.symbol or company_currency.name def process_bom(bom, currency_id, factor=1): xml = '' sum = 0 @@ -62,7 +63,7 @@ class report_custom(report_rml): 'uom': prod.uom_po_id.id, 'date': time.strftime('%Y-%m-%d'), })[pricelist.id] - main_sp_price = """"""+rml_obj.formatLang(price)+' '+ (company_currency.symbol or company_currency.name)+"""\r\n""" + main_sp_price = """"""+rml_obj.formatLang(price)+' '+ (company_currency_symbol)+"""\r\n""" sum += prod_qtty*price std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id) main_strd_price = str(std_price) + '\r\n' @@ -75,11 +76,11 @@ class report_custom(report_rml): 'uom': prod.uom_po_id.id, 'date': time.strftime('%Y-%m-%d'), })[pricelist.id] - sellers_price += """"""+rml_obj.formatLang(price) +' '+ (company_currency.symbol or company_currency.name) +"""\r\n""" + sellers_price += """"""+rml_obj.formatLang(price) +' '+ (company_currency_symbol) +"""\r\n""" xml += """ """+ prod_name +""" """+ main_sp_name + sellers + """ """+ rml_obj.formatLang(prod_qtty) +' '+ product_uom_name +""" - """+ rml_obj.formatLang(float(main_strd_price)) +' '+ (company_currency.symbol or company_currency.name) +""" + """+ rml_obj.formatLang(float(main_strd_price)) +' '+ (company_currency_symbol) +""" """ + main_sp_price + sellers_price + """'""" xml += '' @@ -93,9 +94,9 @@ class report_custom(report_rml): xml = '' xml += "" + to_xml(workcenter.name) + '' xml += "" - xml += """"""+rml_obj.formatLang(cost_cycle)+' '+ (company_currency.symbol or company_currency.name) + """""" - xml += """"""+rml_obj.formatLang(cost_hour)+' '+ (company_currency.symbol or company_currency.name) + """""" - xml += """"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ (company_currency.symbol or company_currency.name) + """""" + xml += """"""+rml_obj.formatLang(cost_cycle)+' '+ (company_currency_symbol) + """""" + xml += """"""+rml_obj.formatLang(cost_hour)+' '+ (company_currency_symbol) + """""" + xml += """"""+rml_obj.formatLang(cost_hour + cost_cycle)+' '+ (company_currency_symbol) + """""" xml += '' return xml, total @@ -159,8 +160,8 @@ class report_custom(report_rml): """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ - """+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ + """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency_symbol) + """ + """+ rml_obj.formatLang(total, digits=purchase_price_digits) +' '+ (company_currency_symbol) + """ '""" else: bom = bom_pool.browse(cr, uid, bom_id, context=context) @@ -186,7 +187,7 @@ class report_custom(report_rml): """ + _('Components Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ + """+ rml_obj.formatLang(total_strd, digits=purchase_price_digits) +' '+ (company_currency_symbol) + """ '""" @@ -204,13 +205,13 @@ class report_custom(report_rml): - """+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) +""" + """+ rml_obj.formatLang(total2, digits=purchase_price_digits) +' '+ (company_currency_symbol) +""" '""" xml += """ """ + _('Total Cost of %s %s') % (str(number), product_uom_name) + """: - """+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ (company_currency.symbol or company_currency.name) + """ + """+ rml_obj.formatLang(total_strd+total2, digits=purchase_price_digits) +' '+ (company_currency_symbol) + """ '""" From 55c75c54be8599eca896efde2a233d3701ea9057 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 7 Dec 2011 12:53:35 +0530 Subject: [PATCH 037/113] [IMP] CRM: crm_phonecall_to_phonecall - update context bzr revid: aag@tinyerp.com-20111207072335-eq9ponmsp834mfdc --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index a8dd19e69cb..e955c22a192 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -36,7 +36,7 @@ Now I schedule another phonecall to customer after merged. - !python {model: crm.phonecall2phonecall}: | - context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context) self.action_schedule(cr, uid, [res_id], context=context) - From b6a4a5e6844b289e59ee62d31f7c5f4c00a0581a Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 7 Dec 2011 17:16:48 +0530 Subject: [PATCH 038/113] [IMP] CRM: crm_meeting - Add code for new meeting invite and confirm bzr revid: aag@tinyerp.com-20111207114648-fntnm6o7l4ody3w1 --- addons/crm/test/process/lead2opportunity2win.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index 9abcbcbea37..a6b6c80f109 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -95,4 +95,16 @@ opp = self.browse(cr, uid, ref('crm_case_electonicgoodsdealer0')) assert opp.name == "Interest in Your New Product", "Opportunity name not correct" assert opp.type == 'opportunity', 'Lead is not converted to opportunity!' - assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!' \ No newline at end of file + assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!' +- + I confirm Review needs Meeting. +- + !python {model: crm.meeting}: | + context.update({'active_model': 'crm.meeting'}) + self.case_open(cr, uid, [ref('crm.crm_case_reviewneeds0')]) +- + I Invite a user for Meeting. +- + !python {model: calendar.attendee}: | + meeting_id = self.create(cr, uid, {'user_id': ref('base.user_root'), 'email': 'user@meeting.com' }) + self.do_accept(cr, uid, [meeting_id]) From bc1bb2423bbc71cabd3e8e616d49d9f1ebea02c5 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 8 Dec 2011 15:24:39 +0530 Subject: [PATCH 039/113] [FIX] CRM: phone call ==> Set To TOdo from cancel state bzr revid: aag@tinyerp.com-20111208095439-n1tul9vrcf6s8mcb --- addons/crm/crm_phonecall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index b9bb6d359b1..4246fa43a98 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -118,7 +118,7 @@ class crm_phonecall(crm_base, osv.osv): """Resets case as Todo """ res = super(crm_phonecall, self).case_reset(cr, uid, ids, args, 'crm.phonecall') - self.write(cr, uid, ids, {'duration': 0.0}) + self.write(cr, uid, ids, {'duration': 0.0, 'state':'open'}) return res From 77169c3e51c306ee664ed6ad0e68f20ba69131d2 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 8 Dec 2011 15:29:30 +0530 Subject: [PATCH 040/113] [IMP] CRM: phone call - performe Not Held, cancelled, Set to Todo ,Held Opration bzr revid: aag@tinyerp.com-20111208095930-aikumxjscm5d4hd3 --- addons/crm/test/process/merge_opportunity.yml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index e955c22a192..5a75e98e9aa 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -44,6 +44,36 @@ - !python {model: crm.phonecall}: | self.action_make_meeting(cr, uid, [ref("crm.crm_case_phone06")]) +- + I set Phone call to Not Held. +- + !python {model: crm.phonecall}: | + self.case_pending(cr, uid, [ref("crm.crm_case_phone06")]) +- + I check that the phone call is in 'Not Held' state. +- + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + - state == "pending" +- + I Cancelled the Phone call. +- + !python {model: crm.phonecall}: | + self.case_cancel(cr, uid, [ref("crm.crm_case_phone06")]) +- + I check that the phone call is in 'Cancelled' state. +- + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + - state == "cancel" +- + I Reset the Phone call. +- + !python {model: crm.phonecall}: | + self.case_reset(cr, uid, [ref("crm.crm_case_phone06")]) +- + I check that the phone call is Reset or Not +- + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + - state == "open" - I setting Phone call to Held (Done). - From 88f0fda7dee83e205aed60913498079617d3bd5d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Tue, 13 Dec 2011 15:56:40 +0530 Subject: [PATCH 041/113] [IMP] Improved YML test cases of purchase module. bzr revid: tpa@tinyerp.com-20111213102640-7mz5rddu4mtzir9e --- addons/purchase/report/order.py | 6 +++++- addons/purchase/test/process/invoice_on_poline.yml | 13 +++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py index 6c99d6381f4..c017a0b7838 100644 --- a/addons/purchase/report/order.py +++ b/addons/purchase/report/order.py @@ -33,6 +33,7 @@ class order(report_sxw.rml_parse): 'get_tax': self._get_tax, 'get_product_code': self._get_product_code, }) + #dead code def _get_line_tax(self, line_obj): self.cr.execute("SELECT tax_id FROM purchase_order_taxe WHERE order_line_id=%s", (line_obj.id)) res = self.cr.fetchall() or None @@ -44,7 +45,8 @@ class order(report_sxw.rml_parse): tax_ids = res[0] res = [tax.name for tax in pooler.get_pool(self.cr.dbname).get('account.tax').browse(self.cr, self.uid, tax_ids)] return ",\n ".join(res) - + + #dead code def _get_tax(self, order_obj): self.cr.execute("SELECT DISTINCT tax_id FROM purchase_order_taxe, purchase_order_line, purchase_order \ WHERE (purchase_order_line.order_id=purchase_order.id) AND (purchase_order.id=%s)", (order_obj.id)) @@ -73,6 +75,8 @@ class order(report_sxw.rml_parse): 'base':base, 'amount':base*tax.amount}) return res + + #dead code def _get_product_code(self, product_id, partner_id): product_obj=pooler.get_pool(self.cr.dbname).get('product.product') return product_obj._product_code(self.cr, self.uid, [product_id], name=None, arg=None, context={'partner_id': partner_id})[product_id] diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index 7cdfd3c259f..faf0e4354c8 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,3 +1,13 @@ +- + I create the Default invoicing control method "Based on Purchase Order Lines". +- + !record {model: purchase.config.wizard, id: invoice_control}: + default_method: manual +- + I set the Default invoicing control method "Based on Purchase Order Lines". +- + !python {model: purchase.config.wizard}: | + self.execute(cr, uid, [ref('invoice_control')]) - In order to test the flow, I start it from confirmed purchase order. - @@ -13,5 +23,4 @@ invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." assert purchase_line.invoiced == True - assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." - + assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." \ No newline at end of file From 463f33bf9db590771090b17723bd5a03d10baa7c Mon Sep 17 00:00:00 2001 From: "Hemendra Paregi (Open ERP)" Date: Tue, 13 Dec 2011 18:02:36 +0530 Subject: [PATCH 042/113] [Fix] fix the issue of Unused varialble in account_voucher.py bzr revid: hpa@tinyerp.com-20111213123236-5j0dux25g3iivwa9 --- addons/account_voucher/account_voucher.py | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 535f76b8d64..d11b8213eed 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -363,11 +363,8 @@ class account_voucher(osv.osv): 'amount': False, } voucher_total = 0.0 - line_ids = resolve_o2m_operations(cr, uid, line_pool, line_ids, ["amount"], context) - total = 0.0 - total_tax = 0.0 for line in line_ids: line_amount = 0.0 line_amount = line.get('amount',0.0) @@ -828,8 +825,6 @@ class account_voucher(osv.osv): :return: mapping between fieldname and value of account move line to create :rtype: dict ''' - move_line_obj = self.pool.get('account.move.line') - currency_obj = self.pool.get('res.currency') voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) debit = credit = 0.0 # TODO: is there any other alternative then the voucher type ?? @@ -868,7 +863,6 @@ class account_voucher(osv.osv): :return: mapping between fieldname and value of account move to create :rtype: dict ''' - move_obj = self.pool.get('account.move') seq_obj = self.pool.get('ir.sequence') voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) if voucher_brw.number: @@ -1053,7 +1047,7 @@ class account_voucher(osv.osv): voucher_currency = voucher_brw.currency_id and voucher_brw.currency_id.id or voucher_brw.journal_id.company_id.currency_id.id # We want to set it on the account move line as soon as the original line had a foreign currency if line.move_line_id.currency_id and line.move_line_id.currency_id.id != company_currency: - # we compute the amount in that foreign currency. + # we compute the amount in that foreign currency. if line.move_line_id.currency_id.id == current_currency: # if the voucher and the voucher line share the same currency, there is no computation to do sign = (move_line['debit'] - move_line['credit']) < 0 and -1 or 1 @@ -1116,7 +1110,6 @@ class account_voucher(osv.osv): :return: mapping between fieldname and value of account move line to create :rtype: dict ''' - move_line_obj = self.pool.get('account.move.line') currency_obj = self.pool.get('res.currency') move_line = {} @@ -1178,9 +1171,6 @@ class account_voucher(osv.osv): context = {} move_pool = self.pool.get('account.move') move_line_pool = self.pool.get('account.move.line') - currency_pool = self.pool.get('res.currency') - tax_obj = self.pool.get('account.tax') - seq_obj = self.pool.get('ir.sequence') for voucher in self.browse(cr, uid, ids, context=context): if voucher.move_id: continue @@ -1210,7 +1200,7 @@ class account_voucher(osv.osv): # Create the writeoff line if needed ml_writeoff = self.writeoff_move_line_get(cr, uid, voucher.id, line_total, move_id, name, company_currency, current_currency, context) if ml_writeoff: - ml_writeoff_id = move_line_pool.create(cr, uid, ml_writeoff, context) + move_line_pool.create(cr, uid, ml_writeoff, context) # We post the voucher. self.write(cr, uid, [voucher.id], { 'move_id': move_id, @@ -1276,7 +1266,7 @@ class account_voucher_line(osv.osv): def _currency_id(self, cr, uid, ids, name, args, context=None): ''' - This function returns the currency id of a voucher line. It's either the currency of the + This function returns the currency id of a voucher line. It's either the currency of the associated move line (if any) or the currency of the voucher or the company currency. ''' res = {} From c9b5faa1ac29adb956d615808014dbab56755aaa Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 13 Dec 2011 18:48:44 +0530 Subject: [PATCH 043/113] [IMP] CRM: I Create Record Ruels And cover _check method bzr revid: aag@tinyerp.com-20111213131844-diipvx1ix2mmynq0 --- addons/crm/test/process/cancel_lead.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/crm/test/process/cancel_lead.yml b/addons/crm/test/process/cancel_lead.yml index a5f85a14058..da826345e94 100644 --- a/addons/crm/test/process/cancel_lead.yml +++ b/addons/crm/test/process/cancel_lead.yml @@ -51,3 +51,26 @@ assert lead.state == 'done', "lead is not done state" assert lead.stage_id.id == ref('crm.stage_lead6'), 'Stage is not changed!' assert lead.probability == 0.0, 'Probability is wrong!' +- + I create a Record Rule. +- + !python {model: base.action.rule}: | + modle_id = self.pool.get("ir.model").search(cr, uid, [('name', '=', 'crm.lead')]) + from datetime import datetime + new_id = self.create(cr, uid, {'name': 'New Rule', 'model_id': modle_id[0], 'trg_user_id': ref('base.user_root'), 'trg_partner_id': ref('base.res_partner_asus'), 'act_user_id': ref('base.user_demo') }) + lead_obj = self.pool.get("crm.lead") + self._check(cr, uid) +- + I create New Lead To Check Record Rule. +- + !record {model: crm.lead, id: crm_lead_test_rules_id }: + name: 'test leads Ruels' + user_id: base.user_root + partner_id: base.res_partner_asus +- + I Check Record Rule is Apply and Responsible is Changed. +- + !python {model: crm.lead}: | + user = self.browse(cr, uid, ref('crm_lead_test_rules_id')) + demo_user = self.pool.get("res.users").browse(cr, uid, ref('base.user_demo')) + assert user.user_id.id == demo_user.id, "Responsible is Not changed." From f9e2934bf299d75c8b21f02193bed516712b5c97 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 13 Dec 2011 18:52:20 +0530 Subject: [PATCH 044/113] [IMP] CRM: comment Dead Code bzr revid: aag@tinyerp.com-20111213132220-x81f501kaj1kx1wv --- addons/crm/crm_action_rule.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_action_rule.py b/addons/crm/crm_action_rule.py index 3947eb58156..10ad262d38e 100644 --- a/addons/crm/crm_action_rule.py +++ b/addons/crm/crm_action_rule.py @@ -125,7 +125,7 @@ class base_action_rule(osv.osv): """Gets available states for crm""" res = super(base_action_rule, self).state_get(cr, uid, context=context) return res + crm.AVAILABLE_STATES - + # Dead Code def priority_get(self, cr, uid, context=None): res = super(base_action_rule, self).priority_get(cr, uid, context=context) return res + crm.AVAILABLE_PRIORITIES From 17045d2770c15319114754b49b5bb3712a9a333c Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 14 Dec 2011 15:39:46 +0530 Subject: [PATCH 045/113] [IMP] improved YML test case of account_asset module bzr revid: tpa@tinyerp.com-20111214100946-iia27i70n9ugdmgv --- addons/account_asset/__openerp__.py | 2 +- addons/account_asset/account_asset_demo.xml | 11 +++--- addons/account_asset/account_asset_demo.yml | 17 --------- addons/account_asset/test/account_asset.yml | 35 +++++++++---------- .../account_asset/test/account_asset_demo.yml | 9 +++++ .../test/account_asset_wizard.yml | 23 +++++------- 6 files changed, 41 insertions(+), 56 deletions(-) delete mode 100644 addons/account_asset/account_asset_demo.yml create mode 100644 addons/account_asset/test/account_asset_demo.yml diff --git a/addons/account_asset/__openerp__.py b/addons/account_asset/__openerp__.py index 9d4fc67d342..2dc80fc661a 100644 --- a/addons/account_asset/__openerp__.py +++ b/addons/account_asset/__openerp__.py @@ -34,7 +34,7 @@ ], "demo_xml" : [ 'account_asset_demo.xml' ], - 'test': ['account_asset_demo.yml', + 'test': ['test/account_asset_demo.yml', 'test/account_asset.yml', 'test/account_asset_wizard.yml', ], diff --git a/addons/account_asset/account_asset_demo.xml b/addons/account_asset/account_asset_demo.xml index 0a21788795b..fc27e3027de 100644 --- a/addons/account_asset/account_asset_demo.xml +++ b/addons/account_asset/account_asset_demo.xml @@ -1,7 +1,7 @@ - @@ -33,13 +33,12 @@ 3 - + --> - draft CEO's Car @@ -56,7 +55,7 @@ - + @@ -68,6 +67,6 @@ - + diff --git a/addons/account_asset/account_asset_demo.yml b/addons/account_asset/account_asset_demo.yml deleted file mode 100644 index 161aaaa9d8b..00000000000 --- a/addons/account_asset/account_asset_demo.yml +++ /dev/null @@ -1,17 +0,0 @@ -- - !record {model: account.asset.category, id: account_asset_category_01}: - name: Hardware - 3 Years - journal_id: account.expenses_journal - account_depreciation_id: account.xfa - method_number: 3 - account_asset_id: account.xfa - account_expense_depreciation_id: account.a_expense - -- - !record {model: account.asset.asset, id: account_asset_asset_01}: - name: CEO's Car - category_id: account_asset.account_asset_category_01 - purchase_value: 12000.0 - salvage_value: 2000.0 - method_number: 10 - \ No newline at end of file diff --git a/addons/account_asset/test/account_asset.yml b/addons/account_asset/test/account_asset.yml index df939922914..a3718e34345 100644 --- a/addons/account_asset/test/account_asset.yml +++ b/addons/account_asset/test/account_asset.yml @@ -1,38 +1,37 @@ - - In order to test the process of Account Asset + In order to test the process of Account Asset, - - I perform a action to confirm Account Asset + I perform a action to confirm Account Asset. - !python {model: account.asset.asset}: | - self.validate(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")]) + self.validate(cr, uid, [ref("account_asset_asset_vehicles0")]) - - I check Asset is now 'open' + I check Asset is now in Open state. - - !assert {model: account.asset.asset, id: account_asset.account_asset_asset_vehicles0}: + !assert {model: account.asset.asset, id: account_asset_asset_vehicles0, severity: error, string: Asset should be in Open state}: - state == 'open' - - I perform a action to compute Account Asset and check the number of depreciation lines created + I compute depreciation lines for asset of CEO's Car . - !python {model: account.asset.asset}: | - self.compute_depreciation_board(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")]) + self.compute_depreciation_board(cr, uid, [ref("account_asset_asset_vehicles0")]) # pressing computation button can be remove if creation of depreciation lines while asset is created - value = self.browse(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")])[0] - assert value.method_number == len(value.depreciation_line_ids) + value = self.browse(cr, uid, [ref("account_asset_asset_vehicles0")])[0] + assert value.method_number == len(value.depreciation_line_ids), 'Depreciation lines not created correctly' - - I create account move for all depreciation lines + I create account move for all depreciation lines. - !python {model: account.asset.depreciation.line}: | - ids = self.search(cr, uid, [('asset_id','=',ref('account_asset.account_asset_asset_vehicles0'))]) + ids = self.search(cr, uid, [('asset_id','=',ref('account_asset_asset_vehicles0'))]) self.create_move(cr, uid, ids) - - - I check the move line is created + I check the move line is created. - !python {model: account.asset.asset}: | - asset = self.browse(cr, uid, [ref("account_asset.account_asset_asset_vehicles0")])[0] - assert len(asset.depreciation_line_ids) == len(asset.account_move_line_ids) + asset = self.browse(cr, uid, [ref("account_asset_asset_vehicles0")])[0] + assert len(asset.depreciation_line_ids) == len(asset.account_move_line_ids), 'Move lines not created correctly' - - I Check that After creating all the moves of depreciation lines the state is in "Close" state + I Check that After creating all the moves of depreciation lines the state "Close". - - !assert {model: account.asset.asset, id: account_asset.account_asset_asset_vehicles0}: - - state == 'close' + !assert {model: account.asset.asset, id: account_asset_asset_vehicles0}: + - state == 'close' \ No newline at end of file diff --git a/addons/account_asset/test/account_asset_demo.yml b/addons/account_asset/test/account_asset_demo.yml new file mode 100644 index 00000000000..4e708746853 --- /dev/null +++ b/addons/account_asset/test/account_asset_demo.yml @@ -0,0 +1,9 @@ +- + !record {model: account.asset.category, id: account_asset_category_fixedassets0}: + account_asset_id: account.xfa +- + !record {model: account.asset.asset, id: account_asset_asset_vehicles0}: + category_id: account_asset_category_sale +- + !record {model: account.asset.asset, id: account_asset_asset_vehicles0}: + method_number: 10 \ No newline at end of file diff --git a/addons/account_asset/test/account_asset_wizard.yml b/addons/account_asset/test/account_asset_wizard.yml index 776b8b1428c..7fad4917750 100644 --- a/addons/account_asset/test/account_asset_wizard.yml +++ b/addons/account_asset/test/account_asset_wizard.yml @@ -1,32 +1,27 @@ - - In order to change the duration, I create a record of it + I create a record to change the duration of asset for calculating depreciation. - - !record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset.account_asset_asset_office0')}"}: - -- - I changed the method_number 10.0 -- - !record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset.account_asset_asset_office0')}"}: + !record {model: asset.modify, id: asset_modify_number_0, context: "{'active_id': ref('account_asset_asset_office0')}"}: method_number: 10.0 - - I perform a action to modify it + I change the duration. - !python {model: asset.modify}: | - context = {"lang": 'en_US', "active_model":"account.asset.asset", "active_ids": [ref("account_asset.account_asset_asset_office0")], "tz": False, "active_id":ref('account_asset.account_asset_asset_office0')} + context = {"active_id":ref('account_asset_asset_office0')} self.modify(cr, uid, [ref("asset_modify_number_0")], context=context) - - I check the proper depreciation lines created + I check the proper depreciation lines created. - !assert {model: account.asset.asset, id: account_asset.account_asset_asset_office0}: - method_number == len(depreciation_line_ids) -1 - - In order to compute a asset on period ,I create a period of it + I create a period to compute a asset on period. - !record {model: asset.depreciation.confirmation.wizard, id: asset_compute_period_0}: {} - - I perform a action to compute it + I compute a asset on period. - !python {model: asset.depreciation.confirmation.wizard}: | - context = {"lang": 'en_US', "active_model":"ir.ui.menu", "active_ids": [ref("menu_asset_depreciation_confirmation_wizard")], "tz": False, "active_id":ref('menu_asset_depreciation_confirmation_wizard')} - self.asset_compute(cr, uid, [ref("asset_compute_period_0")], context=context) + context = {"active_ids": [ref("menu_asset_depreciation_confirmation_wizard")], "active_id":ref('menu_asset_depreciation_confirmation_wizard')} + self.asset_compute(cr, uid, [ref("asset_compute_period_0")], context=context) \ No newline at end of file From 0cca14a5d265443a79b3b235c209cdbc7cd38d27 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Wed, 14 Dec 2011 18:31:48 +0530 Subject: [PATCH 046/113] [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 047/113] [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 56ea272c4ce7cefd4430585fc397161d008c38dd Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 17:09:39 +0530 Subject: [PATCH 048/113] [ADD]CRM:add new file for test crm action rule bzr revid: aag@tinyerp.com-20111215113939-vbe7ge2hw694dthp --- addons/crm/__openerp__.py | 1 + addons/crm/test/process/action_rule.yml | 23 +++++++++++++++++++++++ addons/crm/test/process/cancel_lead.yml | 23 ----------------------- 3 files changed, 24 insertions(+), 23 deletions(-) create mode 100644 addons/crm/test/process/action_rule.yml diff --git a/addons/crm/__openerp__.py b/addons/crm/__openerp__.py index 83b0354912a..23f84606c29 100644 --- a/addons/crm/__openerp__.py +++ b/addons/crm/__openerp__.py @@ -123,6 +123,7 @@ Creates a dashboard for CRM that includes: 'test/process/lead2opportunity2win.yml', 'test/process/merge_opportunity.yml', 'test/process/cancel_lead.yml', + 'test/process/action_rule.yml', 'test/process/segmentation.yml', 'test/ui/crm_demo.yml', 'test/ui/duplicate_lead.yml', diff --git a/addons/crm/test/process/action_rule.yml b/addons/crm/test/process/action_rule.yml new file mode 100644 index 00000000000..7c7fd0bf66a --- /dev/null +++ b/addons/crm/test/process/action_rule.yml @@ -0,0 +1,23 @@ +- + I create a record rule. +- + !python {model: base.action.rule}: | + modle_id = self.pool.get("ir.model").search(cr, uid, [('name', '=', 'crm.lead')]) + from datetime import datetime + new_id = self.create(cr, uid, {'name': 'New Rule', 'model_id': modle_id[0], 'trg_user_id': ref('base.user_root'), 'trg_partner_id': ref('base.res_partner_asus'), 'act_user_id': ref('base.user_demo') }) + lead_obj = self.pool.get("crm.lead") + self._check(cr, uid) +- + I create new lead to check record rule. +- + !record {model: crm.lead, id: crm_lead_test_rules_id }: + name: 'test leads Ruels' + user_id: base.user_root + partner_id: base.res_partner_asus +- + I check record rule is apply and responsible is changed. +- + !python {model: crm.lead}: | + user = self.browse(cr, uid, ref('crm_lead_test_rules_id')) + demo_user = self.pool.get("res.users").browse(cr, uid, ref('base.user_demo')) + assert user.user_id.id == demo_user.id, "Responsible is Not changed." diff --git a/addons/crm/test/process/cancel_lead.yml b/addons/crm/test/process/cancel_lead.yml index da826345e94..a5f85a14058 100644 --- a/addons/crm/test/process/cancel_lead.yml +++ b/addons/crm/test/process/cancel_lead.yml @@ -51,26 +51,3 @@ assert lead.state == 'done', "lead is not done state" assert lead.stage_id.id == ref('crm.stage_lead6'), 'Stage is not changed!' assert lead.probability == 0.0, 'Probability is wrong!' -- - I create a Record Rule. -- - !python {model: base.action.rule}: | - modle_id = self.pool.get("ir.model").search(cr, uid, [('name', '=', 'crm.lead')]) - from datetime import datetime - new_id = self.create(cr, uid, {'name': 'New Rule', 'model_id': modle_id[0], 'trg_user_id': ref('base.user_root'), 'trg_partner_id': ref('base.res_partner_asus'), 'act_user_id': ref('base.user_demo') }) - lead_obj = self.pool.get("crm.lead") - self._check(cr, uid) -- - I create New Lead To Check Record Rule. -- - !record {model: crm.lead, id: crm_lead_test_rules_id }: - name: 'test leads Ruels' - user_id: base.user_root - partner_id: base.res_partner_asus -- - I Check Record Rule is Apply and Responsible is Changed. -- - !python {model: crm.lead}: | - user = self.browse(cr, uid, ref('crm_lead_test_rules_id')) - demo_user = self.pool.get("res.users").browse(cr, uid, ref('base.user_demo')) - assert user.user_id.id == demo_user.id, "Responsible is Not changed." From 8a5f52a888c61ab2f98889ef104eb9b3a5609114 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 17:19:47 +0530 Subject: [PATCH 049/113] [ADD]CRM:optimize the code bzr revid: aag@tinyerp.com-20111215114947-23puczlqu9o6g13r --- addons/crm/test/process/lead2opportunity2win.yml | 1 - addons/crm/test/process/merge_opportunity.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index a6b6c80f109..c921a5330fd 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -5,7 +5,6 @@ - !python {model: crm.lead}: | self.case_open(cr, uid, [ref("crm_case_qrecorp0")]) - context.update({'active_model': 'crm.lead','active_ids': [ref("crm_case_qrecorp0")]}) - I check lead state is "Open". - diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 5a75e98e9aa..d1d01099093 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -17,7 +17,6 @@ - !python {model: crm.lead}: | opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) - context.update({'active_model': 'crm.lead','active_ids': opportunity_ids}) - !record {model: crm.merge.opportunity, id: opportunity_merge_id }: - From 2e522819e6427631fa8f44e099feb69ea8eb3d4d Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 17:24:04 +0530 Subject: [PATCH 050/113] [ADD]CRM:optimize the code bzr revid: aag@tinyerp.com-20111215115404-rimjbde55cp926xy --- addons/crm/test/process/merge_opportunity.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index d1d01099093..2c1ff1e0726 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -51,7 +51,7 @@ - I check that the phone call is in 'Not Held' state. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "pending" - I Cancelled the Phone call. @@ -61,7 +61,7 @@ - I check that the phone call is in 'Cancelled' state. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "cancel" - I Reset the Phone call. @@ -71,7 +71,7 @@ - I check that the phone call is Reset or Not - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "open" - I setting Phone call to Held (Done). @@ -81,5 +81,5 @@ - I check that the phone call is in 'Held' state. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call Helded}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "done" From 0a95b359b93a88437d28c40284aeaa22ef07228b Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 17:29:40 +0530 Subject: [PATCH 051/113] [ADD]CRM:use proper sentence case bzr revid: aag@tinyerp.com-20111215115940-r1mc5cjtlxwpblwa --- addons/crm/test/process/merge_opportunity.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 2c1ff1e0726..8f911c92bdc 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -1,5 +1,5 @@ - - I make direct opportunity for Customer. + I make direct opportunity for customer. - !python {model: crm.partner2opportunity}: | context.update({'active_model': 'res.partner', 'active_ids': [ref("base.res_partner_9")]}) @@ -39,12 +39,12 @@ res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context) self.action_schedule(cr, uid, [res_id], context=context) - - I schedule Meeting on this phonecall. + I schedule meeting on this phonecall. - !python {model: crm.phonecall}: | self.action_make_meeting(cr, uid, [ref("crm.crm_case_phone06")]) - - I set Phone call to Not Held. + I set phone call to not held. - !python {model: crm.phonecall}: | self.case_pending(cr, uid, [ref("crm.crm_case_phone06")]) @@ -54,7 +54,7 @@ !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "pending" - - I Cancelled the Phone call. + I cancelled the phone call. - !python {model: crm.phonecall}: | self.case_cancel(cr, uid, [ref("crm.crm_case_phone06")]) @@ -64,17 +64,17 @@ !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "cancel" - - I Reset the Phone call. + I reset the phone call. - !python {model: crm.phonecall}: | self.case_reset(cr, uid, [ref("crm.crm_case_phone06")]) - - I check that the phone call is Reset or Not + I check that the phone call is reset or not - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: - state == "open" - - I setting Phone call to Held (Done). + I setting phone call to held (done). - !python {model: crm.phonecall}: | self.case_close(cr, uid, [ref("crm.crm_case_phone06")]) From 5b253d6bd09a73e8fe4af02c65069985a81e1346 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 17:42:47 +0530 Subject: [PATCH 052/113] [ADD]CRM:optimize the code bzr revid: aag@tinyerp.com-20111215121247-2rtl9ki3du5ni403 --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 8f911c92bdc..30433751279 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -35,7 +35,7 @@ Now I schedule another phonecall to customer after merged. - !python {model: crm.phonecall2phonecall}: | - context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context) self.action_schedule(cr, uid, [res_id], context=context) - From a8c70fd477623bd044271a62c3986d9f0f0c1d7b Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 15 Dec 2011 18:00:30 +0530 Subject: [PATCH 053/113] [ADD]CRM:use proper sentence case bzr revid: aag@tinyerp.com-20111215123030-19icn1v6gc11om29 --- addons/crm/test/process/cancel_lead.yml | 4 ++-- .../test/process/communication_with_customer.yml | 2 +- addons/crm/test/process/lead2opportunity2win.yml | 14 +++++++------- addons/crm/test/process/segmentation.yml | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/crm/test/process/cancel_lead.yml b/addons/crm/test/process/cancel_lead.yml index a5f85a14058..ca5f7d0174a 100644 --- a/addons/crm/test/process/cancel_lead.yml +++ b/addons/crm/test/process/cancel_lead.yml @@ -29,12 +29,12 @@ !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Lead is in pending state}: - state == "pending" - - I Escalate the Lead to Parent Team. + I escalate the lead to parent team. - !python {model: crm.lead}: | self.case_escalate(cr, uid, [ref("crm_case_itisatelesalescampaign0")]) - - I check lead escalate to Parent Team. + I check lead escalate to parent team. - !assert {model: crm.lead, id: crm.crm_case_itisatelesalescampaign0, string: Escalate lead to parent team}: - section_id.name == "Sales Department" diff --git a/addons/crm/test/process/communication_with_customer.yml b/addons/crm/test/process/communication_with_customer.yml index 5b973f8b46d..83d2ce915ac 100644 --- a/addons/crm/test/process/communication_with_customer.yml +++ b/addons/crm/test/process/communication_with_customer.yml @@ -1,5 +1,5 @@ - - Customer interested in our product. so He send request by email to get more details. + Customer interested in our product. so he send request by email to get more details. - Mail script will be fetched him request from mail server. so I process that mail after read EML file - diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index c921a5330fd..52b6fdc2cad 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -46,13 +46,13 @@ ids = self.search(cr, uid, [('opportunity_id', '=', ref('crm_case_qrecorp0'))]) assert len(ids), 'phonecall is not scheduled' - - Now I schedule Meeting with Customer. + Now I schedule meeting with customer. - !python {model: crm.lead}: | self.action_makeMeeting(cr, uid, [ref('crm_case_qrecorp0')]) - - After communicated with customer, I put some notes with Contract details. + After communicated with customer, I put some notes with contract details. - !python {model: crm.add.note}: | context.update({'active_model': 'crm.lead', 'active_id': ref('crm_case_qrecorp0')}) @@ -64,7 +64,7 @@ !python {model: crm.lead}: | self.case_mark_won(cr, uid, [ref("crm_case_qrecorp0")]) - - I check details of the opportunity After won the opportunity. + I check details of the opportunity after won the opportunity. - !python {model: crm.lead}: | lead = self.browse(cr, uid, ref('crm_case_qrecorp0')) @@ -79,7 +79,7 @@ id = self.create(cr, uid, {'user_ids': [ref('base.user_root')], 'section_id': ref('crm.section_sales_department')}, context=context) self.mass_convert(cr, uid, [id], context=context) - - Now I check First lead converted on opportunity. + Now I check first lead converted on opportunity. - !python {model: crm.lead}: | opp = self.browse(cr, uid, ref('crm_case_employee0')) @@ -88,7 +88,7 @@ assert opp.partner_id.name == "Agrolait", 'Partner missmatch!' assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!' - - Then check for Second lead converted on opportunity. + Then check for second lead converted on opportunity. - !python {model: crm.lead}: | opp = self.browse(cr, uid, ref('crm_case_electonicgoodsdealer0')) @@ -96,13 +96,13 @@ assert opp.type == 'opportunity', 'Lead is not converted to opportunity!' assert opp.stage_id.id == ref("stage_lead1"), 'Stage of probability is incorrect!' - - I confirm Review needs Meeting. + I confirm review needs meeting. - !python {model: crm.meeting}: | context.update({'active_model': 'crm.meeting'}) self.case_open(cr, uid, [ref('crm.crm_case_reviewneeds0')]) - - I Invite a user for Meeting. + I invite a user for meeting. - !python {model: calendar.attendee}: | meeting_id = self.create(cr, uid, {'user_id': ref('base.user_root'), 'email': 'user@meeting.com' }) diff --git a/addons/crm/test/process/segmentation.yml b/addons/crm/test/process/segmentation.yml index 74500049290..f3801b80ec6 100644 --- a/addons/crm/test/process/segmentation.yml +++ b/addons/crm/test/process/segmentation.yml @@ -8,7 +8,7 @@ #Todo: Need to check after segmentation started - - I create rule Segmentation line record for partner . + I create rule segmentation line record for partner . - !python {model: crm.segmentation.line}: | id = self.create(cr, uid, {'name': "OpenERP partners",'expr_value': 25}) From fbcebff117bf2ae5e1aa7cee68673f652d27e019 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 15 Dec 2011 18:25:53 +0530 Subject: [PATCH 054/113] [IMP] account_asset: Reverted demo data changes. bzr revid: tpa@tinyerp.com-20111215125553-f6zy38gycz13ib1b --- addons/account_asset/account_asset_demo.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account_asset/account_asset_demo.xml b/addons/account_asset/account_asset_demo.xml index fc27e3027de..4a3078a9ba1 100644 --- a/addons/account_asset/account_asset_demo.xml +++ b/addons/account_asset/account_asset_demo.xml @@ -39,6 +39,7 @@ + open CEO's Car From 0380a9a29160bd325cd676bd454fc67b598d1a6f Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 16 Dec 2011 11:57:22 +0530 Subject: [PATCH 055/113] [ADD]CRM:Add context to fix test case bzr revid: aag@tinyerp.com-20111216062722-cw3bpc3x5n4gckfu --- addons/crm/test/process/lead2opportunity2win.yml | 3 ++- addons/crm/test/process/merge_opportunity.yml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/crm/test/process/lead2opportunity2win.yml b/addons/crm/test/process/lead2opportunity2win.yml index 52b6fdc2cad..a5b6c421dbb 100644 --- a/addons/crm/test/process/lead2opportunity2win.yml +++ b/addons/crm/test/process/lead2opportunity2win.yml @@ -13,9 +13,10 @@ - I create partner from lead. - - !record {model: crm.lead2partner, id: crm_lead2partner_id1 }: + !record {model: crm.lead2partner, id: crm_lead2partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_qrecorp0")]}'}: - !python {model: crm.lead2partner}: | + context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_qrecorp0')], 'active_id': ref('crm_case_qrecorp0')}) self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context) - I convert lead into opportunity for exiting customer. diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 30433751279..1ce9aa1f2aa 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -17,6 +17,7 @@ - !python {model: crm.lead}: | opportunity_ids = self.search(cr, uid, [('partner_id','=', ref("base.res_partner_9"))]) + context.update({'active_model': 'crm.lead', 'active_ids': opportunity_ids, 'active_id': opportunity_ids[0]}) - !record {model: crm.merge.opportunity, id: opportunity_merge_id }: - From 8f8992fdf271d1d5f9367d6e704f4bd86dff9b68 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 16 Dec 2011 12:19:21 +0530 Subject: [PATCH 056/113] [ADD]CRM:update context to fix test case bzr revid: aag@tinyerp.com-20111216064921-dic8xhtpr5po482s --- addons/crm/test/process/merge_opportunity.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index 1ce9aa1f2aa..d06bf96566b 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -36,7 +36,7 @@ Now I schedule another phonecall to customer after merged. - !python {model: crm.phonecall2phonecall}: | - context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) res_id = self.create(cr, uid, {'name': "vos chances sont fusionnés en un seul"}, context=context) self.action_schedule(cr, uid, [res_id], context=context) - From 2c87b0e5f91b099f7b39ee2944a67274c8ccd3f4 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 12:57:54 +0530 Subject: [PATCH 057/113] [IMP] Improved YML test cases of Purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111216072754-s2nwygk3mhp8cvea --- .../purchase_double_validation/__openerp__.py | 4 +- .../purchase_double_validation_demo.yml | 13 ----- .../purchase_double_validation_test.yml | 57 ------------------- 3 files changed, 2 insertions(+), 72 deletions(-) delete mode 100644 addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml delete mode 100755 addons/purchase_double_validation/test/process/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py index e0fb45857e5..17c600fb832 100644 --- a/addons/purchase_double_validation/__openerp__.py +++ b/addons/purchase_double_validation/__openerp__.py @@ -42,8 +42,8 @@ that exceeds minimum amount set by configuration wizard. 'board_purchase_view.xml' ], 'test': [ - 'test/process/purchase_double_validation_demo.yml', - 'test/process/purchase_double_validation_test.yml' + 'test/purchase_double_validation_demo.yml', + 'test/purchase_double_validation_test.yml' ], 'demo_xml': [], 'installable': True, diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml deleted file mode 100644 index 7c074675b75..00000000000 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_demo.yml +++ /dev/null @@ -1,13 +0,0 @@ -- - !record {model: purchase.order, id: order_purchase11}: - partner_id: base.res_partner_desertic_hispafuentes - order_line: - - product_id: product.product_product_pc4 - product_qty: 10 - -- - !record {model: purchase.order, id: order_purchase12}: - partner_id: base.res_partner_vickingdirect0 - order_line: - - product_id: product.product_product_hdd2 - product_qty: 10 diff --git a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml deleted file mode 100755 index 634c1976ea2..00000000000 --- a/addons/purchase_double_validation/test/process/purchase_double_validation_test.yml +++ /dev/null @@ -1,57 +0,0 @@ -- - I Create new limit amount from Configure Limit Amount for Purchase wizard. -- - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: - limit_amount: 3000 -- - Then I set the Limit Amount. -- - !python {model: purchase.double.validation.installer}: | - self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - Test for purchase double validation in which Total > = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase11")) - assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" -- - In order to test the flow, I confirmed the purchase order. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} -- - I check that the order which was initially in the draft state has transmit to confirm state for double validation. -- - !assert {model: purchase.order, id: order_purchase11}: - - state == 'confirmed' -- - I Approved the purchase order. -- - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} -- - I check that the order which was initially in the confirmed state has transmit to approved state. -- - !assert {model: purchase.order, id: order_purchase11}: - - state == 'approved' -- - Test for purchase double validation in which Total < = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase12")) - assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Less then the Limit Amount" -- - I confirmed the purchase order. -- - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} -- - I Approved the purchase order. -- - !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase12} -- - I check that the order has transmit to approved state. -- - !assert {model: purchase.order, id: order_purchase12}: - - state == 'approved' - - From c7027f8e95a4c63b1938257f04e01d74cd11f744 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 13:30:55 +0530 Subject: [PATCH 058/113] [IMP] Improved YML test cases of Purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111216080055-ikpnnuwkaa785pbw --- .../test/purchase_double_validation_demo.yml | 12 +++++ .../test/purchase_double_validation_test.yml | 51 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 addons/purchase_double_validation/test/purchase_double_validation_demo.yml create mode 100755 addons/purchase_double_validation/test/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/test/purchase_double_validation_demo.yml b/addons/purchase_double_validation/test/purchase_double_validation_demo.yml new file mode 100644 index 00000000000..7e91f3fc03a --- /dev/null +++ b/addons/purchase_double_validation/test/purchase_double_validation_demo.yml @@ -0,0 +1,12 @@ +- + !record {model: purchase.order, id: order_purchase11}: + partner_id: base.res_partner_desertic_hispafuentes + order_line: + - product_id: product.product_product_pc4 + product_qty: 10 +- + !record {model: purchase.order, id: order_purchase12}: + partner_id: base.res_partner_vickingdirect0 + order_line: + - product_id: product.product_product_hdd2 + product_qty: 10 \ No newline at end of file diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml new file mode 100755 index 00000000000..cb4841e7fa8 --- /dev/null +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -0,0 +1,51 @@ +- + I Create new limit amount from Configure Limit Amount for Purchase wizard. +- + !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: + limit_amount: 3000 +- + I set the Limit Amount. +- + !python {model: purchase.double.validation.installer}: | + self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) +- + I Test for purchase double validation in which Total > = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase11")) + assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Less then the Limit Amount" +- + In order to test the flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Confirmed state.}: + - state == 'confirmed' +- + I Approved the purchase order. +- + !workflow {model: purchase.order, action: purchase_approve, ref: order_purchase11} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Approved state.}: + - state == 'approved' +- + Test for purchase double validation in which Total < = Limit Amount. +- + !python {model: purchase.order}: | + installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) + purchase_order = self.browse(cr, uid, ref("order_purchase12")) + assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" +- + I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} +- + I check that the order is in approved state. +- + !assert {model: purchase.order, id: order_purchase12, severity: error, string: Purchase Order should be in Approved state.}: + - state == 'approved' \ No newline at end of file From 81b0b37641aabed391922db4aec1526618f394c8 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 16 Dec 2011 18:23:12 +0530 Subject: [PATCH 059/113] [IMP] crm: Improved ymls. bzr revid: uco@tinyerp.com-20111216125312-06ijgxlm150wivuo --- addons/crm/test/process/action_rule.yml | 9 ++++----- addons/crm/test/process/merge_opportunity.yml | 10 +++++----- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/addons/crm/test/process/action_rule.yml b/addons/crm/test/process/action_rule.yml index 7c7fd0bf66a..f96c1eb7391 100644 --- a/addons/crm/test/process/action_rule.yml +++ b/addons/crm/test/process/action_rule.yml @@ -10,14 +10,13 @@ - I create new lead to check record rule. - - !record {model: crm.lead, id: crm_lead_test_rules_id }: - name: 'test leads Ruels' + !record {model: crm.lead, id: crm_lead_test_rules_id}: + name: 'Test lead rules' user_id: base.user_root partner_id: base.res_partner_asus - I check record rule is apply and responsible is changed. - !python {model: crm.lead}: | - user = self.browse(cr, uid, ref('crm_lead_test_rules_id')) - demo_user = self.pool.get("res.users").browse(cr, uid, ref('base.user_demo')) - assert user.user_id.id == demo_user.id, "Responsible is Not changed." + lead_user = self.browse(cr, uid, ref('crm_lead_test_rules_id')) + assert lead_user.user_id.id == ref('base.user_demo'), "Responsible of lead is not changed." diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index d06bf96566b..d3c7e36dd7d 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -9,7 +9,7 @@ I make another opportunity from phonecall for same customer. - !python {model: crm.phonecall2opportunity}: | - context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")], 'active_id': ref("crm.crm_case_phone06")}) + context.update({'active_model': 'crm.phonecall', 'active_ids': [ref("crm.crm_case_phone06")]}) res_id = self.create(cr, uid, {'name': "Quoi de prix de votre autre service?", 'partner_id': ref("base.res_partner_9")}, context=context) self.make_opportunity(cr, uid, [res_id], context=context) - @@ -62,7 +62,7 @@ - I check that the phone call is in 'Cancelled' state. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not cancelled.}: - state == "cancel" - I reset the phone call. @@ -70,12 +70,12 @@ !python {model: crm.phonecall}: | self.case_reset(cr, uid, [ref("crm.crm_case_phone06")]) - - I check that the phone call is reset or not + I check that the phone call is reset or not. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is reset.}: - state == "open" - - I setting phone call to held (done). + I set phone call to held (done). - !python {model: crm.phonecall}: | self.case_close(cr, uid, [ref("crm.crm_case_phone06")]) From 5ddf1b807c62d9a3f6ff32fdaa05ef6d863cb850 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Fri, 16 Dec 2011 18:40:07 +0530 Subject: [PATCH 060/113] [IMP] crm: Improved yml. bzr revid: uco@tinyerp.com-20111216131007-r39ddtoek0re5bt6 --- addons/crm/test/process/merge_opportunity.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/test/process/merge_opportunity.yml b/addons/crm/test/process/merge_opportunity.yml index d3c7e36dd7d..c4e939f194e 100644 --- a/addons/crm/test/process/merge_opportunity.yml +++ b/addons/crm/test/process/merge_opportunity.yml @@ -72,7 +72,7 @@ - I check that the phone call is reset or not. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is reset.}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not reset.}: - state == "open" - I set phone call to held (done). @@ -82,5 +82,5 @@ - I check that the phone call is in 'Held' state. - - !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call held.}: + !assert {model: crm.phonecall, id: crm.crm_case_phone06, string: Phone call is not held.}: - state == "done" From f498776b63cc8bedda98739ced974811c98d5f6b Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 16 Dec 2011 18:54:39 +0530 Subject: [PATCH 061/113] [IMP] improvement in YML test cases in purchase module. bzr revid: tpa@tinyerp.com-20111216132439-ztvw2em8gxh44c0i --- addons/purchase/test/process/cancel_order.yml | 7 ----- .../test/process/invoice_on_poline.yml | 26 +++++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/addons/purchase/test/process/cancel_order.yml b/addons/purchase/test/process/cancel_order.yml index 9ef5597b2d2..4ac8e09443f 100644 --- a/addons/purchase/test/process/cancel_order.yml +++ b/addons/purchase/test/process/cancel_order.yml @@ -4,13 +4,6 @@ I confirm the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase4} -- - I changed Expected Date to Next Day. -- - !python {model: purchase.order}: | - import datetime - next_day = (datetime.date.today()+datetime.timedelta(days=1)) - self.write(cr, uid, [ref("order_purchase4")], {'minimum_planned_date': next_day}) - I check the "Approved" status after confirmed RFQ. - diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index faf0e4354c8..8c61e679cef 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,13 +1,3 @@ -- - I create the Default invoicing control method "Based on Purchase Order Lines". -- - !record {model: purchase.config.wizard, id: invoice_control}: - default_method: manual -- - I set the Default invoicing control method "Based on Purchase Order Lines". -- - !python {model: purchase.config.wizard}: | - self.execute(cr, uid, [ref('invoice_control')]) - In order to test the flow, I start it from confirmed purchase order. - @@ -21,6 +11,16 @@ context.update({'active_model': 'purchase.order', 'active_ids': [ref("order_purchase6")]}) for purchase_line in purchase_order.order_line: invoice_line_obj.makeInvoices(cr, uid, purchase_line.id, context=context) - assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - assert purchase_line.invoiced == True - assert len(purchase_line.invoice_lines) == 1, "Invoice line should be generated." \ No newline at end of file +- + I check the invoice of order. +- + !python {model: purchase.order}: | + purchase_order = self.browse(cr, uid, ref("order_purchase6")) + for purchase_line in purchase_order.order_line: + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." +- + I create the Default invoicing control method "Based on Purchase Order Lines". +- + !python {model: purchase.config.wizard}: | + new_id = self.create(cr ,uid, {'default_method': 'manual'}) + self.execute(cr, uid, [new_id]) \ No newline at end of file From c26ed4d7066e1dd7db4a577a694e2f5b8c4990e3 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 19 Dec 2011 10:45:17 +0530 Subject: [PATCH 062/113] [FiX] typo bzr revid: jam@tinyerp.com-20111219051517-y8t1t4lvjohl2a7c --- addons/resource/test/resource.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/resource/test/resource.yml b/addons/resource/test/resource.yml index 4c9a47ed6e5..5b7fa108101 100644 --- a/addons/resource/test/resource.yml +++ b/addons/resource/test/resource.yml @@ -1,7 +1,7 @@ - In order to test resource. - - I assign workig calendar '45 Hours/Week' to human resource. + I assign working calendar '45 Hours/Week' to human resource. - !python {model: resource.resource}: | self.write(cr, uid, [ref('resource_analyst'), ref('resource_designer'), ref('resource_developer')], {'calendar_id' : ref('timesheet_group1'), 'resource_type': 'user'}) @@ -47,7 +47,7 @@ hours = self.interval_hours_get(cr, uid, ref('timesheet_group1'), dt_from, dt_to, resource=ref('resource_developer')) assert hours > 27 , 'Invalid Total Week working hour calculated' - - Project Analysis work is of 20 hours which will start from Week startso i will calculate working schedule for resource Analyst for the same. + Project Analysis work is of 20 hours which will start from Week start so i will calculate working schedule for resource Analyst for the same. - !python {model: resource.calendar}: | From 1c2ce5e611d1794c8807db32a82d7ffe4e30af9d Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 11:07:49 +0530 Subject: [PATCH 063/113] [IMP] Improved YML string in purchase_double_validation module bzr revid: tpa@tinyerp.com-20111219053749-qevy3tpm8eqh4wl1 --- .../test/purchase_double_validation_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml index cb4841e7fa8..25c75242c1b 100755 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -41,7 +41,7 @@ purchase_order = self.browse(cr, uid, ref("order_purchase12")) assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" - - I confirmed the purchase order. + I confirmed the purchase order of amount of less than Limit amount. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase12} - From ffcd04cdad26e90ec31ebb65055d06d607095045 Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Mon, 19 Dec 2011 12:26:53 +0530 Subject: [PATCH 064/113] [REM] account_asset: Removed extra lines from demo file. bzr revid: uco@tinyerp.com-20111219065653-ut9r63j9kc3nbug3 --- addons/account_asset/account_asset_demo.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account_asset/account_asset_demo.xml b/addons/account_asset/account_asset_demo.xml index 4a3078a9ba1..77185081848 100644 --- a/addons/account_asset/account_asset_demo.xml +++ b/addons/account_asset/account_asset_demo.xml @@ -1,7 +1,7 @@ - @@ -33,9 +33,9 @@ 3 - + --> @@ -56,7 +56,7 @@ - + @@ -68,6 +68,6 @@ - + From 9f6a350e59c037f4428f87be47f1eb26d54f86c5 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 14:19:21 +0530 Subject: [PATCH 065/113] [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 bf46d8163901717af85d796bc7d7c0cc4f20b106 Mon Sep 17 00:00:00 2001 From: "Tejas (OpenERP)" Date: Mon, 19 Dec 2011 14:28:52 +0530 Subject: [PATCH 066/113] Account config wizard problem fixed lp bug: https://launchpad.net/bugs/904244 fixed bzr revid: tta@openerp.com-20111219085852-iygkv1v1fnogtce3 --- addons/account/account.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index e923080f9ad..4affd639b1c 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -3419,7 +3419,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): # Create Bank journals self._create_bank_journals_from_o2m(cr, uid, obj_wizard, company_id, acc_template_ref, context=context) - return True + return {'type' : 'ir.actions.act_window_close'} def _prepare_bank_journal(self, cr, uid, line, current_num, default_account_id, company_id, context=None): ''' From 0919bba650c7df37b97bfea623671faf05c6c8da Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 19 Dec 2011 15:24:03 +0530 Subject: [PATCH 067/113] [IMP]improvement in YML test cases in purchase and purchase_double_validation module. bzr revid: tpa@tinyerp.com-20111219095403-eaz809x63h114kog --- .../test/process/invoice_on_poline.yml | 4 ++-- .../test/purchase_double_validation_test.yml | 24 ++++--------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/addons/purchase/test/process/invoice_on_poline.yml b/addons/purchase/test/process/invoice_on_poline.yml index 8c61e679cef..22d21fa92ed 100644 --- a/addons/purchase/test/process/invoice_on_poline.yml +++ b/addons/purchase/test/process/invoice_on_poline.yml @@ -1,5 +1,5 @@ - - In order to test the flow, I start it from confirmed purchase order. + I confirm purchase order which has invoicing control method "Based on Purchase Order Lines". - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase6} - @@ -19,7 +19,7 @@ for purchase_line in purchase_order.order_line: assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - - I create the Default invoicing control method "Based on Purchase Order Lines". + I set the default invoicing control method "Based on Purchase Order Lines". - !python {model: purchase.config.wizard}: | new_id = self.create(cr ,uid, {'default_method': 'manual'}) diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml index 25c75242c1b..65578d1e5f4 100755 --- a/addons/purchase_double_validation/test/purchase_double_validation_test.yml +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -1,29 +1,20 @@ - - I Create new limit amount from Configure Limit Amount for Purchase wizard. + I set new limit amount from Configure Limit Amount for Purchase . - !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: limit_amount: 3000 -- - I set the Limit Amount. - !python {model: purchase.double.validation.installer}: | self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) -- - I Test for purchase double validation in which Total > = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase11")) - assert purchase_order.amount_total >= installer_amount.limit_amount ,"Total is Less then the Limit Amount" - In order to test the flow, I confirmed the purchase order. - !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase11} - - I check that the order which was initially in the draft state has transmit to confirm state for double validation. + I check that the order which was initially in the draft state has transmit to confirm state for double validation it should not an Approve state. - - !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Confirmed state.}: - - state == 'confirmed' + !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should not be in Approved state.}: + - state != 'approved' - I Approved the purchase order. - @@ -33,13 +24,6 @@ - !assert {model: purchase.order, id: order_purchase11, severity: error, string: Purchase Order should be in Approved state.}: - state == 'approved' -- - Test for purchase double validation in which Total < = Limit Amount. -- - !python {model: purchase.order}: | - installer_amount = self.pool.get('purchase.double.validation.installer').browse(cr, uid, ref("purchase_double_validation_installer_1")) - purchase_order = self.browse(cr, uid, ref("order_purchase12")) - assert purchase_order.amount_total <= installer_amount.limit_amount ,"Total is Greater then the Limit Amount" - I confirmed the purchase order of amount of less than Limit amount. - From 13de087955855a2bbcd91a2e70bda85939e1343e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 19 Dec 2011 17:00:33 +0530 Subject: [PATCH 068/113] [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 069/113] [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 070/113] [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 071/113] [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 From fa15b2adb918169bbf5bfd951e9a7fb2cd77c3d5 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 19 Dec 2011 17:46:11 +0100 Subject: [PATCH 072/113] [REM] leftover debugging prints bzr revid: xmo@openerp.com-20111219164611-bme1yyhbe52ad9cm --- addons/web/common/http.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/web/common/http.py b/addons/web/common/http.py index 4027347683d..900090071c8 100644 --- a/addons/web/common/http.py +++ b/addons/web/common/http.py @@ -141,7 +141,6 @@ class JsonRequest(WebRequest): jsonp = args.get('jsonp') requestf = None request = None - print "ARGS",args if jsonp and self.httprequest.method == 'POST': # jsonp 2 steps step1 POST: save call From 81a9188d898e1fa33750e754a05e71568e108807 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Tue, 20 Dec 2011 11:42:01 +0530 Subject: [PATCH 073/113] [FIX] sale: Give accees right to model_account_invoice_report lp bug: https://launchpad.net/bugs/904805 fixed bzr revid: jap@tinyerp.com-20111220061201-qyje32kc34cjr4jb --- addons/sale/security/ir.model.access.csv | 1 + addons/sale_crm/security/ir.model.access.csv | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale/security/ir.model.access.csv b/addons/sale/security/ir.model.access.csv index 25d063d49e9..2e08a025971 100644 --- a/addons/sale/security/ir.model.access.csv +++ b/addons/sale/security/ir.model.access.csv @@ -58,3 +58,4 @@ access_product_pricelist_type_sale_manager,product.pricelist.type salemanager,pr access_product_pricelist_sale_manager,product.pricelist salemanager,product.model_product_pricelist,base.group_sale_manager,1,1,1,1 access_product_group_res_partner_sale_manager,res_partner group_sale_manager,base.model_res_partner,base.group_sale_manager,1,1,1,0 access_product_pricelist_version_sale_manager,product.pricelist.version sale_manager,product.model_product_pricelist_version,base.group_sale_manager,1,1,1,1 +access_account_invoice_report_salesman,account.invoice.report salesman,account.model_account_invoice_report,base.group_sale_salesman,1,0,0,0 \ No newline at end of file diff --git a/addons/sale_crm/security/ir.model.access.csv b/addons/sale_crm/security/ir.model.access.csv index d4e6eede351..75317a244ad 100644 --- a/addons/sale_crm/security/ir.model.access.csv +++ b/addons/sale_crm/security/ir.model.access.csv @@ -1,2 +1,2 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_account_invoice_report_salesman,account.invoice.report salesman,account.model_account_invoice_report,base.group_sale_salesman,1,0,0,0 + From df44e44cc2a55ca65f94f6fbbc24c3f3a9cab225 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 20 Dec 2011 09:37:16 +0100 Subject: [PATCH 074/113] [FIX] base/module: typo in xml id and name of module category bzr revid: rco@openerp.com-20111220083716-n5ri0z1re0c62jzv --- openerp/addons/base/module/module_data.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/module/module_data.xml b/openerp/addons/base/module/module_data.xml index 2cee6f0fce4..5cf66064a9e 100644 --- a/openerp/addons/base/module/module_data.xml +++ b/openerp/addons/base/module/module_data.xml @@ -7,9 +7,9 @@ - + - Link + Links 0 From fa18dc445f0f7e3ccdde077861dec4b1a0ae9ab3 Mon Sep 17 00:00:00 2001 From: Raphael Collet Date: Tue, 20 Dec 2011 10:38:27 +0100 Subject: [PATCH 075/113] [FIX] procurement: remove yml statement that queries the db asynchronously bzr revid: rco@openerp.com-20111220093827-0lt9tzvlnxxg1nki --- addons/procurement/test/procurement.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/procurement/test/procurement.yml b/addons/procurement/test/procurement.yml index 4c59d0c7b7c..f769715e572 100644 --- a/addons/procurement/test/procurement.yml +++ b/addons/procurement/test/procurement.yml @@ -78,11 +78,12 @@ proc_id = context.get('proc') proc = self.browse(cr, uid, [proc_id])[0] assert proc.state == 'ready' or 'exception',"Procurement should be in Ready or Exception state" -- - I compute minimum stock. -- - !python {model: procurement.orderpoint.compute}: | - proc_id = context.get('proc') - context.update({'active_model': 'procurement.order', 'active_id': proc_id}) - id = self.create(cr, uid, {'automatic': True}, context) - self.procure_calculation(cr, uid, [id], context) +#- +# I compute minimum stock. +# [Note. Commented out because it spawns a thread that may query the db after tests have been reverted.] +#- +# !python {model: procurement.orderpoint.compute}: | +# proc_id = context.get('proc') +# context.update({'active_model': 'procurement.order', 'active_id': proc_id}) +# id = self.create(cr, uid, {'automatic': True}, context) +# self.procure_calculation(cr, uid, [id], context) From 688aaff712172f20fed0cad13cb33422b9951bd6 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Tue, 20 Dec 2011 10:41:10 +0100 Subject: [PATCH 076/113] [REF] refactor date_planned bzr revid: benoit.guillot@akretion.com.br-20111220094110-bay12ed4v850h0q6 --- addons/sale/sale.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index e2487d7c1cf..e56aa7d0968 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -771,6 +771,11 @@ class sale_order(osv.osv): self.pool.get('procurement.order').write(cr, uid, [proc_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty}) return True + def _get_date_planned(self, cr, uid, order, line, start_date, *args): + date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0) + date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) + return date_planned + def _create_pickings_and_procurements(self, cr, uid, order, order_lines, picking_id=False, *args): """Create the required procurements to supply sale order lines, also connecting the procurements to appropriate stock moves in order to bring the goods to the @@ -799,8 +804,7 @@ class sale_order(osv.osv): if line.state == 'done': continue - date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0) - date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT) + date_planned = self._get_date_planned(cr, uid, order, line, order.date_order, *args) if line.product_id: if line.product_id.product_tmpl_id.type in ('product', 'consu'): From 810315fec1fce935e7c8c5b0b5dcbd237310a687 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Tue, 20 Dec 2011 15:11:29 +0530 Subject: [PATCH 077/113] [FIX] point_of_sale: remove the domain from pos catagory field in product form lp bug: https://launchpad.net/bugs/906726 fixed bzr revid: jap@tinyerp.com-20111220094129-ws1y1pgtbn2io74i --- addons/point_of_sale/point_of_sale.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index bff7892b74c..1eb9a0865f7 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -737,7 +737,6 @@ class product_product(osv.osv): 'expense_pdt': fields.boolean('PoS Cash Output', help="This is a product you can use to take cash from a statement for the point of sale backend, exemple: money lost, transfer to bank, etc."), 'img': fields.binary('Product Image, must be 50x50', help="Use an image size of 50x50."), 'pos_categ_id': fields.many2one('pos.category','PoS Category', - domain="[('type','=','normal')]", help="If you want to sell this product through the point of sale, select the category it belongs to.") } product_product() From 7d0bc5e163e359badeca8f13a31098db1b44fc97 Mon Sep 17 00:00:00 2001 From: "Kunal Chavda (OpenERP)" Date: Tue, 20 Dec 2011 15:12:04 +0530 Subject: [PATCH 078/113] [FIX]Fixed code for showing pie chart. lp bug: https://launchpad.net/bugs/906783 fixed bzr revid: kch@tinyerp.com-20111220094204-4qihd3jnxyeggkl4 --- addons/web_graph/static/src/js/graph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web_graph/static/src/js/graph.js b/addons/web_graph/static/src/js/graph.js index 59f56328ffa..e63eec884cd 100644 --- a/addons/web_graph/static/src/js/graph.js +++ b/addons/web_graph/static/src/js/graph.js @@ -173,7 +173,7 @@ openerp.web_graph.GraphView = openerp.web.View.extend({ graph_data = _(graph_data).sortBy(function (point) { return point[self.abscissa] + '[[--]]' + point[self.group_field]; }); - if (this.chart == 'bar' || 'line' || 'area') { + if (_.include(['bar','line','area'],this.chart)) { return this.schedule_bar_line_area(graph_data); } else if (this.chart == "pie") { return this.schedule_pie(graph_data); From c27f0a956d0999a774a799594d3828f11e2eceb3 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Tue, 20 Dec 2011 15:23:08 +0530 Subject: [PATCH 079/113] [FIX]Audittrail:give rights to admin/config and admin/access rights read,write and create auditrules bzr revid: sgo@tinyerp.com-20111220095308-f26huvkwwzfnfr2f --- addons/audittrail/security/ir.model.access.csv | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/audittrail/security/ir.model.access.csv b/addons/audittrail/security/ir.model.access.csv index 25bba6a00b1..1d2198fd661 100644 --- a/addons/audittrail/security/ir.model.access.csv +++ b/addons/audittrail/security/ir.model.access.csv @@ -1,4 +1,5 @@ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink -access_audittrail_rule_all_users,audittrail rule all,model_audittrail_rule,base.group_user,1,0,0,0 +access_audittrail_rule_all_users,audittrail rule all,model_audittrail_rule,base.group_system,1,1,1,0 +access_audittrail_rule_all_access,audittrail rule all,model_audittrail_rule,base.group_erp_manager,1,1,1,0 access_audittrail_log_all_users,audittrail log all,model_audittrail_log,base.group_user,1,0,1,0 access_audittrail_log_line_all_users,audittrail log line all,model_audittrail_log_line,base.group_user,1,0,1,0 From 825ce9d12f11bc84604ac5a759ae8096244270db Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 20 Dec 2011 10:53:58 +0100 Subject: [PATCH 080/113] [IMP] useability seach opportunity bzr revid: fp@tinyerp.com-20111220095358-okei7vuisl1kdt1w --- addons/crm/crm_lead_view.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index e9c77b3bdc6..b508b7d17a5 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -450,7 +450,8 @@ + @@ -149,7 +149,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -210,7 +210,7 @@ - + @@ -241,7 +241,7 @@ equalTo="input[name=new_pwd]" minlength="1"/> - + @@ -289,8 +289,8 @@ - - + + @@ -575,11 +575,11 @@ @@ -930,7 +930,7 @@ @@ -1044,7 +1044,7 @@ method="post" enctype="multipart/form-data" action="/web/binary/upload"> - @@ -1052,7 +1052,7 @@ @@ -1087,7 +1087,7 @@ method="post" enctype="multipart/form-data" action="/web/binary/upload"> - @@ -1096,13 +1096,13 @@ - + @@ -1623,7 +1624,7 @@ - + @@ -1644,7 +1645,7 @@ minlength="1"/> - +
- - @@ -692,8 +692,8 @@
- - + +
@@ -709,10 +709,10 @@ - - - - + + + + @@ -724,7 +724,7 @@ - @@ -916,7 +916,7 @@
- - - - - @@ -1160,8 +1160,8 @@
- - + +
@@ -1401,18 +1401,18 @@
- - + + - + - - + + - +
@@ -1420,8 +1420,8 @@
- - + + + + +
diff --git a/addons/web_dashboard/static/src/css/dashboard.css b/addons/web_dashboard/static/src/css/dashboard.css index 1ac30e905ad..ea8d26c2ad2 100644 --- a/addons/web_dashboard/static/src/css/dashboard.css +++ b/addons/web_dashboard/static/src/css/dashboard.css @@ -42,6 +42,7 @@ .openerp .oe_dashboard_button_create { margin-left: 4px; padding: 0 4px 0 4px; + height: 16px !important; } .openerp a.oe-dashboard-action-rename { diff --git a/addons/web_dashboard/static/src/xml/web_dashboard.xml b/addons/web_dashboard/static/src/xml/web_dashboard.xml index 5f98df612d5..e40d056b314 100644 --- a/addons/web_dashboard/static/src/xml/web_dashboard.xml +++ b/addons/web_dashboard/static/src/xml/web_dashboard.xml @@ -1,11 +1,11 @@