From 2398cb648274775c1e02d223b11143d2e91976b9 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Mon, 7 Jun 2010 12:30:15 +0530 Subject: [PATCH 1/8] [IMP]: Added log for crm modules and document bzr revid: rpa@tinyerp.com-20100607070015-j8h630weh0ki4gqh --- addons/crm/crm_lead.py | 3 ++- addons/crm/crm_meeting.py | 1 + addons/crm/crm_opportunity.py | 1 - addons/crm/crm_phonecall.py | 1 + addons/crm_claim/crm_claim.py | 1 + addons/crm_fundraising/crm_fundraising.py | 1 + addons/crm_helpdesk/crm_helpdesk.py | 1 + addons/document/document.py | 2 ++ addons/document/document_directory.py | 4 +++- addons/document/document_storage.py | 2 ++ addons/idea/idea.py | 2 ++ addons/lunch/lunch.py | 1 + addons/mail_gateway/mail_gateway.py | 3 ++- 13 files changed, 19 insertions(+), 4 deletions(-) diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index c1060f3e658..e92378785d6 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -32,10 +32,11 @@ class crm_lead(osv.osv, crm_case): """ CRM Lead Case """ _name = "crm.lead" - _description = "Lead" + _description = "Lead/Opportunity" _order = "priority, id desc" _inherit = ['res.partner.address'] _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True def _compute_day(self, cr, uid, ids, fields, args, context={}): """ diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index 133cb98f9dc..e3116ba39ca 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -45,6 +45,7 @@ class crm_meeting(osv.osv, crm_case): _order = "id desc" _inherit = ["calendar.event"] _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True _columns = { # From crm.case diff --git a/addons/crm/crm_opportunity.py b/addons/crm/crm_opportunity.py index 98e4c6f3ded..ce9b661fa1a 100644 --- a/addons/crm/crm_opportunity.py +++ b/addons/crm/crm_opportunity.py @@ -37,7 +37,6 @@ AVAILABLE_STATES = [ class crm_opportunity(osv.osv): """ Opportunity Cases """ _name = "crm.lead" - _description = "Opportunity" _order = "priority,date_action,id desc" _inherit = 'crm.lead' _columns = { diff --git a/addons/crm/crm_phonecall.py b/addons/crm/crm_phonecall.py index 657360a4206..4ed59e2a5c3 100644 --- a/addons/crm/crm_phonecall.py +++ b/addons/crm/crm_phonecall.py @@ -32,6 +32,7 @@ class crm_phonecall(osv.osv, crm_case): _description = "Phonecall" _order = "id desc" _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True _columns = { # From crm.case diff --git a/addons/crm_claim/crm_claim.py b/addons/crm_claim/crm_claim.py index d9a7a2b34c0..d45b9aa6482 100644 --- a/addons/crm_claim/crm_claim.py +++ b/addons/crm_claim/crm_claim.py @@ -30,6 +30,7 @@ class crm_claim(osv.osv, crm.crm_case): _description = "Claim Cases" _order = "id desc" _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True _columns = { 'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False), diff --git a/addons/crm_fundraising/crm_fundraising.py b/addons/crm_fundraising/crm_fundraising.py index 356c3baec73..4ff7832e64f 100644 --- a/addons/crm_fundraising/crm_fundraising.py +++ b/addons/crm_fundraising/crm_fundraising.py @@ -29,6 +29,7 @@ class crm_fundraising(osv.osv, crm.crm_case): _description = "Fund Raising Cases" _order = "id desc" _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True _columns = { 'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False), diff --git a/addons/crm_helpdesk/crm_helpdesk.py b/addons/crm_helpdesk/crm_helpdesk.py index d07d2261013..0b14994d2b6 100644 --- a/addons/crm_helpdesk/crm_helpdesk.py +++ b/addons/crm_helpdesk/crm_helpdesk.py @@ -29,6 +29,7 @@ class crm_helpdesk(osv.osv, crm.crm_case): _description = "Helpdesk Cases" _order = "id desc" _inherits = {'mailgate.thread': 'thread_id'} + _log_create=True _columns = { 'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False), diff --git a/addons/document/document.py b/addons/document/document.py index 5d3075f7a4a..1a811600eed 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -41,6 +41,8 @@ DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['roo class document_file(osv.osv): _inherit = 'ir.attachment' _rec_name = 'datas_fname' + _log_create=True + def _get_filestore(self, cr): return os.path.join(DMS_ROOT_PATH, cr.dbname) diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index e395f96833d..8c50164701b 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -33,6 +33,8 @@ class document_directory(osv.osv): _name = 'document.directory' _description = 'Directory' _order = 'name desc' + _log_create=True + _columns = { 'name': fields.char('Name', size=64, required=True, select=1), 'write_date': fields.datetime('Date Modified', readonly=True), @@ -112,7 +114,7 @@ class document_directory(osv.osv): while d2 and d2.parent_id: s = d2.name + (s and ('/' + s) or '') d2 = d2.parent_id - res.append((d.id, s)) + res.append((d.id, s or d.name)) return res def get_full_path(self, cr, uid, dir_id, context=None): diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py index d20870ff825..ac9925c1635 100644 --- a/addons/document/document_storage.py +++ b/addons/document/document_storage.py @@ -96,6 +96,8 @@ class document_storage(osv.osv): """ _name = 'document.storage' _description = 'Storage Media' + _log_create=True + _columns = { 'name': fields.char('Name', size=64, required=True, select=1), 'write_date': fields.datetime('Date Modified', readonly=True), diff --git a/addons/idea/idea.py b/addons/idea/idea.py index 14fb24ee607..64b197cf858 100644 --- a/addons/idea/idea.py +++ b/addons/idea/idea.py @@ -33,6 +33,7 @@ class idea_category(osv.osv): _name = "idea.category" _description = "Idea Category" + _log_create=True _columns = { 'name': fields.char('Category', size=64, required=True), @@ -52,6 +53,7 @@ class idea_idea(osv.osv): """ Idea """ _name = 'idea.idea' _rec_name = 'title' + _log_create=True def _vote_avg_compute(self, cr, uid, ids, name, arg, context = None): diff --git a/addons/lunch/lunch.py b/addons/lunch/lunch.py index 88d080c11bd..1a06c35c65e 100644 --- a/addons/lunch/lunch.py +++ b/addons/lunch/lunch.py @@ -115,6 +115,7 @@ class lunch_order(osv.osv): _name = 'lunch.order' _description = "Lunch Order" _rec_name = "user_id" + _log_create=True def _price_get(self, cr, uid, ids, name, args, context=None): diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index 5a4ab95c935..d5bba205425 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -75,7 +75,6 @@ class mailgate_thread(osv.osv): if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'): cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context) - model_obj = self.pool.get('ir.model') att_obj = self.pool.get('ir.attachment') obj = self.pool.get('mailgate.message') @@ -114,6 +113,7 @@ class mailgate_thread(osv.osv): 'attachment_ids': [(6, 0, attachments)] } res = obj.create(cr, uid, data, context) + case._table.log(cr, uid, case.id, case._description + " '" + case.name + "': " + keyword, context=context) return True _history = __history @@ -129,6 +129,7 @@ class mailgate_message(osv.osv): _name = 'mailgate.message' _description = 'Mailgateway Message' _order = 'date desc' + _log_create=True _columns = { 'name':fields.char('Message', size=64), From 6765024e27d3693eaf5c59d880bb91f2add448c1 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 8 Jun 2010 11:13:36 +0530 Subject: [PATCH 2/8] [ADD]: base_contact: Added migration script to create a contact with the name of the address when we install base_contact bzr revid: rpa@tinyerp.com-20100608054336-0qgwpndsdv0gft5q --- .../1.2/pre-10-res_partner_address_change.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py diff --git a/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py b/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py new file mode 100644 index 00000000000..326a9caed9d --- /dev/null +++ b/addons/base_contact/migrations/1.2/pre-10-res_partner_address_change.py @@ -0,0 +1,28 @@ +# -*- coding: utf8 -*- + +__name__ = "res.partner.adress: for each address it should create a contact with the name of the address" + +def migrate(cr, version): + generate_contact(cr) + +def generate_contact(cr): + cr.execute("""DROP TRIGGER IF EXISTS contactjob on res_partner_contact; + DROP LANGUAGE IF EXISTS plpgsql CASCADE; + CREATE LANGUAGE plpgsql ; + CREATE OR REPLACE FUNCTION add_to_job() RETURNS TRIGGER AS $contactjob$ + DECLARE + new_name varchar; + new_phonenum varchar; + BEGIN + IF(TG_OP='INSERT') THEN + INSERT INTO res_partner_job(contact_id, address_id, function, state) VALUES(NEW.id, NEW.website::integer,NEW.first_name, 'current'); + UPDATE res_partner_contact set first_name=Null, website=Null, active=True where id=NEW.id; + END IF; + RETURN NEW; + END; + $contactjob$ LANGUAGE plpgsql; + CREATE TRIGGER contactjob AFTER INSERT ON res_partner_contact FOR EACH ROW EXECUTE PROCEDURE add_to_job();""") + cr.commit() + + cr.execute("INSERT into res_partner_contact (name, title, email, first_name, website) (SELECT coalesce(name, 'Noname'), title, email, function , to_char(id, '99999999') from res_partner_address)") + cr.commit() From 70609fc6673d4c673242a94c1daafe00425f9625 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 8 Jun 2010 12:23:50 +0530 Subject: [PATCH 3/8] [IMP]: caldav: Applied reverted changes of Export ics wizard bzr revid: rpa@tinyerp.com-20100608065350-9rqucdoxgi0hjyxy --- addons/caldav/wizard/calendar_event_export.py | 13 +++---------- addons/caldav/wizard/calendar_event_export_view.xml | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/addons/caldav/wizard/calendar_event_export.py b/addons/caldav/wizard/calendar_event_export.py index 856d9e9bc91..0be54df9f56 100644 --- a/addons/caldav/wizard/calendar_event_export.py +++ b/addons/caldav/wizard/calendar_event_export.py @@ -32,16 +32,6 @@ class calendar_event_export(osv.osv_memory): """ Export Calendar Event. """ - def process_export_ics(self, cr, uid, ids, context): - """ - Get Default value for file_path field. - """ - model = context.get('model', 'basic.calendar') - model_obj = self.pool.get(model) - - calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) - self.write(cr, uid, ids, {'file_path': base64.encodestring(calendar)}) - return False def default_get(self, cr, uid, fields, context): """ @@ -54,6 +44,9 @@ class calendar_event_export(osv.osv_memory): name = 'OpenERP %s.ics' % (model_obj._description) if 'name' in fields: res.update({'name': name}) + if 'file_path' in fields: + calendar = model_obj.export_cal(cr, uid, context['active_ids'], context) + res.update({'file_path': base64.encodestring(calendar)}) return res _name = "calendar.event.export" diff --git a/addons/caldav/wizard/calendar_event_export_view.xml b/addons/caldav/wizard/calendar_event_export_view.xml index 227822966d0..cfadf945bf4 100644 --- a/addons/caldav/wizard/calendar_event_export_view.xml +++ b/addons/caldav/wizard/calendar_event_export_view.xml @@ -13,8 +13,8 @@ -