diff --git a/addons/account/account.py b/addons/account/account.py index 031a803d64c..9b728ff36e0 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -28,7 +28,7 @@ import time import openerp from openerp import SUPERUSER_ID from openerp import tools -from openerp.osv import fields, osv +from openerp.osv import fields, osv, expression from openerp.tools.translate import _ from openerp.tools.float_utils import float_round @@ -579,15 +579,18 @@ class account_account(osv.osv): except: pass if name: - ids = self.search(cr, user, [('code', '=like', name+"%")]+args, limit=limit) - if not ids: - ids = self.search(cr, user, [('shortcut', '=', name)]+ args, limit=limit) - if not ids: - ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit) - if not ids and len(name.split()) >= 2: - #Separating code and name of account for searching - operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A. - ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2)]+ args, limit=limit) + if operator not in expression.NEGATIVE_TERM_OPERATORS: + ids = self.search(cr, user, ['|', ('code', '=like', name+"%"), '|', ('shortcut', '=', name), ('name', operator, name)]+args, limit=limit) + if not ids and len(name.split()) >= 2: + #Separating code and name of account for searching + operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A. + ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2)]+ args, limit=limit) + else: + ids = self.search(cr, user, ['&','!', ('code', '=like', name+"%"), ('name', operator, name)]+args, limit=limit) + # as negation want to restric, do if already have results + if ids and len(name.split()) >= 2: + operand1,operand2 = name.split(' ',1) #name can contain spaces e.g. OpenERP S.A. + ids = self.search(cr, user, [('code', operator, operand1), ('name', operator, operand2), ('id', 'in', ids)]+ args, limit=limit) else: ids = self.search(cr, user, args, context=context, limit=limit) return self.name_get(cr, user, ids, context=context) @@ -1573,11 +1576,6 @@ class account_move(osv.osv): obj_analytic_line = self.pool.get('account.analytic.line') obj_move_line = self.pool.get('account.move.line') for move in self.browse(cr, uid, ids, context): - # Unlink old analytic lines on move_lines - for obj_line in move.line_id: - for obj in obj_line.analytic_lines: - obj_analytic_line.unlink(cr,uid,obj.id) - journal = move.journal_id amount = 0 line_ids = [] diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d5c453ee9c7..cb242942656 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -193,6 +193,8 @@ class account_move_line(osv.osv): if obj_line.analytic_account_id: if not obj_line.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal!'),_("You have to define an analytic journal on the '%s' journal!") % (obj_line.journal_id.name, )) + if obj_line.analytic_lines: + acc_ana_line_obj.unlink(cr,uid,[obj.id for obj in obj_line.analytic_lines]) vals_line = self._prepare_analytic_line(cr, uid, obj_line, context=context) acc_ana_line_obj.create(cr, uid, vals_line) return True @@ -1207,20 +1209,6 @@ class account_move_line(osv.osv): if not ok: raise osv.except_osv(_('Bad Account!'), _('You cannot use this general account in this journal, check the tab \'Entry Controls\' on the related journal.')) - if vals.get('analytic_account_id',False): - if journal.analytic_journal_id: - vals['analytic_lines'] = [(0,0, { - 'name': vals['name'], - 'date': vals.get('date', time.strftime('%Y-%m-%d')), - 'account_id': vals.get('analytic_account_id', False), - 'unit_amount': vals.get('quantity', 1.0), - 'amount': vals.get('debit', 0.0) or vals.get('credit', 0.0), - 'general_account_id': vals.get('account_id', False), - 'journal_id': journal.analytic_journal_id.id, - 'ref': vals.get('ref', False), - 'user_id': uid - })] - result = super(account_move_line, self).create(cr, uid, vals, context=context) # CREATE Taxes if vals.get('account_tax_id', False): diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 8119e9f1002..723ec6da155 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -3,9 +3,15 @@ + SAL Sales sale + + PUR + Purchases + purchase + - + - + 1.3cm 19.3cm 28.5cm 19.3cm @@ -17,9 +17,9 @@ - + - + 1.3cm 19.3cm 28.5cm 19.3cm diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 682508e0ca0..a30b874bd8a 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -242,6 +242,10 @@ class hr_holidays(osv.osv): result['value'] = { 'employee_id': ids_employee[0] } + elif holiday_type != 'employee': + result['value'] = { + 'employee_id': False + } return result def onchange_employee(self, cr, uid, ids, employee_id): diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index 7642d46273f..af20d727fc8 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -14,7 +14,7 @@ - + @@ -47,61 +47,14 @@ - + + Leave Request hr.holidays - 1
-
-
- - - - - - - - - - - - - -
- - -
- -
-
- - - - Allocation Request - hr.holidays - -
- +