From 898d6f73d51a27b9b863ea8cb8a2d3651938b548 Mon Sep 17 00:00:00 2001 From: "Sofia (Open ERP)" Date: Tue, 28 Apr 2009 14:54:30 +0530 Subject: [PATCH 01/39] bugfix - task attachment delegate bzr revid: sso@tinyerp.com-20090428092430-qj9k8rovrogcs51a --- addons/project/project_wizard.xml | 1 + addons/project/wizard/__init__.py | 1 + addons/project/wizard/task_attachment.py | 50 ++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 addons/project/wizard/task_attachment.py diff --git a/addons/project/project_wizard.xml b/addons/project/project_wizard.xml index 3e441e3f8f0..109a003da4a 100644 --- a/addons/project/project_wizard.xml +++ b/addons/project/project_wizard.xml @@ -3,5 +3,6 @@ + diff --git a/addons/project/wizard/__init__.py b/addons/project/wizard/__init__.py index 27c629e8d93..e8ef05292ac 100644 --- a/addons/project/wizard/__init__.py +++ b/addons/project/wizard/__init__.py @@ -22,6 +22,7 @@ import close_task import task_delegate +import task_attachment # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project/wizard/task_attachment.py b/addons/project/wizard/task_attachment.py new file mode 100644 index 00000000000..8f872db758c --- /dev/null +++ b/addons/project/wizard/task_attachment.py @@ -0,0 +1,50 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import wizard +import pooler + +'''View the attachments of the parent + children tasks''' + +def _show_attachment(self, cr, uid, data, context): + task_obj = pooler.get_pool(cr.dbname).get('project.task') + task_browse_id = task_obj.browse(cr, uid, [data['id']], context)[0] + attachment_list = [child_id.id for child_id in task_browse_id.child_ids] + attachment_list.extend([task_browse_id.parent_id.id]) + value = { + 'domain': [('res_model','=',data['model']),('res_id','in',attachment_list)], + 'name': 'Attachments', + 'view_type': 'form', + 'view_mode': 'tree,form', + 'res_model': 'ir.attachment', + 'context': { }, + 'type': 'ir.actions.act_window' + } + return value +class wizard_attachment(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type':'action', 'action':_show_attachment, 'state': 'end'}, + }, + } +wizard_attachment('project.task.attachment') From 27983957d727c57b295c188af72a23b3c2358ded Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 29 Apr 2009 13:12:01 +0530 Subject: [PATCH 02/39] [FIX] Bug 367968 : Corrected partner_balance wizard(ref:noz) bzr revid: jvo@tinyerp.com-20090429074201-nz8hxiiy1m9riast --- addons/account/wizard/wizard_partner_balance_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/wizard/wizard_partner_balance_report.py b/addons/account/wizard/wizard_partner_balance_report.py index c4241f7f4e9..3031440c33e 100644 --- a/addons/account/wizard/wizard_partner_balance_report.py +++ b/addons/account/wizard/wizard_partner_balance_report.py @@ -62,7 +62,7 @@ period_fields = { 'default': lambda *a:False, 'help': 'Keep empty for all open fiscal year' }, - 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}}, + 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}, 'result_selection':{ 'string':"Partner", 'type':'selection', From 2c05768cc916df7290c22e4e5ea2768a97b19207 Mon Sep 17 00:00:00 2001 From: Naresh Choksy Date: Wed, 29 Apr 2009 16:28:23 +0530 Subject: [PATCH 03/39] product_pricelist report made compatible to new report engine bzr revid: nch@tinyerp.com-20090429105823-1ddnlexdw0rfd4b3 --- addons/product/report/product_pricelist.py | 79 ++------ addons/product/report/product_pricelist.rml | 202 +++++++++++++------- 2 files changed, 148 insertions(+), 133 deletions(-) diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index 22bad5ee1f1..9387a7cb33d 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -25,14 +25,6 @@ from report import report_sxw from osv import osv import pooler -from tools.translate import _ - -parents = { - 'tr':1, - 'li':1, - 'story': 0, - 'section': 0 -} class product_pricelist(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): super(product_pricelist, self).__init__(cr, uid, name, context) @@ -44,44 +36,30 @@ class product_pricelist(report_sxw.rml_parse): 'get_currency': self._get_currency, 'get_categories': self._get_categories, 'get_price': self._get_price, - 'get_quantity':self._get_quantity, - 'qty_header':self._qty_header, }) - def _qty_header(self,form): - def _get_unit_text(obj, cr, uid, par_qty): - if form[q]==1: - return _('%d unit')%(par_qty) - else: - return _('%d units')%(par_qty) - qty=[] - self.pricelist=form['price_list'] + def _set_quantity(self,form): for i in range(1,6): q = 'qty%d'%i if form[q]: self.quantity.append(form[q]) - qty.append(_get_unit_text(self, self.cr, self.uid, form[q])) - return qty + return True - - def _get_quantity(self,form): - qty=[] - for i in range(1,6): - q = 'qty%d'%i - if form[q]: - qty.append(form[q]) - return qty def _get_pricelist(self, pricelist_id): pool = pooler.get_pool(self.cr.dbname) pricelist = pool.get('product.pricelist').read(self.cr,self.uid,[pricelist_id],['name'])[0] return pricelist['name'] + def _get_currency(self, pricelist_id): pool = pooler.get_pool(self.cr.dbname) pricelist = pool.get('product.pricelist').read(self.cr,self.uid,[pricelist_id],['currency_id'])[0] return pricelist['currency_id'][1] - def _get_categories(self, products): + + def _get_categories(self, products,form): cat_ids=[] res=[] + self.pricelist = form['price_list'] + self._set_quantity(form) pool = pooler.get_pool(self.cr.dbname) pro_ids=[] for product in products: @@ -98,10 +76,11 @@ class product_pricelist(report_sxw.rml_parse): 'name':product.name, 'code':product.code } + i = 1 for qty in self.quantity: - val[str(qty)]=self._get_price(self.pricelist,product.id,qty) + val['qty'+str(i)]=self._get_price(self.pricelist,product.id,qty) + i += 1 products.append(val) - res.append({'name':cat.name,'products':products}) return res @@ -115,42 +94,6 @@ class product_pricelist(report_sxw.rml_parse): price = self.formatLang(res[0]['list_price']) return price - def repeatIn(self, lst, name, nodes_parent=False,value=[],width=False,type=False): - self._node.data = '' - node = self._find_parent(self._node, nodes_parent or parents) - ns = node.nextSibling - if not lst: - lst.append(1) - for ns in node.childNodes : - if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and len(value) : - width_str = ns._attrs['colWidths'].nodeValue - ns.removeAttribute('colWidths') - if not width or width=='': - width=30 - if type.lower() in ('title'): - width=width*len(value) - width_str= '%d'%(float(width_str)+width) - ns.setAttribute('colWidths',width_str) - else: - for v in value: - width_str +=',%d'%width - - ns.setAttribute('colWidths',width_str) - child_list = ns.childNodes - for child in child_list: - if child.nodeName=='tr': - lc = child.childNodes[1] - t=0 - for v in value: - newnode = lc.cloneNode(1) - if type.lower() in ('string'): - newnode.childNodes[1].lastChild.data="[[ %s['%s'] ]]"%(name,v) - elif type.lower() in ('label'): - newnode.childNodes[1].lastChild.data= "%s"%(v) - child.appendChild(newnode) - newnode=False - return super(product_pricelist,self).repeatIn(lst, name, nodes_parent=False) -#end report_sxw.report_sxw('report.product.pricelist','product.product','addons/product/report/product_pricelist.rml',parser=product_pricelist) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/product/report/product_pricelist.rml b/addons/product/report/product_pricelist.rml index ddeb5023768..473920f6535 100644 --- a/addons/product/report/product_pricelist.rml +++ b/addons/product/report/product_pricelist.rml @@ -13,103 +13,175 @@ - + - + + + + + - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + - Products Price List + Products Price List - - - - - + - Price List Name : [[ get_pricelist (data['form']['price_list']) ]] - Currency : [[ get_currency ( data['form']['price_list']) ]] - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] - - - -
- [[repeatIn([],'qty_header',width=59,value=qty_header(data['form']),type='label') ]] - - - - Description - - - -
-
- [[ repeatIn(get_categories(objects), 'c',width=59,value=get_quantity(data['form']),type='title') ]] - - - - [[ c['name'] ]] - - - - -
- [[repeatIn(c['products'], 'p',width=59,value=get_quantity(data['form']),type='string') ]] - - - - [[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]] - - - -
-
- + + + + Price List Name: + + + [[ get_pricelist(data['form']['price_list']) ]] + + + + + Currency : + + + [[ get_currency ( data['form']['price_list']) ]] + + + + + Printing Date : + + + [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] + + + + + + + + + + Description + + + [[str( data['form']['qty1']) ]] units + + + [[ str(data['form']['qty2'] )]] units + + + [[ str(data['form']['qty3']) ]] units + + + [[ str(data['form']['qty4']) ]] units + + + [[ str(data['form']['qty5'] ) ]] units + + + + + + + + [[repeatIn(get_categories(objects,data['form']), 'c')]][[ c['name'] ]] + + + + + [[repeatIn(c['products'], 'p')]][[ p['code'] and '[' + p['code'] + '] ' or '' ]] [[ p['name'] ]] + + + [[p['qty1'] ]] + + + [[ p['qty2'] ]] + + + [[ p['qty3'] ]] + + + [[ p['qty4'] ]] + + + [[ p['qty5'] ]] + + + + + + + + +
From 6d553a36fda98f2efa61d2a957dd94ad67eb8c1a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 29 Apr 2009 18:13:19 +0200 Subject: [PATCH 04/39] [IMP] base_setup: pre-fill the fields with the address of the main company bzr revid: christophe@tinyerp.com-20090429161319-3jh2wmde29myy6l7 --- addons/base_setup/wizard/wizard_base_setup.py | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/addons/base_setup/wizard/wizard_base_setup.py b/addons/base_setup/wizard/wizard_base_setup.py index 10c75bd092e..f095e4b78cb 100644 --- a/addons/base_setup/wizard/wizard_base_setup.py +++ b/addons/base_setup/wizard/wizard_base_setup.py @@ -111,43 +111,51 @@ class wizard_base_setup(wizard.interface): return res def _get_company(self, cr, uid, data, context): - pool=pooler.get_pool(cr.dbname) - company_obj=pool.get('res.company') + pool = pooler.get_pool(cr.dbname) + company_obj = pool.get('res.company') ids=company_obj.search(cr, uid, []) if not ids: return {} - company=company_obj.browse(cr, uid, ids)[0] - self.fields['name']['default']=company.name - self.fields['currency']['default']=company.currency_id.id - serv_pro_id = pooler.get_pool(cr.dbname).get('ir.module.module').search(cr, uid, [('name','=','profile_service')]) or False + company = company_obj.browse(cr, uid, ids)[0] + + res = { + 'name': company.name, + 'currency': company.currency_id.id, + } + + if company.partner_id.address: + address = company.partner_id.address[0] + for field in 'street street2 zip city email phone'.split(): + res[field] = address[field] + + for field in 'country_id state_id'.split(): + if address[field]: + res[field] = address[field].id + + serv_pro_id = pool.get('ir.module.module').search(cr, uid, [('name','=','profile_service')]) or False if serv_pro_id: - return {'profile':serv_pro_id[0]} - return {} + res['profile'] = serv_pro_id[0] + + return res + + + def _get_all(self, cr, uid, context, model): + pool = pooler.get_pool(cr.dbname) + obj = pool.get(model) + ids = obj.search(cr, uid, []) + res = [(o.id, o.name) for o in obj.browse(cr, uid, ids, context=context)] + res.append((-1, '')) + res.sort(key=lambda x: x[1]) + return res def _get_states(self, cr, uid, context): - pool=pooler.get_pool(cr.dbname) - state_obj=pool.get('res.country.state') - ids=state_obj.search(cr, uid, []) - res=[(state.id, state.name) for state in state_obj.browse(cr, uid, ids, context=context)] - res.append((-1, '')) - res.sort(lambda x,y: cmp(x[1],y[1])) - return res + return self._get_all(cr, uid, context, 'res.country.state') def _get_countries(self, cr, uid, context): - pool=pooler.get_pool(cr.dbname) - country_obj=pool.get('res.country') - ids=country_obj.search(cr, uid, []) - res=[(country.id, country.name) for country in country_obj.browse(cr, uid, ids, context=context)] - res.sort(lambda x,y: cmp(x[1],y[1])) - return res + return self._get_all(cr, uid, context, 'res.country') def _get_currency(self, cr, uid, context): - pool=pooler.get_pool(cr.dbname) - currency_obj=pool.get('res.currency') - ids=currency_obj.search(cr, uid, []) - res=[(currency.id, currency.name) for currency in currency_obj.browse(cr, uid, ids, context=context)] - res.sort(lambda x,y: cmp(x[1],y[1])) - return res + return self._get_all(cr, uid, context, 'res.currency') def _update(self, cr, uid, data, context): pool=pooler.get_pool(cr.dbname) @@ -256,7 +264,6 @@ class wizard_base_setup(wizard.interface): 'string':'Profile', 'type':'selection', 'selection':_get_profiles, -# 'default': _get_service_profile, 'required': True, }, From 9c960eee26d72ffa877229608d9e5e4f89144b36 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 29 Apr 2009 18:20:16 +0200 Subject: [PATCH 05/39] [IMP] base_setup: also pre-fill the fields of the second tab bzr revid: christophe@tinyerp.com-20090429162016-hph7aum99l4z8b57 --- addons/base_setup/wizard/wizard_base_setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/base_setup/wizard/wizard_base_setup.py b/addons/base_setup/wizard/wizard_base_setup.py index f095e4b78cb..aca4b185ade 100644 --- a/addons/base_setup/wizard/wizard_base_setup.py +++ b/addons/base_setup/wizard/wizard_base_setup.py @@ -118,10 +118,10 @@ class wizard_base_setup(wizard.interface): return {} company = company_obj.browse(cr, uid, ids)[0] - res = { - 'name': company.name, - 'currency': company.currency_id.id, - } + res = {'currency': company.currency_id.id} + + for field in 'name logo rml_header1 rml_footer1 rml_footer2'.split(): + res[field] = company[field] if company.partner_id.address: address = company.partner_id.address[0] From 0a80db1ee3a935b97800156ae75d419ab3e58069 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 1 May 2009 12:51:09 +0530 Subject: [PATCH 06/39] [FIX] Bug 367471 : Timesheet lines notification on chaning saved record's date bzr revid: jvo@tinyerp.com-20090501072109-nsk4y8dyrzzn4udi --- addons/hr_timesheet/hr_timesheet.py | 10 +++++++++- addons/hr_timesheet/hr_timesheet_view.xml | 6 +++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/hr_timesheet/hr_timesheet.py b/addons/hr_timesheet/hr_timesheet.py index a74efd53cdd..70d4a80c501 100644 --- a/addons/hr_timesheet/hr_timesheet.py +++ b/addons/hr_timesheet/hr_timesheet.py @@ -111,7 +111,15 @@ class hr_analytic_timesheet(osv.osv): } def on_change_account_id(self, cr, uid, ids, account_id): return {'value':{}} - + + def on_change_date(self, cr, uid, ids, date): + if ids: + new_date = self.read(cr,uid,ids[0],['date'])['date'] + if date != new_date: + warning = {'title':'User Alert!','message':'Changing the date will let this entry appear in the timesheet of the new date.'} + return {'value':{},'warning':warning} + return {'value':{}} + def create(self, cr, uid, vals, context={}): try: res = super(hr_analytic_timesheet, self).create(cr, uid, vals, context) diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index e44a50ace19..c9f7214ecca 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -8,7 +8,7 @@ - + @@ -25,9 +25,9 @@ form
- + - + From 25177a0fe57f7da57b6af23f3215ddc78b4c091d Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 1 May 2009 15:26:06 +0530 Subject: [PATCH 07/39] [FIX] Bug 368698 : Warning resolved(ref:.GPA) bzr revid: jvo@tinyerp.com-20090501095606-te74htk5inczcmit --- addons/hr_timesheet_sheet/hr_timesheet_sheet.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 1aa4673ce8a..17eabbc2f16 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -369,7 +369,7 @@ class hr_timesheet_line(osv.osv): elif (x[2] is False) and (x[1] == '<>' or x[1] == '!='): qu1.append('(s.id IS NOT NULL)') else: - qu1.append('(s.id %s %s)' % (x[1], '%d')) + qu1.append('(s.id %s %s)' % (x[1], '%s')) qu2.append(x[2]) elif x[1] == 'in': if len(x[2]) > 0: @@ -486,7 +486,7 @@ class hr_attendance(osv.osv): elif (x[2] is False) and (x[1] == '<>' or x[1] == '!='): qu1.append('(s.id IS NOT NULL)') else: - qu1.append('(s.id %s %s)' % (x[1], '%d')) + qu1.append('(s.id %s %s)' % (x[1], '%s')) qu2.append(x[2]) elif x[1] == 'in': if len(x[2]) > 0: From c07b4784127f050669eb3327008617d39f7ede6a Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 1 May 2009 17:42:38 +0530 Subject: [PATCH 08/39] [FIX] Bug 362727 : Report creator now lists only related models,filter wizard bugfixes bzr revid: jvo@tinyerp.com-20090501121238-0pyzyo6avpoj7jfm --- .../base_report_creator.py | 30 +++++++++++++++++-- .../base_report_creator_view.xml | 2 +- .../wizard/wiz_set_filter_fields.py | 15 +++++----- 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index 12e95186217..93f2ff837c0 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -47,6 +47,32 @@ from tools.translate import _ # return super(ir_model_fields, self).search(cr, uid, args, offset, limit, order, context) #ir_model_fields() +class ir_model(osv.osv): + _inherit = 'ir.model' + + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): + res_model_ids = super(ir_model,self).search(cr, uid, args, offset, limit, order, context=context, count=count) + try: + if 'model_ids' in context and context['model_ids'][0][2]: + model_ids = context['model_ids'][0][2] + result = [] + name_list = [] + if model_ids: + obj = self.read(cr, uid, model_ids,['model']) + for name in obj: + name_list.append(name['model']) + cr.execute("SELECT model_id, relation FROM ir_model_fields WHERE relation in (%s)" % (','.join(map(lambda x: "'"+str(x)+"'",name_list)))) + + for r in cr.fetchall(): + result.append(r[0]) + return result + return res_model_ids + + except Exception,e: + pass + +ir_model() + class report_creator(osv.osv): _name = "base_report_creator.report" _description = "Report" @@ -354,8 +380,8 @@ class report_creator(osv.osv): _constraints = [ (_function_field, 'You can not display field which are not stored in Database.', ['field_ids']), - (_aggregation_error, 'You can apply agregate function to the non calculated field.', ['field_ids']), - (_calander_view_error, "You must have to give calander view's color,start date and delay.", ['field_ids']), + (_aggregation_error, 'You can apply aggregate function to the non calculated field.', ['field_ids']), + (_calander_view_error, "You must have to give calendar view's color,start date and delay.", ['field_ids']), ] report_creator() diff --git a/addons/base_report_creator/base_report_creator_view.xml b/addons/base_report_creator/base_report_creator_view.xml index 494e98d7d02..7ae858012ed 100644 --- a/addons/base_report_creator/base_report_creator_view.xml +++ b/addons/base_report_creator/base_report_creator_view.xml @@ -38,7 +38,7 @@ - +