From ee941671d2c391d085f153f6496bc755a900813d Mon Sep 17 00:00:00 2001 From: "Amit Bhavsar (Open ERP)" Date: Thu, 19 Jul 2012 14:15:42 +0530 Subject: [PATCH 1/6] [FIX] account : Improve the code. lp bug: https://launchpad.net/bugs/1026434 fixed bzr revid: amb@tinyerp.com-20120719084542-la8jx5qxiefwoojr --- addons/account/wizard/account_move_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 66f634bd59f..a84c7f8eabb 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -99,7 +99,7 @@ class account_move_journal(osv.osv_memory): period = False if period_id: - period = period_pool.browse(cr, uid, [period_id], ['name'])[0]['name'] + period = period_pool.browse(cr, uid, [period_id], context=None)[0]['name'] period_string = _("Period: %s") % tools.ustr(period) open_string = _("Open") From 5c31f52c47c8205703a4da666a01916f9971b522 Mon Sep 17 00:00:00 2001 From: "Cristian Salamea (Gnuthink)" <> Date: Thu, 19 Jul 2012 17:49:45 +0530 Subject: [PATCH 2/6] [FIX]l10n_ec: Change The name of Author lp bug: https://launchpad.net/bugs/1026085 fixed bzr revid: dsi@tinyerp.com-20120719121945-nmad9m98t3q77tet --- addons/l10n_ec/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_ec/__openerp__.py b/addons/l10n_ec/__openerp__.py index 9dd81606036..13d11f03b9d 100644 --- a/addons/l10n_ec/__openerp__.py +++ b/addons/l10n_ec/__openerp__.py @@ -27,7 +27,7 @@ This is the base module to manage the accounting chart for Ecuador in OpenERP. Accounting chart and localization for Ecuador. """, - 'author': 'OpenERP SA', + 'author': 'Gnuthink Co.Ltd.', 'depends': [ 'account', 'base_vat', From dd55d30961d370546267deafefc0ba614e728a0e Mon Sep 17 00:00:00 2001 From: "Amit Bhavsar (Open ERP)" Date: Fri, 20 Jul 2012 11:35:06 +0530 Subject: [PATCH 3/6] [FIX] account : Improve the code lp bug: https://launchpad.net/bugs/1026434 fixed bzr revid: amb@tinyerp.com-20120720060506-clb6z56xa5tqzyy3 --- addons/account/wizard/account_move_journal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index a84c7f8eabb..ea2244edb15 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -99,7 +99,7 @@ class account_move_journal(osv.osv_memory): period = False if period_id: - period = period_pool.browse(cr, uid, [period_id], context=None)[0]['name'] + period = period_pool.browse(cr, uid, [period_id], context=context)[0]['name'] period_string = _("Period: %s") % tools.ustr(period) open_string = _("Open") From a0f23eb60b5cbd352bc5dbecd81bc2e098607df3 Mon Sep 17 00:00:00 2001 From: "olt@tinyerp.com" <> Date: Mon, 17 Sep 2012 10:10:17 +0200 Subject: [PATCH 4/6] [FIX] anonymization: raise a good descriptive error when the state is 'unstable' bzr revid: olt@tinyerp.com-20120917081017-s15mm36ppvs4lfxc --- addons/anonymization/anonymization.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/anonymization/anonymization.py b/addons/anonymization/anonymization.py index 47e168a12b8..6b6db168a4f 100644 --- a/addons/anonymization/anonymization.py +++ b/addons/anonymization/anonymization.py @@ -64,11 +64,13 @@ class ir_model_fields_anonymization(osv.osv): state = 'anonymized' # all fields are anonymized else: state = 'unstable' # fields are mixed: this should be fixed + return state def _check_write(self, cr, uid, context=None): # check that the field is created from the menu and not from an database update # otherwise the database update can crash: + if context.get('manual'): global_state = self._get_global_state(cr, uid, context=context) if global_state == 'anonymized': @@ -100,12 +102,16 @@ class ir_model_fields_anonymization(osv.osv): # check field state: all should be clear before we can add a new field to anonymize: self._check_write(cr, uid, context=context) + global_state = self._get_global_state(cr, uid, context=context) + if 'field_name' in vals and vals['field_name'] and 'model_name' in vals and vals['model_name']: vals['model_id'], vals['field_id'] = self._get_model_and_field_ids(cr, uid, vals, context=context) # check not existing fields: if not vals.get('field_id'): vals['state'] = 'not_existing' + else: + vals['state'] = global_state res = super(ir_model_fields_anonymization, self).create(cr, uid, vals, context=context) @@ -340,8 +346,9 @@ class ir_model_fields_anonymize_wizard(osv.osv_memory): # remove the placeholer: eview.remove(placeholder) else: - # unstable ? - raise + msg = "The database anonymization is currently in an unstable state. Some fields are anonymized," + \ + " while some fields are not anonymized. You should try to solve this problem before trying to do anything else." + raise osv.except_osv('Error !', msg) res['arch'] = etree.tostring(eview) From fabf4971aaaebb03d3bc7c582b5acb68082c0a2c Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 17 Sep 2012 10:14:51 +0200 Subject: [PATCH 5/6] [FIX] timesheet_sheet should not crash anymmore when tests are performed at 23:59 bzr revid: fp@tinyerp.com-20120917081451-ugk1qi0le22kn44n --- addons/hr_attendance/hr_attendance.py | 2 +- .../test/test_hr_timesheet_sheet.yml | 26 +++++++++++-------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index d3bc79bda1a..8fdd2928fe6 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -55,7 +55,7 @@ class hr_attendance(osv.osv): 'name': fields.datetime('Date', required=True, select=1), 'action': fields.selection([('sign_in', 'Sign In'), ('sign_out', 'Sign Out'), ('action','Action')], 'Action', required=True), 'action_desc': fields.many2one("hr.action.reason", "Action Reason", domain="[('action_type', '=', action)]", help='Specifies the reason for Signing In/Signing Out in case of extra hours.'), - 'employee_id': fields.many2one('hr.employee', "Employee's Name", required=True, select=True), + 'employee_id': fields.many2one('hr.employee', "Employee", required=True, select=True), 'day': fields.function(_day_compute, type='char', string='Day', store=True, select=1, size=32), } _defaults = { diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml index 99705b07a39..070079a4b80 100644 --- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -13,7 +13,7 @@ product_id: product.product_product_consultant journal_id: hr_timesheet.analytic_journal - - I create my current timesheet for employee "Quentin Paolinon". + I create a timesheet for employee "Quentin Paolinon". - !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}: date_current: !eval time.strftime('%Y-%m-%d') @@ -23,13 +23,17 @@ user_id: base.user_demo employee_id: 'hr.employee_qdp' - - Now, at the time of login, I create Attendances and perform "Sign In" action. + Quentin "Sign In" at around 9am. - - !python {model: hr_timesheet_sheet.sheet}: | - self.attendance_action_change(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {}) - task_work = self.search(cr, uid, [("name","=","Quentin Paolinon")],context)[0] - task_ids = self.browse(cr, uid, task_work, context) - assert task_ids.state == "draft", "I State In Timesheet" + !record {model: hr.attendance, id: hr_attendance_1}: + action: sign_in + employee_id: 'hr.employee_qdp' + name: !eval datetime.now().strftime('%Y-%m-%d 09:%M:%S') +- + I test that Quentin in signed in +- + !assert {model: hr.employee, id: hr.employee_qdp}: + - state == 'present' - I want to check attendance and work of yesterday. I click on <- button. - @@ -57,10 +61,10 @@ - At the time of logout, I create attendance and perform "Sign Out". - - !record {model: hr.attendance, id: hr_attendance_1}: + !record {model: hr.attendance, id: hr_attendance_2}: action: sign_out employee_id: 'hr.employee_qdp' - name: !eval (datetime.now() + timedelta(minutes=1)).strftime('%Y-%m-%d %H:%M:%S') + name: !eval datetime.now().strftime('%Y-%m-%d 17:30:00') - I create Timesheet Entry for time spend on today work. - @@ -103,10 +107,10 @@ general_account_id: account.a_expense journal_id: hr_timesheet.analytic_journal - - I set an allowed difference of 25 hours + I set an allowed difference of 1 hour - !record {model: res.company, id: base.main_company}: - timesheet_max_difference: 25.00 + timesheet_max_difference: 1.00 - I tried again to confirm the timesheet after modification. - From 46f7aa283bcc4173718e0b1c518ef17ba4c5449a Mon Sep 17 00:00:00 2001 From: Antonin Bourguignon Date: Mon, 17 Sep 2012 11:41:12 +0200 Subject: [PATCH 6/6] [IMP] code cleaning bzr revid: abo@openerp.com-20120917094112-uahrew8q0jz6aqo3 --- addons/account/wizard/account_move_journal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index d1353049b72..d87e4d04a0c 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -92,14 +92,14 @@ class account_move_journal(osv.osv_memory): journal = False if journal_id: - journal = journal_pool.read(cr, uid, [journal_id], ['name'])[0]['name'] + journal = journal_pool.read(cr, uid, journal_id, ['name'], context=context).name journal_string = _("Journal: %s") % tools.ustr(journal) else: journal_string = _("Journal: All") period = False if period_id: - period = period_pool.browse(cr, uid, [period_id], context=context)[0]['name'] + period = period_pool.browse(cr, uid, period_id, context=context).name period_string = _("Period: %s") % tools.ustr(period) open_string = _("Open")