From d02b4e10add6f5fdc4baed988d7a1585001e5de8 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Tue, 10 Aug 2010 18:59:34 +0530 Subject: [PATCH 01/32] [IMP] point_of_sale: When user close the journal, the closing balace will become the opening balance for that journal when it is opened next time. bzr revid: uco@tinyerp.com-20100810132934-u2ezh47k42vcuh03 --- .../wizard/pos_open_statement.py | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/addons/point_of_sale/wizard/pos_open_statement.py b/addons/point_of_sale/wizard/pos_open_statement.py index 0e3af22f2f5..f9b0b2732d6 100644 --- a/addons/point_of_sale/wizard/pos_open_statement.py +++ b/addons/point_of_sale/wizard/pos_open_statement.py @@ -36,7 +36,7 @@ class pos_open_statement(osv.osv_memory): @param context: A standard dictionary @return : Blank Directory """ - list_statement = [] + data = {} mod_obj = self.pool.get('ir.model.data') company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id statement_obj = self.pool.get('account.bank.statement') @@ -51,19 +51,33 @@ class pos_open_statement(osv.osv_memory): if len(ids): raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s". \n Please close the cashbox related to. ' %(journal.name))) + statement_ids = sorted(statement_obj.search(cr, uid, [('state', '=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])) + if statement_ids: + res = [] + statement_ids.reverse() + statement = statement_obj.browse(cr, uid, statement_ids[0]) + for end_bal in statement.ending_details_ids: + dct = { + 'pieces': end_bal.pieces, + 'number': end_bal.number, + } + res.append((0, 0, dct)) + data['starting_details_ids'] = res + else: + data['starting_details_ids'] = statement_obj._get_cash_close_box_lines(cr, uid, []) + number = '' if journal.sequence_id: number = sequence_obj.get_id(cr, uid, journal.sequence_id.id) else: number = sequence_obj.get(cr, uid, 'account.bank.statement') - statement_id = statement_obj.create(cr, uid, {'journal_id': journal.id, - 'company_id': company_id, - 'user_id': uid, - 'state': 'open', - 'name': number, - 'starting_details_ids': statement_obj._get_cash_close_box_lines(cr, uid, []), - }) + data.update({'journal_id': journal.id, + 'company_id': company_id, + 'user_id': uid, + 'state': 'open', + 'name': number }) + statement_id = statement_obj.create(cr, uid, data) statement_obj.button_open(cr, uid, [statement_id], context) data_obj = self.pool.get('ir.model.data') From 63bb1811a6ebe854e6aa006836748d9c85c23d12 Mon Sep 17 00:00:00 2001 From: "PSI(OpenERP)" <> Date: Wed, 11 Aug 2010 10:16:06 +0530 Subject: [PATCH 02/32] [FIX] hr_timesheet_invoice: Correct profit report [IMP] hr_attendance: Attnedance by month report bzr revid: mra@mra-laptop-20100811044606-emr0vqkjoqpjjbt3 --- .../report/attendance_by_month.py | 85 +++++++++---------- .../report/account_analytic_profit.rml | 4 +- 2 files changed, 43 insertions(+), 46 deletions(-) diff --git a/addons/hr_attendance/report/attendance_by_month.py b/addons/hr_attendance/report/attendance_by_month.py index 0710d30faaf..8899df5ab59 100644 --- a/addons/hr_attendance/report/attendance_by_month.py +++ b/addons/hr_attendance/report/attendance_by_month.py @@ -44,49 +44,47 @@ class report_custom(report_rml): if context is None: context = {} month = DateTime.DateTime(datas['form']['year'], datas['form']['month'], 1) + emp_ids = context.get('active_ids', []) user_xml = ['%s' % month2name[month.month], '%s' % month.year] - for employee_id in ids: - emp = obj_emp.read(cr, uid, [employee_id], ['name'])[0] - stop, days_xml = False, [] - user_repr = ''' - - %s - %%s - - ''' % (toxml(emp['name'])) - today, tomor = month, month + one_day - while today.month == month.month: - #### Work hour calculation - sql = ''' - select action, att.name - from hr_employee as emp inner join hr_attendance as att - on emp.id = att.employee_id - where att.name between %s and %s and emp.id = %s - order by att.name - ''' - cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), employee_id)) - attendences = cr.dictfetchall() - wh = 0 - # Fake sign ins/outs at week ends, to take attendances across week ends into account - if attendences and attendences[0]['action'] == 'sign_out': - attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) - if attendences and attendences[-1]['action'] == 'sign_in': - attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) - # sum up the attendances' durations - for att in attendences: - dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') - if att['action'] == 'sign_out': - wh += (dt - ldt).hours - ldt = dt - - # Week xml representation - wh = hour2str(wh) - today_xml = '%s' % ((today - month).days+1, wh) - days_xml.append(today_xml) - today, tomor = tomor, tomor + one_day - - user_xml.append(user_repr % '\n'.join(days_xml)) - + if emp_ids: + for emp in obj_emp.read(cr, uid, emp_ids, ['name']): + stop, days_xml = False, [] + user_repr = ''' + + %s + %%s + + ''' % (toxml(emp['name'])) + today, tomor = month, month + one_day + while today.month == month.month: + #### Work hour calculation + sql = ''' + select action, att.name + from hr_employee as emp inner join hr_attendance as att + on emp.id = att.employee_id + where att.name between %s and %s and emp.id = %s + order by att.name + ''' + cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), emp['id'])) + attendences = cr.dictfetchall() + wh = 0 + # Fake sign ins/outs at week ends, to take attendances across week ends into account + if attendences and attendences[0]['action'] == 'sign_out': + attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'}) + if attendences and attendences[-1]['action'] == 'sign_in': + attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'}) + # sum up the attendances' durations + for att in attendences: + dt = DateTime.strptime(att['name'], '%Y-%m-%d %H:%M:%S') + if att['action'] == 'sign_out': + wh += (dt - ldt).hours + ldt = dt + # Week xml representation + wh = hour2str(wh) + today_xml = '%s' % ((today - month).days+1, wh) + days_xml.append(today_xml) + today, tomor = tomor, tomor + one_day + user_xml.append(user_repr % '\n'.join(days_xml)) xml = ''' %s @@ -96,5 +94,4 @@ class report_custom(report_rml): report_custom('report.hr.attendance.bymonth', 'hr.employee', '', 'addons/hr_attendance/report/bymonth.xsl') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml index 2a6ef38c755..d678a390e48 100644 --- a/addons/hr_timesheet_invoice/report/account_analytic_profit.rml +++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.rml @@ -224,7 +224,7 @@ [[ reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) ]] - [[ round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)]] % + [[reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) and round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)]] % @@ -255,7 +255,7 @@ [[ reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0) ]] - [[ '%d' % (reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0,)]] % + [[ reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) and '%d' % (reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0, 2)]] % From afeb19d09df882830c333de43cbe04836ad61aa9 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Wed, 11 Aug 2010 11:50:50 +0530 Subject: [PATCH 03/32] [IMP] marketing_campaign : Improvements in views,workflow bzr revid: vir@tinyerp.com-20100811062050-0qmfcp8497mt4yu0 --- .../marketing_campaign_view.xml | 19 ++++++++++++++++--- .../marketing_campaign_workflow.xml | 9 ++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/addons/marketing_campaign/marketing_campaign_view.xml b/addons/marketing_campaign/marketing_campaign_view.xml index facc295601c..5f451808436 100644 --- a/addons/marketing_campaign/marketing_campaign_view.xml +++ b/addons/marketing_campaign/marketing_campaign_view.xml @@ -145,9 +145,10 @@ -