From fd2ab48bf1326c0281bf70ab414edd6ae5ea2163 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 5 Jan 2011 14:07:59 +0200 Subject: [PATCH 1/6] account: Let the 'active' field be set in extended view bzr revid: p_christ@hol.gr-20110105120759-avuetcv4itxqyjwq --- addons/account/account_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b5b4e86bc5f..70a57511098 100755 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -179,6 +179,7 @@ + From 84304484b35647bdefb95495d5fdf2331a468357 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 5 Jan 2011 14:08:08 +0200 Subject: [PATCH 2/6] mrp: fix stray record in security.xml A leftover of previous versions, enough to keep a stray menu item from being deleted, but not adequate to make it appear on new installations. bzr revid: p_christ@hol.gr-20110105120808-e7b763ee018fk8ts --- addons/mrp/security/mrp_security.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/mrp/security/mrp_security.xml b/addons/mrp/security/mrp_security.xml index 743432af745..5e26304d5d3 100755 --- a/addons/mrp/security/mrp_security.xml +++ b/addons/mrp/security/mrp_security.xml @@ -9,11 +9,6 @@ Manufacturing / User - - - - - mrp_production multi-company From 316a1c67918b632f59b1e2d38736dd5019cf9424 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 5 Jan 2011 14:08:11 +0200 Subject: [PATCH 3/6] account: fix cancelling of invoices, after e27a55bc59d In that commit [Bug 675494], the account.move was given a constraint not to unlink records referenced by an invoice. This, however, created a logical deadlock with invoices that tried to cancel and unlink their moves. Now, change the order so that the move is first detached from invoice, then unlinked, and then have the invoice be cancelled. bzr revid: p_christ@hol.gr-20110105120811-o1iavbv8zzhfmdk2 --- addons/account/invoice.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index f094e1c5f3b..c1872db8733 100755 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -1009,15 +1009,13 @@ class account_invoice(osv.osv): return True def action_cancel(self, cr, uid, ids, *args): + context = {} # TODO in v6.1 account_move_obj = self.pool.get('account.move') invoices = self.read(cr, uid, ids, ['move_id', 'payment_ids']) + move_ids = [] # ones that we will need to remove for i in invoices: if i['move_id']: - account_move_obj.button_cancel(cr, uid, [i['move_id'][0]]) - # delete the move this invoice was pointing to - # Note that the corresponding move_lines and move_reconciles - # will be automatically deleted too - account_move_obj.unlink(cr, uid, [i['move_id'][0]]) + move_ids.append(i['move_id'][0]) if i['payment_ids']: account_move_line_obj = self.pool.get('account.move.line') pay_ids = account_move_line_obj.browse(cr, uid, i['payment_ids']) @@ -1025,7 +1023,15 @@ class account_invoice(osv.osv): if move_line.reconcile_partial_id and move_line.reconcile_partial_id.line_partial_ids: raise osv.except_osv(_('Error !'), _('You cannot cancel the Invoice which is Partially Paid! You need to unreconcile concerned payment entries!')) + # First, set the invoices as cancelled and detach the move ids self.write(cr, uid, ids, {'state':'cancel', 'move_id':False}) + if move_ids: + # second, invalidate the move(s) + account_move_obj.button_cancel(cr, uid, move_ids, context=context) + # delete the move this invoice was pointing to + # Note that the corresponding move_lines and move_reconciles + # will be automatically deleted too + account_move_obj.unlink(cr, uid, move_ids, context=context) self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice') return True From 3db2c91659ca79ad9b67cbd79b9d39a653ea2d94 Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 5 Jan 2011 14:08:14 +0200 Subject: [PATCH 4/6] account: fix translatability of the general ledger, in landscape That report is a separate instance of the general ledger report, with an orm name of "account.general.ledger_landscape". If the ir.action.report.xml is not given a reference name in ir.model.data, the landscape report wouldn't be exported under that res_id for translations. bzr revid: p_christ@hol.gr-20110105120814-d5o8be3t3r2500xn --- addons/account/account_report.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index bf17e607e24..fa1f9d28e87 100755 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -2,6 +2,7 @@ + From 5524f49c6f9794f794a94c19b62afeb37d12fcd0 Mon Sep 17 00:00:00 2001 From: pso Date: Wed, 5 Jan 2011 18:20:35 +0530 Subject: [PATCH 5/6] [IMP] Improved yml, demo file to remove static date time by using time library bzr revid: pso@tinyerp.com-20110105125035-s7rknril8gwhm8i7 --- addons/point_of_sale/point_of_sale_demo.xml | 30 +++++++++---------- .../test/point_of_sale_report.yml | 4 +-- .../point_of_sale/test/point_of_sale_test.yml | 8 ++--- addons/project/test/test_project.yml | 14 ++++----- .../test/schedule_phase_tasks.yml | 2 +- .../test/schedule_project_phases.yml | 12 ++++---- .../test/schedule_project_tasks.yml | 2 +- .../test/project_task_procurement.yml | 2 +- .../project_planning/test/planning_states.yml | 4 +-- .../test/deadline_change.yml | 6 ++-- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/addons/point_of_sale/point_of_sale_demo.xml b/addons/point_of_sale/point_of_sale_demo.xml index 03d04d83f70..38987b78cf5 100755 --- a/addons/point_of_sale/point_of_sale_demo.xml +++ b/addons/point_of_sale/point_of_sale_demo.xml @@ -26,7 +26,7 @@ / - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -53,7 +53,7 @@ 2011-04-07 - 2010-10-07 16:53:11 + time.strftime('%Y-%m-%d %H:%M:%S') @@ -62,7 +62,7 @@ paid - 2010-10-07 + time.strftime('%Y-%m-%d') POS/019 tax_excluded @@ -76,7 +76,7 @@ - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -87,7 +87,7 @@ Cash Journal - (test) - 2010-10-07 + time.strftime('%Y-%m-%d') @@ -98,18 +98,18 @@ POS/019 - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') direct POS notes done out - 2010-10-07 16:53:46 - 2010-10-07 16:33:30 + time.strftime('%Y-%m-%d %H:%M:%S') + time.strftime('%Y-%m-%d %H:%M:%S') OUT/00019 none - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') POS/019 @@ -123,12 +123,12 @@ done - 2010-10-07 16:33:30 - 2010-10-07 16:33:30 + time.strftime('%Y-%m-%d %H:%M:%S') + time.strftime('%Y-%m-%d %H:%M:%S') Stock move (POS 12) - 2010-10-07 16:53:46 + time.strftime('%Y-%m-%d %H:%M:%S') @@ -166,7 +166,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC3] Medium PC @@ -178,7 +178,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC2] Basic+ PC (assembly on order) @@ -190,7 +190,7 @@ - 2010/09/15 + time.strftime('%Y-%m-%d') [PC1] Basic PC diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml index 1a77e8f30d4..323d227f7d2 100755 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -89,11 +89,11 @@ !record {model: account.bank.statement, id: account_bank_statement_st0}: name: St.05/19 balance_end_real: 0.0 - date: '2010-05-19' + date: !eval time.strftime('%Y-%m-%d') journal_id: account_journal_cash0 line_ids: - name: statement - date: "2010-10-13" + date: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+5,datetime.now().day)" type: customer account_id: account_pos_account_sales amount: 100 diff --git a/addons/point_of_sale/test/point_of_sale_test.yml b/addons/point_of_sale/test/point_of_sale_test.yml index 347ea961c8f..7e463b1410a 100755 --- a/addons/point_of_sale/test/point_of_sale_test.yml +++ b/addons/point_of_sale/test/point_of_sale_test.yml @@ -289,8 +289,8 @@ - !record {model: pos.order, id: pos_order_pos0}: company_id: base.main_company - date_order: '2010-05-13 15:02:48' - date_validity: '2010-11-13' + date_order: !eval time.strftime('%Y-%m-%d %H:%M:%S') + date_validity: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" lines: - company_id: base.main_company name: Order Line/01 @@ -336,7 +336,7 @@ !record {model: pos.make.payment, id: pos_make_payment_0}: amount: 1615.0 journal: 7 - payment_date: "2010-05-13" + payment_date: !eval time.strftime("%Y-%m-%d") payment_name: Payment product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 @@ -398,7 +398,7 @@ !record {model: pos.make.payment, id: pos_make_payment_1}: amount: 680.0 journal: 7 - payment_date: "2010-05-13" + payment_date: !eval time.strftime("%Y-%m-%d") payment_name: Payment product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 diff --git a/addons/project/test/test_project.yml b/addons/project/test/test_project.yml index bca3bcbff41..f79c2a34224 100755 --- a/addons/project/test/test_project.yml +++ b/addons/project/test/test_project.yml @@ -10,7 +10,7 @@ Create task 'Technical Training' for this project - !record {model: project.task, id: project_task_technicaltraining0}: - date_start: '2010-05-31 11:48:38' + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Technical Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 @@ -20,7 +20,7 @@ Create task 'Functional Training' for this project - !record {model: project.task, id: project_task_functionaltraining0}: - date_start: '2010-05-31 11:49:11' + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Functional Training planned_hours: 30.0 project_id: project_project_openerptrainingprogramme0 @@ -136,7 +136,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 15:04:22' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on OpenERP modules, models and classes user_id: base.user_root @@ -151,7 +151,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-06-01 15:04:46' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on OpenERP xml views user_id: base.user_root @@ -166,7 +166,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-06-02 15:05:24' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on workflows user_id: base.user_root @@ -202,7 +202,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 15:08:40' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 name: Training on reports and wizards user_id: base.user_root @@ -253,7 +253,7 @@ - !record {model: project.task, id: project_task_technicaltraining0, context:{'no_analytic_entry':True}}: work_ids: - - date: '2010-05-31 16:55:27' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 5.0 name: Training on yml user_id: base.user_root diff --git a/addons/project_long_term/test/schedule_phase_tasks.yml b/addons/project_long_term/test/schedule_phase_tasks.yml index aa54fa1ac57..ddfdc47cc7c 100755 --- a/addons/project_long_term/test/schedule_phase_tasks.yml +++ b/addons/project_long_term/test/schedule_phase_tasks.yml @@ -15,7 +15,7 @@ Create phase 'Develop GUI' in Outlook - !record {model: project.phase, id: project_phase_phase0}: - date_start: '2010-06-02' + date_start: !eval time.strftime("%Y-%m-%d") duration: 200.0 name: Develop GUI in Outlook product_uom: product.uom_day diff --git a/addons/project_long_term/test/schedule_project_phases.yml b/addons/project_long_term/test/schedule_project_phases.yml index e06feaaa4ca..38260f4df8c 100755 --- a/addons/project_long_term/test/schedule_project_phases.yml +++ b/addons/project_long_term/test/schedule_project_phases.yml @@ -9,7 +9,7 @@ Create a project phase 'Defining Client's Basic Idea of Project' - !record {model: project.phase, id: project_phase_definingclientsbasicideaofproject0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 15.0 name: "Defining Client's Basic Idea of Project" product_uom: product.uom_day @@ -20,7 +20,7 @@ Create project phase 'Establishing Project Feasibility' - !record {model: project.phase, id: project_phase_establishingprojectfeasibility0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 30.0 name: Establishing Project Feasibility product_uom: product.uom_day @@ -30,7 +30,7 @@ Create project phase 'Preparation of Engineering Designs' - !record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 100.0 name: Preparation of Engineering Designs product_uom: product.uom_hour @@ -41,7 +41,7 @@ Create project phase 'Procurement of Works and Goods' - !record {model: project.phase, id: project_phase_procurementofworksandgoods0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 24.0 name: Procurement of Works and Goods product_uom: product.uom_hour @@ -52,7 +52,7 @@ Create project phase 'Project Construction' - !record {model: project.phase, id: project_phase_projectconstruction0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 4320.0 name: Project Construction product_uom: product.uom_hour @@ -63,7 +63,7 @@ Create project phase 'Project Completion' - !record {model: project.phase, id: project_phase_projectcompletion0}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 240.0 name: Project Completion product_uom: product.uom_hour diff --git a/addons/project_long_term/test/schedule_project_tasks.yml b/addons/project_long_term/test/schedule_project_tasks.yml index 04a05437487..825b7c404d9 100755 --- a/addons/project_long_term/test/schedule_project_tasks.yml +++ b/addons/project_long_term/test/schedule_project_tasks.yml @@ -16,7 +16,7 @@ Create phase 'Develop GUI' in thunderbird - !record {model: project.phase, id: project_phase_phase1}: - date_start: '2010-06-02' + date_start: !eval time.strftime('%Y-%m-%d') duration: 200.0 name: Develop GUI in thunderbird product_uom: product.uom_day diff --git a/addons/project_mrp/test/project_task_procurement.yml b/addons/project_mrp/test/project_task_procurement.yml index a997f09fd04..caea7d70e0a 100755 --- a/addons/project_mrp/test/project_task_procurement.yml +++ b/addons/project_mrp/test/project_task_procurement.yml @@ -19,7 +19,7 @@ I create a sale order for product Partners Training which has type 'Service'. - !record {model: sale.order, id: sale_order_so0}: - date_order: '2010-05-21' + date_order: !eval time.strftime('%Y-%m-%d') invoice_quantity: order name: SO006 order_policy: manual diff --git a/addons/project_planning/test/planning_states.yml b/addons/project_planning/test/planning_states.yml index 12dd38c8247..5d40a199280 100755 --- a/addons/project_planning/test/planning_states.yml +++ b/addons/project_planning/test/planning_states.yml @@ -3,8 +3,8 @@ - !record {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0}: business_days: 20 - date_from: '2010-06-01' - date_to: '2010-06-30' + date_from: !eval time.strftime('%Y-%m-%d') + date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+1,datetime.now().day)" name: Project Planning state: draft user_id: base.user_demo diff --git a/addons/project_retro_planning/test/deadline_change.yml b/addons/project_retro_planning/test/deadline_change.yml index 3e778916792..39dec6bf42a 100755 --- a/addons/project_retro_planning/test/deadline_change.yml +++ b/addons/project_retro_planning/test/deadline_change.yml @@ -10,9 +10,9 @@ Create task 'Plan all projects' - !record {model: project.task, id: project_task_planallprojects0}: - date_deadline: '2010-06-07' - date_end: '2010-06-04 14:00:00' - date_start: '2010-06-01 17:25:32' + date_deadline: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month,datetime.now().day+6)" + date_end: !eval "'%s-%s-%s %s:%s:%s' %(datetime.now().year,datetime.now().month,datetime.now().day+3,datetime.now().hour,datetime.now().minute,datetime.now().second)" + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Plan all projects planned_hours: 24.0 project_id: project_project_retroplanning0 From 5a8ec7c3aa6b95d1ffb142950dc390989c53f567 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Wed, 5 Jan 2011 18:27:00 +0530 Subject: [PATCH 6/6] [IMP] project_timesheet:YML improvements for dates bzr revid: psi@tinyerp.co.in-20110105125700-3lg23srkdyyshnb3 --- .../worktask_entry_to_timesheetline_entry.yml | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml index 7b69627a00a..86ad19c9943 100755 --- a/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml +++ b/addons/project_timesheet/test/worktask_entry_to_timesheetline_entry.yml @@ -1,6 +1,6 @@ -- +- Create a user 'HR Manager' -- +- !record {model: res.users, id: res_users_hrmanager0}: company_id: base.main_company context_lang: en_US @@ -8,11 +8,11 @@ name: HR Manager password: hr groups_id: - - base.group_hr_manager - -- + - base.group_hr_manager + +- Create a product with type service used to specify employees designation -- +- !record {model: product.product, id: product_product_hrmanger0}: categ_id: product.product_category_services cost_method: standard @@ -29,15 +29,15 @@ weight: 0.0 weight_net: 0.0 -- +- Create an analytic journal for employees timesheet -- +- !record {model: account.analytic.journal, id: account_analytic_journal_hrtimesheet0}: company_id: base.main_company name: HR Timesheet type: general -- +- Create an employee 'HR Manager' for user 'HR Manager' - !record {model: hr.employee, id: hr_employee_hrmanager0}: @@ -45,60 +45,60 @@ user_id: res_users_hrmanager0 product_id: product_product_hrmanger0 journal_id: account_analytic_journal_hrtimesheet0 - -- + +- Create a timesheet sheet for HR manager -- +- !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0}: - date_current: '2010-06-03' - date_from: '2010-06-01' - date_to: '2010-06-30' + date_current: !eval time.strftime('%Y-%m-%d') + date_from: !eval "'%s-%s-01' %(datetime.now().year, datetime.now().month)" + date_to: !eval "'%s-%s-30' %(datetime.now().year, datetime.now().month)" name: Sheet for hr manager state: new user_id: res_users_hrmanager0 employee_id : 'hr_employee_hrmanager0' -- +- Create a project 'Timesheet Management' -- +- !record {model: project.project, id: project_project_timesheetmanagement0}: company_id: base.main_company name: Timesheet Management - - -- + + +- Create a task 'Get all timesheet records' -- +- !record {model: project.task, id: project_task_getalltimesheetrecords0}: - date_start: '2010-06-03 14:54:55' + date_start: !eval time.strftime('%Y-%m-%d %H:%M:%S') name: Get all timesheet records planned_hours: 20.0 project_id: project_project_timesheetmanagement0 remaining_hours: 20.0 state: draft user_id: res_users_hrmanager0 - -- + +- Open the task -- +- !python {model: project.task}: | self.do_open(cr, uid, [ref("project_task_getalltimesheetrecords0")], {"lang": "en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz": False, "active_model": "project.project", "department_id": False, "project_id": False, "active_id": ref("project_project_timesheetmanagement0"), }) -- - Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager -- +- + Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager +- !record {model: project.task, id: project_task_getalltimesheetrecords0}: work_ids: - - date: '2010-06-03 15:04:47' + - date: !eval time.strftime('%Y-%m-%d %H:%M:%S') hours: 10.0 - name: Get work calendar of all employees + name: Get work calendar of all employees user_id: res_users_hrmanager0 - Check for timesheet_ids in HR manager's timesheet - !assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}: - - len(timesheet_ids) > 0 + - len(timesheet_ids) > 0