diff --git a/addons/account/account.py b/addons/account/account.py index 50b922d723b..7cce45ad006 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -80,17 +80,8 @@ class account_payment_term(osv.osv): if amt: next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)) if line.days2 < 0: - nyear = next_date.strftime("%Y") - nmonth = str(int(next_date.strftime("%m"))% 12+1) - nday = "1" - - ndate = "%s-%s-%s" % (nyear, nmonth, nday) - nseconds = time.mktime(time.strptime(ndate, '%Y-%m-%d')) - next_month = datetime.fromtimestamp(nseconds) - - delta = timedelta(seconds=1) - next_date = next_month - delta - next_date = next_date + relativedelta(days=line.days2) + next_first_date = next_date + relativedelta(day=1,months=1) #Getting 1st of next month + next_date = next_first_date + relativedelta(days=line.days2) if line.days2 > 0: next_date += relativedelta(day=line.days2, months=1) result.append( (next_date.strftime('%Y-%m-%d'), amt) ) diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 818bfef978e..da6b93fdc22 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -328,8 +328,7 @@ class account_cash_statement(osv.osv): statement_pool = self.pool.get('account.bank.statement') for statement in statement_pool.browse(cr, uid, ids, context=context): vals = {} - force_allow = context.get('force_allow',False) - if not force_allow and not self._user_allow(cr, uid, statement.id, context=context): + if not self._user_allow(cr, uid, statement.id, context=context): raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name))) if statement.name and statement.name == '/': diff --git a/addons/account/test/account_cash_statement.yml b/addons/account/test/account_cash_statement.yml index 67e6d4d2607..03d0d54db83 100644 --- a/addons/account/test/account_cash_statement.yml +++ b/addons/account/test/account_cash_statement.yml @@ -26,7 +26,7 @@ I clicked on Open CashBox button to open the cashbox - !python {model: account.bank.statement}: | - self.button_open(cr, uid, [ref("account_bank_statement_1")], {"force_allow":True, "lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) + self.button_open(cr, uid, [ref("account_bank_statement_1")], {"lang": "en_US", "tz": False, "active_model": "account.bank.statement", "active_ids": [ref("account_bank_statement_1")], "active_id": ref("account_bank_statement_1"), }) - I check that now bank statement is in the "Open" state diff --git a/addons/base_module_doc_rst/base_module_doc_rst.py b/addons/base_module_doc_rst/base_module_doc_rst.py index c7671a62bd4..9d86a191177 100755 --- a/addons/base_module_doc_rst/base_module_doc_rst.py +++ b/addons/base_module_doc_rst/base_module_doc_rst.py @@ -26,6 +26,7 @@ import report from osv import fields, osv, orm import tools from tools.translate import _ +import addons class module(osv.osv): _inherit = 'ir.module.module' @@ -104,7 +105,7 @@ class module(osv.osv): context.update({'level': 1}) dots = self.get_graphical_representation(cr, uid, object_ids, context=context) # todo: use os.realpath - file_path = tools.config['addons_path']+"/base_module_doc_rst/" + file_path = addons.get_module_resource('base_module_doc_rst') path_png = file_path + "/module.png" for key, val in dots.items(): path_dotfile = file_path + "/%s.dot" % (key,) diff --git a/addons/base_module_quality/unit_test/unit_test.py b/addons/base_module_quality/unit_test/unit_test.py index 598d443382f..c92ba6ddeac 100644 --- a/addons/base_module_quality/unit_test/unit_test.py +++ b/addons/base_module_quality/unit_test/unit_test.py @@ -24,7 +24,7 @@ import os from osv import fields, osv from tools.translate import _ import pooler -from tools import config +import addons from base_module_quality import base_module_quality class quality_test(base_module_quality.abstract_quality_check): @@ -45,7 +45,7 @@ This test checks the Unit Test(PyUnit) Cases of the module. Note that 'unit_test def run_test(self, cr, uid, module_path): pool = pooler.get_pool(cr.dbname) module_name = module_path.split('/')[-1] - test_file = config['addons_path'] +'/' + module_name +'/unit_test/test.py' + test_file = addons.get_module_resource(module_name) + '/unit_test/test.py' if not os.path.isfile(test_file): self.result += _("Module does not have 'unit_test/test.py' file") return None diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index f2570a8c57c..1508704d2d6 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -64,7 +64,7 @@ class crm_helpdesk(crm.crm_case, osv.osv): 'categ_id': fields.many2one('crm.case.categ', 'Category', \ domain="[('section_id','=',section_id),\ ('object_id.model', '=', 'crm.helpdesk')]"), - 'duration': fields.float('Duration'), + 'duration': fields.float('Duration', states={'done': [('readonly', True)]}), 'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True, help='The state is set to \'Draft\', when a case is created.\ \nIf the case is in progress the state is set to \'Open\'.\ diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 0f499c43ddd..c0ac7f473a4 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -24,6 +24,7 @@ import os from osv import fields, osv import tools from tools.translate import _ +import addons import addons @@ -182,8 +183,8 @@ class hr_employee(osv.osv): return {'value': {'work_email' : work_email}} def _get_photo(self, cr, uid, context=None): - res_path = addons.get_module_resource("hr","image/photo.png") - return open(res_path,'rb').read().encode('base64') + photo_path = addons.get_module_resource('hr','image','photo.png') + return open(photo_path, 'rb').read().encode('base64') _defaults = { 'active': 1, diff --git a/addons/hr_timesheet_sheet/wizard/hr_timesheet_current_view.xml b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current_view.xml index fe63a4ce7b3..2c87df69757 100644 --- a/addons/hr_timesheet_sheet/wizard/hr_timesheet_current_view.xml +++ b/addons/hr_timesheet_sheet/wizard/hr_timesheet_current_view.xml @@ -7,7 +7,7 @@ form
- +