diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 311a7ee6145..bb40d78a1d0 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -380,9 +380,9 @@ class account_move_line(osv.osv): 'balance': fields.function(_balance, fnct_search=_balance_search, method=True, string='Balance'), 'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'State', readonly=True, help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'), - 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or tax code account."), - 'tax_amount': fields.float('Tax/Base Amount', digits=(16,int(tools.config['price_accuracy'])), select=True, help="If the Tax account is a tax code account, this field will contain the taxed amount.If the tax account is base tax code,\ - this field will contain the basic amount(without tax)."), + 'tax_code_id': fields.many2one('account.tax.code', 'Tax Account', help="The Account can either be a base tax code or a tax code account."), + 'tax_amount': fields.float('Tax/Base Amount', digits=(16,int(tools.config['price_accuracy'])), select=True, help="If the Tax account is a tax code account, this field will contain the taxed amount.If the tax account is base tax code, "\ + "this field will contain the basic amount(without tax)."), 'invoice': fields.function(_invoice, method=True, string='Invoice', type='many2one', relation='account.invoice', fnct_search=_invoice_search), 'account_tax_id':fields.many2one('account.tax', 'Tax'), diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index 57ddd4f1045..795015864bd 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). # @@ -15,7 +15,7 @@ # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . +# along with this program. If not, see . # ############################################################################## @@ -102,17 +102,17 @@ class report_creator(osv.osv): set_dict[f.calendar_mode] = 'field'+str(i) i+=1 del required_types[required_types.index(f.calendar_mode)] - + else: temp_list.append('''''' % {'name':'field'+str(i)}) i+=1 arch += '''<%(view_type)s string="%(string)s" date_start="%(date_start)s" ''' %set_dict if set_dict.get('date_delay',False): arch +=''' date_delay="%(date_delay)s" '''%set_dict - + if set_dict.get('date_stop',False): - arch +=''' date_stop="%(date_stop)s" '''%set_dict - + arch +=''' date_stop="%(date_stop)s" '''%set_dict + if set_dict.get('color',False): arch +=''' color="%(color)s"'''%set_dict arch += '''>''' @@ -151,12 +151,12 @@ class report_creator(osv.osv): for k in r: r[k] = r[k] or False field_dict = fields_get.get(k) - field_type = field_dict and field_dict.get('type',False) or False + field_type = field_dict and field_dict.get('type',False) or False if field_type and field_type == 'many2one': if r[k]==False: continue related_name = self.pool.get(field_dict.get('relation')).name_get(cr,user,[r[k]],context)[0] - r[k] = related_name + r[k] = related_name return res def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): @@ -196,9 +196,9 @@ class report_creator(osv.osv): from_list = [] where_list = [] filter_list = [] - for model in models: + for model in models: model_dict[model.model] = self.pool.get(model.model)._table - + model_list = model_dict.keys() reference_model_dict = {} for model in model_dict: @@ -207,9 +207,9 @@ class report_creator(osv.osv): rest_list.remove(model) model_pool = self.pool.get(model) fields_get = model_pool.fields_get(cr,uid) - fields_filter = dict(filter(lambda x:x[1].get('relation',False) - and x[1].get('relation') in rest_list - and x[1].get('type')=='many2one' + fields_filter = dict(filter(lambda x:x[1].get('relation',False) + and x[1].get('relation') in rest_list + and x[1].get('type')=='many2one' and not (isinstance(model_pool._columns[x[0]],fields.function) or isinstance(model_pool._columns[x[0]],fields.related) or isinstance(model_pool._columns[x[0]],fields.dummy)), fields_get.items())) if fields_filter: model in model_list and model_list.remove(model) @@ -225,30 +225,30 @@ class report_creator(osv.osv): reference_model_dict[v.get('relation')] = relation_count+1 else: reference_model_dict[v.get('relation')]=1 - + str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' where_list.append(str_where) if reference_model_dict: self.model_set_id = model_dict.get(reference_model_dict.keys()[reference_model_dict.values().index(min(reference_model_dict.values()))]) if model_list and not len(model_dict.keys()) == 1: raise osv.except_osv(_('No Related Models!!'),_('These is/are model(s) (%s) in selection which is/are not related to any other model') % ','.join(model_list)) - + if filter_ids and where_list<>[]: filter_list.append(' and ') filter_list.append(' ') - + for filter_id in filter_ids: filter_list.append(filter_id.expression) filter_list.append(' ') filter_list.append(filter_id.condition) - + if len(from_list) == 1 and filter_ids: from_list.append(' ') ret_str = "\n where \n".join(from_list) else: ret_str = ",\n".join(from_list) - - + + if where_list: ret_str+="\n where \n"+" and\n".join(where_list) ret_str = ret_str.strip() @@ -283,7 +283,7 @@ class report_creator(osv.osv): check = self._id_get(cr, uid, ids[0], context) if check<>False: fields.insert(0,(check+' as id')) - + if models: result[obj.id] = """select %s @@ -301,7 +301,7 @@ class report_creator(osv.osv): else: result[obj.id] = False return result - + _columns = { 'name': fields.char('Report Name',size=64, required=True), 'type': fields.selection([('list','Rows And Columns Report'),], 'Report Type',required=True),#('sum','Summation Report') @@ -314,7 +314,12 @@ class report_creator(osv.osv): 'model_ids': fields.many2many('ir.model', 'base_report_creator_report_model_rel', 'report_id','model_id', 'Reported Objects'), 'field_ids': fields.one2many('base_report_creator.report.fields', 'report_id', 'Fields to Display'), 'filter_ids': fields.one2many('base_report_creator.report.filter', 'report_id', 'Filters'), - 'state': fields.selection([('draft','Draft'),('valid','Valid')], 'State', required=True), + 'state': fields.selection([ + ('draft','Draft'), + ('valid','Valid')], + 'State', required=True, + help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed custom report. \ + \n* The \'Valid\' state is used when user validates the custom report.'), 'sql_query': fields.function(_sql_query_get, method=True, type="text", string='SQL Query', store=True), 'group_ids': fields.many2many('res.groups', 'base_report_creator_group_rel','report_id','group_id','Authorized Groups'), } @@ -333,26 +338,26 @@ class report_creator(osv.osv): for fld in obj.field_ids: model_column = self.pool.get(fld.field_id.model)._columns[fld.field_id.name] if (isinstance(model_column,fields.function) or isinstance(model_column,fields.related)) and not model_column.store: - return False + return False return True - + def _aggregation_error(self, cr, uid, ids): aggregate_columns = ('integer','float') apply_functions = ('sum','min','max','avg','count') this_objs = self.browse(cr, uid, ids) for obj in this_objs: for fld in obj.field_ids: - model_column = self.pool.get(fld.field_id.model)._columns[fld.field_id.name] + model_column = self.pool.get(fld.field_id.model)._columns[fld.field_id.name] if model_column._type not in aggregate_columns and fld.group_method in apply_functions: - return False + return False return True - + def _calander_view_error(self, cr, uid, ids): -# required_types = ['date_start','date_delay','color'] +# required_types = ['date_start','date_delay','color'] required_types = [] this_objs = self.browse(cr, uid, ids) for obj in this_objs: - if obj.view_type1=='calendar' or obj.view_type2=='calendar' or obj.view_type3=='calendar': + if obj.view_type1=='calendar' or obj.view_type2=='calendar' or obj.view_type3=='calendar': for fld in obj.field_ids: model_column = self.pool.get(fld.field_id.model)._columns[fld.field_id.name] if fld.calendar_mode in ('date_start','date_end') and model_column._type not in ('date','datetime'): @@ -362,9 +367,9 @@ class report_creator(osv.osv): else: required_types.append(fld.calendar_mode) if 'date_start' not in required_types: - return False + return False return True - + _constraints = [ (_function_field, 'You can not display field which are not stored in Database.', ['field_ids']), (_aggregation_error, 'You can apply aggregate function to the non calculated field.', ['field_ids']), diff --git a/addons/crm/__init__.py b/addons/crm/__init__.py index 6308c9a1e2a..3b44a8bdb10 100644 --- a/addons/crm/__init__.py +++ b/addons/crm/__init__.py @@ -23,6 +23,13 @@ import crm import crm_segmentation import crm_meeting import crm_config +import crm_lead +import crm_phonecall +import crm_opportunity +import crm_claim +import crm_fundraising +import crm_job +import crm_helpdesk import report import wizard diff --git a/addons/crm/__terp__.py b/addons/crm/__terp__.py index c75ab1649ed..332a592431c 100644 --- a/addons/crm/__terp__.py +++ b/addons/crm/__terp__.py @@ -48,23 +48,37 @@ between mails and Open ERP.""", 'caldav', 'process' ], - 'init_xml': ['crm_data.xml', 'crm_meeting_data.xml' + 'init_xml': ['crm_data.xml', + 'crm_meeting_data.xml', + 'crm_claims_data.xml', + 'crm_fund_data.xml', + 'crm_helpdesk_data.xml', + 'crm_jobs_data.xml', + 'crm_lead_data.xml', + 'crm_meeting_data.xml', + 'crm_opportunity_data.xml', + 'crm_phonecall_data.xml', ], 'update_xml': [ 'crm_wizard.xml', 'crm_configuration_wizard.xml', 'crm_view.xml', 'crm_config_view.xml', - 'crm_bugs_view.xml', 'crm_jobs_view.xml', - 'crm_lead_view.xml', + 'crm_jobs_menu.xml', + 'crm_lead_view.xml', + 'crm_lead_menu.xml', 'crm_meeting_wizard.xml', 'crm_meeting_view.xml', 'crm_meeting_menu.xml', 'crm_opportunity_view.xml', + 'crm_opportunity_menu.xml', 'crm_fund_view.xml', + 'crm_fund_menu.xml', 'crm_claims_view.xml', + 'crm_claims_menu.xml', 'crm_phonecall_view.xml', + 'crm_phonecall_menu.xml', 'crm_report_view.xml', 'crm_helpdesk_view.xml', 'crm_report.xml', @@ -72,7 +86,17 @@ between mails and Open ERP.""", 'security/ir.model.access.csv', 'process/crm_configuration_process.xml' ], - 'demo_xml': ['crm_demo.xml', 'crm_meeting_demo.xml'], + 'demo_xml': [ + 'crm_demo.xml', + 'crm_meeting_demo.xml', + 'crm_claims_demo.xml', + 'crm_fund_demo.xml', + 'crm_helpdesk_demo.xml', + 'crm_jobs_demo.xml', + 'crm_lead_demo.xml', + 'crm_meeting_demo.xml', + 'crm_opportunity_demo.xml', + 'crm_phonecall_demo.xml'], 'installable': True, 'active': False, 'certificate': '0079056041421', diff --git a/addons/crm/crm_claim.py b/addons/crm/crm_claim.py new file mode 100644 index 00000000000..8ed38c6e946 --- /dev/null +++ b/addons/crm/crm_claim.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero 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 Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import tools +from osv import fields, osv +import os +import pooler +import netsvc +from tools.translate import _ + +class crm_claim(osv.osv): + _name = "crm.claim" + _description = "Claim Cases" + _order = "id desc" + _inherits = {'crm.case':"inherit_case_id"} + _columns = { + 'inherit_case_id': fields.many2one('crm.case','Case',ondelete='cascade'), + } + def _map_ids(self, method, cr, uid, ids, *args, **argv): + case_data = self.browse(cr, uid, ids) + new_ids = [] + for case in case_data: + if case.inherit_case_id: + new_ids.append(case.inherit_case_id.id) + return getattr(self.pool.get('crm.case'),method)(cr, uid, new_ids, *args, **argv) + + + def onchange_case_id(self, cr, uid, ids, *args, **argv): + return self._map_ids('onchange_case_id',cr,uid,ids,*args,**argv) + def onchange_partner_id(self, cr, uid, ids, *args, **argv): + return self._map_ids('onchange_partner_id',cr,uid,ids,*args,**argv) + def onchange_partner_address_id(self, cr, uid, ids, *args, **argv): + return self._map_ids('onchange_partner_address_id',cr,uid,ids,*args,**argv) + def onchange_categ_id(self, cr, uid, ids, *args, **argv): + return self._map_ids('onchange_categ_id',cr,uid,ids,*args,**argv) + def case_close(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_close',cr,uid,ids,*args,**argv) + def case_open(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_open',cr,uid,ids,*args,**argv) + def case_cancel(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_cancel',cr,uid,ids,*args,**argv) + def case_reset(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_reset',cr,uid,ids,*args,**argv) + def case_escalate(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_escalate',cr,uid,ids,*args,**argv) + def case_pending(self,cr, uid, ids, *args, **argv): + return self._map_ids('case_pending',cr,uid,ids,*args,**argv) +crm_claim() diff --git a/addons/crm/crm_config_view.xml b/addons/crm/crm_config_view.xml index c65344fbcb8..f3541135acc 100644 --- a/addons/crm/crm_config_view.xml +++ b/addons/crm/crm_config_view.xml @@ -1,54 +1,6 @@ - - - - - Configure Menu for Sections - crm.menu.config_wizard - form - -
- -