From aaf478c22075e872786f6696ff3b9b7ecaf0bdde Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 31 Mar 2009 15:14:33 +0530 Subject: [PATCH 1/4] [FIX]Bug 352191 : Corrected hr_attendance creation for timesheet when date=last date of timesheet bzr revid: jvo@tinyerp.com-20090331094433-2n8u78s90jqwexe2 --- .../hr_timesheet_sheet/hr_timesheet_sheet.py | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 5c4f6def59f..237d0f6c9c3 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -437,23 +437,21 @@ class hr_attendance(osv.osv): def _sheet(self, cursor, user, ids, name, args, context): sheet_obj = self.pool.get('hr_timesheet_sheet.sheet') - - cursor.execute('SELECT a.id, COALESCE(MAX(s.id), 0) \ + cursor.execute("SELECT a.id, COALESCE(MAX(s.id), 0) \ FROM hr_timesheet_sheet_sheet s \ LEFT JOIN (hr_attendance a \ LEFT JOIN hr_employee e \ ON (a.employee_id = e.id)) \ - ON (s.date_to >= a.name \ - AND s.date_from <= a.name \ + ON (s.date_to >= to_date(to_char(a.name, 'YYYY-MM-dd'),'YYYY-MM-dd') \ + AND s.date_from <= to_date(to_char(a.name, 'YYYY-MM-dd'),'YYYY-MM-dd') \ AND s.user_id = e.user_id) \ - WHERE a.id in (' + ','.join([str(x) for x in ids]) + ') \ - GROUP BY a.id') + WHERE a.id in (" + ",".join([str(x) for x in ids]) + ") \ + GROUP BY a.id") res = dict(cursor.fetchall()) sheet_names = {} for sheet_id, name in sheet_obj.name_get(cursor, user, res.values(), context=context): sheet_names[sheet_id] = name - for line_id in {}.fromkeys(ids): sheet_id = res.get(line_id, False) if sheet_id: @@ -527,11 +525,11 @@ class hr_attendance(osv.osv): if 'sheet_id' in context: ts = self.pool.get('hr_timesheet_sheet.sheet').browse(cr, uid, context['sheet_id']) if ts.state not in ('draft', 'new'): - raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !')) + raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !')) res = super(hr_attendance,self).create(cr, uid, vals, context=context) if 'sheet_id' in context: - if context['sheet_id'] != self.browse(cr, uid, res, context=context).sheet_id.id: - raise osv.except_osv(_('UserError'), _('You can not enter an attendance ' \ + if context['sheet_id'] != vals['sheet_id']: + raise osv.except_osv(_('UserError'), _('You cannot enter an attendance ' \ 'date outside the current timesheet dates!')) return res @@ -545,14 +543,14 @@ class hr_attendance(osv.osv): if 'sheet_id' in context: for attendance in self.browse(cr, uid, ids, context=context): if context['sheet_id'] != attendance.sheet_id.id: - raise osv.except_osv(_('UserError'), _('You can not enter an attendance ' \ + raise osv.except_osv(_('UserError'), _('You cannot enter an attendance ' \ 'date outside the current timesheet dates!')) return res def _check(self, cr, uid, ids): for att in self.browse(cr, uid, ids): if att.sheet_id and att.sheet_id.state not in ('draft', 'new'): - raise osv.except_osv(_('Error !'), _('You can not modify an entry in a confirmed timesheet !')) + raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !')) return True hr_attendance() From 61106b0fffea06e767d75ce5f048f81ee30de908 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 31 Mar 2009 17:02:53 +0530 Subject: [PATCH 2/4] [FIX]Bug 352191 : Corrected bzr revid: jvo@tinyerp.com-20090331113253-bxgu0qdaqjoi7psq --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 237d0f6c9c3..1aa4673ce8a 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -528,7 +528,7 @@ class hr_attendance(osv.osv): raise osv.except_osv(_('Error !'), _('You cannot modify an entry in a confirmed timesheet !')) res = super(hr_attendance,self).create(cr, uid, vals, context=context) if 'sheet_id' in context: - if context['sheet_id'] != vals['sheet_id']: + if context['sheet_id'] != self.browse(cr, uid, res, context=context).sheet_id.id: raise osv.except_osv(_('UserError'), _('You cannot enter an attendance ' \ 'date outside the current timesheet dates!')) return res From 7856ace733e35c36d06d700a8cb086d35ff2d67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Wed, 1 Apr 2009 16:29:11 +0200 Subject: [PATCH 3/4] [FIX] Name of user in employees timesheet bzr revid: nel@tinyerp.com-20090401142911-n0f6pil2r71dr973 --- addons/account/account.py | 13 ++++++++++--- addons/hr_timesheet/report/users_timesheet.xsl | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index a515423c957..e8574f61590 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1298,7 +1298,7 @@ class account_tax(osv.osv): res.append(tax) return res - def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None): + def _unit_compute(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None, quantity=0): taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner) res = [] @@ -1327,7 +1327,12 @@ class account_tax(osv.osv): data['amount'] = amount elif tax.type=='fixed': + print "her", quantity + print "data", data data['amount'] = tax.amount + data['tax_amount']=quantity + print "DATA 2", data + # data['amount'] = quantity elif tax.type=='code': address = address_id and self.pool.get('res.partner.address').browse(cr, uid, address_id) or None localdict = {'price_unit':cur_price_unit, 'address':address, 'product':product, 'partner':partner} @@ -1343,7 +1348,7 @@ class account_tax(osv.osv): if tax.child_depend: latest = res.pop() amount = amount2 - child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, address_id, product, partner) + child_tax = self._unit_compute(cr, uid, tax.child_ids, amount, address_id, product, partner, quantity) res.extend(child_tax) if tax.child_depend: for r in res: @@ -1361,6 +1366,7 @@ class account_tax(osv.osv): latest[name+'_code_id'] = False if tax.include_base_amount: cur_price_unit+=amount2 + print "rress final", res return res def compute(self, cr, uid, taxes, price_unit, quantity, address_id=None, product=None, partner=None): @@ -1373,7 +1379,8 @@ class account_tax(osv.osv): tax = {'name':'', 'amount':0.0, 'account_collected_id':1, 'account_paid_id':2} one tax for each tax id in IDS and their childs """ - res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product, partner) + res = self._unit_compute(cr, uid, taxes, price_unit, address_id, product, partner, quantity) + print "res",res total = 0.0 for r in res: if r.get('balance',False): diff --git a/addons/hr_timesheet/report/users_timesheet.xsl b/addons/hr_timesheet/report/users_timesheet.xsl index 7f4110b7c90..f229641c837 100644 --- a/addons/hr_timesheet/report/users_timesheet.xsl +++ b/addons/hr_timesheet/report/users_timesheet.xsl @@ -86,7 +86,7 @@ - + From 61d68367ff8d312e198c1abde66ad121dd75e400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Najla=C3=A2=20EL=20KHAYAT?= Date: Wed, 1 Apr 2009 17:25:59 +0200 Subject: [PATCH 4/4] ref view for projects structure bzr revid: nel@tinyerp.com-20090401152559-gowpo2w8gf6zu9zy --- addons/project/project_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 6244c2ceca4..0c032a62aea 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -216,6 +216,7 @@ project.project tree [('parent_id','=',False)] +