From 295072d148d0b577d9da243c7b14e918c2bcb7a3 Mon Sep 17 00:00:00 2001 From: "Jay (OpenERP)" Date: Wed, 1 Sep 2010 14:28:54 +0530 Subject: [PATCH 01/11] [FIX] mrp_repair : Creation of invoices corrected from repairs with fees bzr revid: jvo@tinyerp.com-20100901085854-cy7sr8m2bpa1ozn6 --- addons/mrp_repair/mrp_repair.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 99037a91994..edc14955ce9 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -397,6 +397,16 @@ class mrp_repair(osv.osv): name = repair.name + '-' + fee.name else: name = fee.name + if not fee.product_id: + raise osv.except_osv(_('Warning !'), _('No product defined on Fees!')) + + if fee.product_id.property_account_income: + account_id = fee.product_id.property_account_income + elif fee.product_id.categ_id.property_account_income_categ: + account_id = fee.product_id.categ_id.property_account_income_categ.id + else: + raise osv.except_osv(_('Error !'), _('No account defined for product "%s".') % fee.product_id.name) + invoice_fee_id = inv_line_obj.create(cr, uid, { 'invoice_id': inv_id, 'name': name, From 34f623bd25d361db31ef1d6812597b97bf93916e Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 15:05:12 +0530 Subject: [PATCH 02/11] [FIX] project: pass context withoutemployee=true in test work detail entry. when project_timesheet module install, yml is fail bzr revid: hmo@tinyerp.com-20100901093512-i71z1v0of4l8xtuw --- addons/project/test/test_project.yml | 10 +++++----- addons/project_timesheet/project_timesheet.py | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index 25dc0c4a47f..bbdaa57d617 100644 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -142,7 +142,7 @@ - Make a work task entry 'Training on OpenERP modules, models and classes' of 10 hours - - !record {model: project.task, id: project_task_technicaltraining0}: + !record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}: work_ids: - date: '2010-05-31 15:04:22' hours: 10.0 @@ -159,7 +159,7 @@ - Make a work task entry 'Training on OpenERP xml views' of 10 hours - - !record {model: project.task, id: project_task_technicaltraining0}: + !record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}: work_ids: - date: '2010-06-01 15:04:46' hours: 10.0 @@ -176,7 +176,7 @@ - Make a work task entry 'Training on workflows' of 10 hours - - !record {model: project.task, id: project_task_technicaltraining0}: + !record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}: work_ids: - date: '2010-06-02 15:05:24' hours: 10.0 @@ -216,7 +216,7 @@ - Make a work task entry 'Training on reports and wizards' of 10 hours - - !record {model: project.task, id: project_task_technicaltraining0}: + !record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}: work_ids: - date: '2010-05-31 15:08:40' hours: 10.0 @@ -271,7 +271,7 @@ - Make a work task entry 'Training on yml' of 5 hours - - !record {model: project.task, id: project_task_technicaltraining0}: + !record {model: project.task, id: project_task_technicaltraining0, context: {'withoutemployee': True}}: work_ids: - date: '2010-05-31 16:55:27' hours: 5.0 diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 26368e109c5..94d0d0687fa 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -66,6 +66,10 @@ class project_work(osv.osv): vals_line = {} context = kwargs.get('context', {}) + #TOFIX: after loading project_timesheet module, it's fail yml of other project* modules. + #Temporary: pass context['withoutemployee'] = True in all yml. + if 'withoutemployee' in context and context['withoutemployee']: + return super(project_work,self).create(cr, uid, vals, context=context) obj_task = task_obj.browse(cr, uid, vals['task_id']) result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') From f3684e927475478f03a42684b9389b8c44a4e70a Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 15:23:39 +0530 Subject: [PATCH 03/11] [FIX] lunch: yml issue bzr revid: hmo@tinyerp.com-20100901095339-mxashqfc4k3dwi3n --- addons/lunch/test/test_lunch.yml | 50 +++++++++++----------- addons/lunch/wizard/lunch_cashbox_clean.py | 22 +++++----- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/addons/lunch/test/test_lunch.yml b/addons/lunch/test/test_lunch.yml index 97ed41b2abc..6af4113f153 100644 --- a/addons/lunch/test/test_lunch.yml +++ b/addons/lunch/test/test_lunch.yml @@ -87,6 +87,30 @@ - !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}: - sum_remain == -5.50 + +- | + I cancel the order "LU002" +- + !record {model: lunch.order.cancel, id: lunch_order_cancel_0}: + {} +- | + I click on "Yes" button of this wizard for cancel order. + +- + !python {model: lunch.order.cancel}: | + self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]}) + +- | + I test that the Cash Moves record have been removed for the order LU002. +- + !assert {model: lunch.order, id: lunch_order_1}: + - cashmove.id == False + +- | + I check that the Total on the "Employee Cashbox" is -2.75 +- + !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}: + - sum_remain == -2.75 - | I reset the "Employee Cashbox" to zero using the "Set CashBox to Zero" wizard. - @@ -103,28 +127,4 @@ - !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}: - sum_remain == 0.00 - -- | - I cancel the order "LU002" -- - !record {model: lunch.order.cancel, id: lunch_order_cancel_0}: - {} -- | - I click on "Yes" button of this wizard for cancel order. - -- - !python {model: lunch.order.cancel}: | - self.cancel(cr, uid, [ref('lunch_order_cancel_0')], {'active_ids': [ref('lunch_order_1')]}) - -- | - I test that the Cash Moves revord have been removed for the order LU002. -- - !assert {model: lunch.order, id: lunch_order_1}: - - cashmove.id == False - -- | - I check that the Total on the "Employee Cashbox" is -2.75 -- - !assert {model: lunch.cashbox, id: lunch_cashbox_cashbox0}: - - sum_remain == -2.75 - \ No newline at end of file + diff --git a/addons/lunch/wizard/lunch_cashbox_clean.py b/addons/lunch/wizard/lunch_cashbox_clean.py index 54ecaf24b6f..967d77676f1 100644 --- a/addons/lunch/wizard/lunch_cashbox_clean.py +++ b/addons/lunch/wizard/lunch_cashbox_clean.py @@ -35,10 +35,9 @@ class lunch_cashbox_clean(osv.osv_memory): @param ids: List Lunch cashbox Clean’s IDs @return:Dictionary {}. """ - + #TOFIX: use orm methods data = context and context.get('active_ids', []) or [] cashmove_ref = self.pool.get('lunch.cashmove') - cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove \ where active = 't' and box IN %s group by user_cashmove, \ box" , (tuple(data),)) @@ -46,15 +45,16 @@ class lunch_cashbox_clean(osv.osv_memory): cr.execute("update lunch_cashmove set active = 'f' where active= 't' \ and box IN %s" , (tuple(data),)) - - for (user_id, box_id, amount) in res: - cashmove_ref.create(cr, uid, { - 'name': 'Summary for user' + str(user_id), - 'amount': amount, - 'user_cashmove': user_id, - 'box': box_id, - 'active': True, - }) + #TOCHECK: Why need to create duplicate entry after clean box ? + + #for (user_id, box_id, amount) in res: + # cashmove_ref.create(cr, uid, { + # 'name': 'Summary for user' + str(user_id), + # 'amount': amount, + # 'user_cashmove': user_id, + # 'box': box_id, + # 'active': True, + # }) return {} lunch_cashbox_clean() From db0aabdaea09f88a689d1902dea549ae9a769d2d Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 1 Sep 2010 11:47:34 +0200 Subject: [PATCH 04/11] [REF] project_issue: Indent the data file bzr revid: stephane@openerp.com-20100901094734-28a2p406slmfr7qy --- addons/project_issue/project_issue_data.xml | 128 ++++++++++---------- 1 file changed, 61 insertions(+), 67 deletions(-) diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index fb914dfaca2..c24c87e454c 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -1,75 +1,69 @@ - + - - - - - Bugs - - - + + - - Feature Requests - - - + + Bugs + + + - - - - Version 4.2 - - - - - - Version 4.4 - - - + + Feature Requests + + + - - - - - Accepted as Bug - - - - - Fixed - - - - - Won't fix - - - - - Invalid - - - - - Awaiting Response - - - - - Works For Me - - - + + + + Version 4.2 + + + - + + Version 4.4 + + + + + + + + + Accepted as Bug + + + + + Fixed + + + + + Won't fix + + + + + Invalid + + + + + Awaiting Response + + + + + Works For Me + + + + + From 00465a58851b49da384501bb828eb6f5bc9fde72 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 1 Sep 2010 11:48:31 +0200 Subject: [PATCH 05/11] [FIX] project_issue: Change a label and add new version bzr revid: stephane@openerp.com-20100901094831-zar6xf0q1mgkv802 --- addons/project_issue/project_issue_data.xml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/project_issue/project_issue_data.xml b/addons/project_issue/project_issue_data.xml index c24c87e454c..0ad753b0004 100644 --- a/addons/project_issue/project_issue_data.xml +++ b/addons/project_issue/project_issue_data.xml @@ -6,7 +6,7 @@ - Bugs + Maintenance @@ -26,7 +26,13 @@ - Version 4.4 + Version 5.0 + + + + + + Version 6.0 From 4cd005c978af74061f600dc2062de063e1c3a349 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 1 Sep 2010 11:49:27 +0200 Subject: [PATCH 06/11] [FIX] project_issue: Add a menuitem for the categories of the projects bzr revid: stephane@openerp.com-20100901094927-cuo1hu5ikrmstlxb --- addons/project_issue/project_issue_view.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 1fdd6c278ab..f1e4d34f54c 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -13,6 +13,8 @@ {'object_id':'project.issue'} + + Issue Stages crm.case.stage From 8f52e7ee73a717e4006ef9763c4f2b0fd643e5bc Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 16:17:00 +0530 Subject: [PATCH 07/11] [FIX] account: yml issue bzr revid: hmo@tinyerp.com-20100901104700-68b8cb6ztqda40dx --- addons/account/test/account_customer_invoice.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/test/account_customer_invoice.yml b/addons/account/test/account_customer_invoice.yml index 0eaa3a688c6..b32a22cf9de 100644 --- a/addons/account/test/account_customer_invoice.yml +++ b/addons/account/test/account_customer_invoice.yml @@ -131,6 +131,7 @@ !record {model: account.invoice.refund, id: account_invoice_refund_0}: description: Refund To China Export period: account.period_5 + filter_refund: refund - I clicked on refund button - From 89151b0a71e09919b23e8405ade967d13eb91270 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 16:38:01 +0530 Subject: [PATCH 08/11] [FIX] hr_holiday, hr_timesheet, idea: user login should unique in yml like test_idea_user1, test_dea_user2 bzr revid: hmo@tinyerp.com-20100901110801-8rm8nhgyxgbhcqpr --- addons/hr_holidays/test/test_hr_holiday.yml | 18 +++++++-------- .../hr_timesheet/test/test_hr_timesheet.yml | 22 +++++++++---------- addons/idea/test/test_idea.yml | 22 +++++++++---------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/addons/hr_holidays/test/test_hr_holiday.yml b/addons/hr_holidays/test/test_hr_holiday.yml index 6a124be59c2..f5a3b21c7a3 100644 --- a/addons/hr_holidays/test/test_hr_holiday.yml +++ b/addons/hr_holidays/test/test_hr_holiday.yml @@ -1,18 +1,18 @@ - In order to test the hr_holiday module in OpenERP, I will Allocate leaves for Employee and manage leaves and leaves requests. - - I create new user "user1" who will make leave request. + I create new user "test_holiday_user1" who will make leave request. - - !record {model: res.users, id: res_users_user0}: + !record {model: res.users, id: test_holiday_user1}: company_id: base.main_company context_lang: en_US groups_id: - base.group_user - base.group_hr_manager - base.group_hr_user - login: user1 - name: user1 - password: user1 + login: test_holiday_user1 + name: test_holiday_user1 + password: test_holiday_user1 - I create a new employee “Mark Johnshon” as Manager to validate employee leave. - @@ -23,13 +23,13 @@ name: Mark Johnson user_id: base.user_root - - I Create another employee "Phil Graves" as "user1". + I Create another employee "Phil Graves" as "test_holiday_user1". - !record {model: hr.employee, id: hr_employee_philgraves0}: address_home_id: base.res_partner_address_8 name: Phil Graves parent_id: 'hr_employee_employee0' - user_id: 'res_users_user0' + user_id: 'test_holiday_user1' - I create a new Leave type "Sick Leave". - @@ -61,7 +61,7 @@ !workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0} - - I connect as "user1", and create a new leave request for employee "Phil Graves". + I connect as "test_holiday_user1", and create a new leave request for employee "Phil Graves". - !record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}: allocation_type: employee @@ -73,7 +73,7 @@ notes: My appointment with the doctor is confirmed. so please accept my leave. number_of_days_temp: 2.0 type: remove - user_id: 'res_users_user0' + user_id: 'test_holiday_user1' - I check that Leave Request is in "Draft" state. - diff --git a/addons/hr_timesheet/test/test_hr_timesheet.yml b/addons/hr_timesheet/test/test_hr_timesheet.yml index 14c32210517..d962c627cdd 100644 --- a/addons/hr_timesheet/test/test_hr_timesheet.yml +++ b/addons/hr_timesheet/test/test_hr_timesheet.yml @@ -14,9 +14,9 @@ user_id: base.user_root - - I create new user "user1". + I create new user "test_timesheet_user1". - - !record {model: res.users, id: res_users_user0}: + !record {model: res.users, id: test_timesheet_user1}: company_id: base.main_company context_lang: en_US groups_id: @@ -25,18 +25,18 @@ - base.group_user - base.group_extended - base.group_hr_manager - login: user1 - name: user1 - password: user1 + login: test_timesheet_user1 + name: test_timesheet_user1 + password: test_timesheet_user1 - - I create another new employee "Francline" as "user1". + I create another new employee "Francline" as "test_timesheet_user1". - !record {model: hr.employee, id: hr_employee_fracline1}: address_home_id: base.res_partner_address_8 name: Francline parent_id: 'hr_employee_employee0' - user_id: 'res_users_user0' + user_id: 'test_timesheet_user1' - I create Timesheet journal for employee. @@ -94,13 +94,13 @@ On "Sign In/Sign Out by Project" wizard i click on "Sign In/Sign Out" button of this wizard. - !python {model: hr.sign.in.project}: | - uid = ref('res_users_user0') + uid = ref('test_timesheet_user1') self.check_state(cr, uid, [ref("hr_employee_fracline1")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]}) - I select start date and Perform start work on project. - !python {model: hr.sign.in.project}: | - uid = ref('res_users_user0') + uid = ref('test_timesheet_user1') new_id = self.create(cr, uid, {'emp_id': ref('hr_employee_fracline1'), 'name': 'Francline', 'server_date': '2010-06-08 19:50:54', 'state': 'absent'}) self.sign_in_result(cr, uid, [new_id], context) @@ -109,7 +109,7 @@ Which check state in hr attendace form for user. - !python {model: hr.sign.in.project}: | - uid = ref('res_users_user0') + uid = ref('test_timesheet_user1') ids = self.search(cr, uid, [('emp_id', '=', ref('hr_employee_fracline1')),('name', '=', 'Francline')]) self.check_state(cr, uid, ids, {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")] }) @@ -130,7 +130,7 @@ !python {model: hr.sign.out.project}: | import time from datetime import datetime, date, timedelta - uid = ref('res_users_user0') + uid = ref('test_timesheet_user1') new_id = self.create(cr, uid, {'account_id': ref('account_analytic_account_project0'), 'analytic_amount': 7.0, 'date': (datetime.now()+timedelta(1)).strftime('%Y-%m-%d %H:%M:%S'), 'date_start': '2010-06-05 16:37:00', 'info': 'Create Yaml for hr module', 'name': 'Francline', 'server_date': '2010-06-09 16:40:15', 'state': 'absent'}) self.sign_out_result_end(cr, uid, [new_id], context) diff --git a/addons/idea/test/test_idea.yml b/addons/idea/test/test_idea.yml index a7099478932..307344cf584 100644 --- a/addons/idea/test/test_idea.yml +++ b/addons/idea/test/test_idea.yml @@ -30,37 +30,37 @@ !workflow {model: idea.idea, action: idea_open, ref: idea_idea_0} - | - In order to check voting statistics in real systems I will create 2 new Users "user1". + In order to check voting statistics in real systems I will create 2 new Users "test_idea_user1". - - !record {model: res.users, id: res_users_user0}: + !record {model: res.users, id: test_idea_user1}: company_id: base.main_company context_lang: en_US - login: idea_user1 + login: test_idea_user1 name: Idea test user1 - password: user1 + password: test_idea_user1 groups_id: [ base.group_tool_user, ] - | And I will also create user2. - - !record {model: res.users, id: res_users_user1}: + !record {model: res.users, id: test_idea_user2}: company_id: base.main_company context_lang: en_US - login: idea_user2 + login: test_idea_user2 name: Idea test user2 - password: user2 + password: test_idea_user2 groups_id: [ base.group_tool_user, ] - | - In order to post vote I connect as user1 and open the idea page + In order to post vote I connect as test_idea_user1 and open the idea page I click on "Submit Vote" wizard button and vote the idea as "Normal" - !python {model: idea.post.vote}: | - uid2 = ref('res_users_user0') + uid2 = ref('test_idea_user1') new_id = self.create(cr, uid2, {'vote': 50}, {"active_ids": [ref("idea_idea_0")]}) self.do_vote(cr, uid2, [new_id], {"active_ids": [ref("idea_idea_0")]}) - | - To add other vote I connect as user2 and open the idea page. + To add other vote I connect as test_idea_user2 and open the idea page. I click on "Submit Vote" wizard button and vote the idea as "Very Good". @@ -68,7 +68,7 @@ - !python {model: idea.post.vote}: | - uid2 = ref('res_users_user1') + uid2 = ref('test_idea_user2') new_id = self.create(cr, uid2, {'vote': 100, 'note': 'We can learn many things from technical presentation'}, {"active_ids": [ref("idea_idea_0")]}) self.do_vote(cr, uid2, [new_id], {'active_ids': [ref('idea_idea_0')]}) From fba26769737faaca133861b52c56261fdd0f5e3e Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 17:02:21 +0530 Subject: [PATCH 09/11] [FIX] project_retro_planning: yml issue bzr revid: hmo@tinyerp.com-20100901113221-9e66kmouptbwty0i --- addons/project_retro_planning/test/deadline_change.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/project_retro_planning/test/deadline_change.yml b/addons/project_retro_planning/test/deadline_change.yml index 8b1f316c6ae..b15fb485a86 100644 --- a/addons/project_retro_planning/test/deadline_change.yml +++ b/addons/project_retro_planning/test/deadline_change.yml @@ -33,10 +33,10 @@ new_end_date = date.today()+timedelta(1) res={} for task in prj.tasks: - start_dt = (datetime(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:6])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') + start_dt = (datetime(*time.strptime(task.date_start,'%Y-%m-%d %H:%M:%S')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d %H:%M:%S') deadline_dt='' if task.date_deadline: - deadline_dt = (datetime(*time.strptime(task.date_deadline,'%Y-%m-%d')[:6])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') + deadline_dt = (datetime(*time.strptime(task.date_deadline,'%Y-%m-%d')[:3])+(new_end_date-old_end_date)).strftime('%Y-%m-%d') res[task.id]=[start_dt,deadline_dt] self.write(cr, uid, [ref("project_project_retroplanning0")], {'date' : (datetime.now()+timedelta(1)).strftime('%Y-%m-%d')}) data_project = self.browse(cr,uid,[ref("project_project_retroplanning0")]) @@ -44,4 +44,4 @@ for task in prj.tasks: assert task.date_start == res[task.id][0], "task start date differs, expected %s, got %s"%(res[task.id][0], task.date_start) - assert task.date_deadline == res[task.id][1], "task deadline date differs, expected %s, got %s"%(res[task.id][1], task.date_deadline) \ No newline at end of file + assert task.date_deadline == res[task.id][1], "task deadline date differs, expected %s, got %s"%(res[task.id][1], task.date_deadline) From 297ba866c02e004ab6a67303624a8c2592282ccb Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 1 Sep 2010 17:15:41 +0530 Subject: [PATCH 10/11] [FIX] account_payment: yml issue bzr revid: hmo@tinyerp.com-20100901114541-q1loyxtl09jubvv4 --- addons/account_payment/test/account_payment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account_payment/test/account_payment.yml b/addons/account_payment/test/account_payment.yml index 3379ebe9003..b4e758a7dd8 100644 --- a/addons/account_payment/test/account_payment.yml +++ b/addons/account_payment/test/account_payment.yml @@ -11,6 +11,7 @@ Creating a res.partner.bank record - !record {model: res.partner.bank, id: res_partner_bank_0}: + name: 'Test Bank Account' acc_number: '0001' partner_id: base.res_partner_9 sequence: 0.0 From 4ecbf905cc2710e742eae491f0f3c833f303cb1b Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 1 Sep 2010 17:28:23 +0530 Subject: [PATCH 11/11] [FIX] Wiki: yml issue An osv_memory object need not be created, but just reference an arbitrary id. Let the page have some modifications, and then search its history for bzr revid: hmo@tinyerp.com-20100901115823-agwkfnmu04yo67nn --- addons/wiki/test/wiki_test00.yml | 30 ++++++++++++++++++---------- addons/wiki/wiki.py | 4 ++-- addons/wiki/wizard/wiki_show_diff.py | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/addons/wiki/test/wiki_test00.yml b/addons/wiki/test/wiki_test00.yml index c77e714b961..d5a9cbc4bbb 100755 --- a/addons/wiki/test/wiki_test00.yml +++ b/addons/wiki/test/wiki_test00.yml @@ -21,24 +21,34 @@ FAQs, quality manuals, technical references, etc. ' -- - Creating a wiki make index record -- - !record {model: wiki.make.index, id: wiki_make_index_1}: - {} - I create Index on this current page by clicking on "Create Index" wizard - !python {model: wiki.make.index}: | - self.wiki_do_index(cr, uid, [ref("wiki_make_index_1")], {"active_model": - wiki.wiki, "active_ids": [ref("wiki_wiki_openerpwikiediting0")], "tz": False, "active_id": - ref("wiki_wiki_openerpwikiediting0"), }) + self.wiki_do_index(cr, uid, [1], {"active_model": "wiki.wiki", + "active_ids": [ref("wiki_wiki_openerpwikiediting0")], "tz": False, + "active_id": ref("wiki_wiki_openerpwikiediting0"), }) +- + Now I will update the wikipage with other text +- + !record {model: wiki.wiki, id: wiki_wiki_openerpwikiediting0}: + text_area: '=The Open ERP wiki= + + The Open ERP wiki allows you to manage your enterprise contents using wiki + + restructured texts. This module provides a collaborative way to manage internal + + FAQs, quality manuals, technical references, etc. + + Wiki text can easily be edited + ' - I check the page history for the current page by clicking on "Page History".After that find difference between history. - !python {model: wizard.wiki.history.show_diff}: | - ids = self.search(cr, uid, []) - self.get_diff(cr, uid, {'active_id': [ref('wiki_wiki_openerpwikiediting0')]}) + hist_obj = model.pool.get('wiki.wiki.history') + ids = hist_obj.search(cr, uid, [('wiki_id', '=', ref("wiki_wiki_openerpwikiediting0"))]) + model.get_diff(cr, uid, {'active_ids': ids[:] }) - I create a new wiki group on the Given Home Page - diff --git a/addons/wiki/wiki.py b/addons/wiki/wiki.py index 2cf22170cec..ab19dc8f4eb 100644 --- a/addons/wiki/wiki.py +++ b/addons/wiki/wiki.py @@ -222,7 +222,7 @@ class History(osv.osv): 'write_uid': lambda obj, cr, uid, context: uid, } - def getDiff(self, cr, uid, v1, v2, context={}): + def getDiff(self, cr, uid, v1, v2, context=None): """ @param cr: the current row, from the database cursor, @param uid: the current user’s ID for security checks, """ @@ -236,7 +236,7 @@ class History(osv.osv): if text2: line2 = text2.splitlines(1) if (not line1 and not line2) or (line1 == line2): - raise osv.except_osv(_('Warning !'), _('There are no chnages in revisions')) + raise osv.except_osv(_('Warning !'), _('There are no changes in revisions')) diff = difflib.HtmlDiff() return diff.make_file(line1, line2, "Revision-%s" % (v1), "Revision-%s" % (v2), context=False) diff --git a/addons/wiki/wizard/wiki_show_diff.py b/addons/wiki/wizard/wiki_show_diff.py index 7654ce3e153..43f3f698611 100644 --- a/addons/wiki/wizard/wiki_show_diff.py +++ b/addons/wiki/wizard/wiki_show_diff.py @@ -34,7 +34,7 @@ class showdiff(osv.osv_memory): @param uid: the current user’s ID for security checks, """ history = self.pool.get('wiki.wiki.history') - ids = context.get('active_ids') + ids = context.get('active_ids', []) diff = "" if len(ids) == 2: