From 016768a750fb78087d64ebf5cd15bfe098037baf Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Jul 2010 14:08:32 +0530 Subject: [PATCH 1/7] [IMP] Project_issue : Improved search panel bzr revid: jvo@tinyerp.com-20100708083832-2qloe1xik8u23rcr --- addons/project_issue/project_issue.py | 2 +- addons/project_issue/project_issue_view.xml | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 795c9883eca..533466f1615 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -113,7 +113,7 @@ class project_issue(osv.osv, crm.crm_case): 'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False), 'id': fields.integer('ID'), 'name': fields.char('Name', size=128, required=True), - 'active': fields.boolean('Active', required=False), + 'active': fields.boolean('Active', required=False), 'create_date': fields.datetime('Creation Date' , readonly=True), 'write_date': fields.datetime('Update Date' , readonly=True), 'date_deadline': fields.date('Deadline'), diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 9362e858b1e..483fda01ec1 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -177,6 +177,12 @@ + + + + + + + + From f048d0eb2acc119a163f7c87f715110389e72bb1 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Mon, 31 May 2010 15:27:29 +0530 Subject: [PATCH 2/7] [ADD]:project:add Done By buttons in search for task analysis report. bzr revid: apa@tinyerp.com-20100531095729-dak30j147w9p23jq --- addons/project/report/project_report.py | 3 +++ addons/project/report/project_report_view.xml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/project/report/project_report.py b/addons/project/report/project_report.py index dc9ad3adb22..7984441b460 100644 --- a/addons/project/report/project_report.py +++ b/addons/project/report/project_report.py @@ -31,6 +31,7 @@ class report_project_task_user(osv.osv): 'day': fields.char('Day', size=128, readonly=True), 'year': fields.char('Year',size=64,required=False, readonly=True), 'user_id':fields.many2one('res.users', 'Assigned To', readonly=True), + 'done_by':fields.many2one('res.users', 'Done By', readonly=True), 'date_start': fields.date('Starting Date',readonly=True), 'no_of_days': fields.integer('# of Days', size=128, readonly=True), 'description': fields.text('Description',readonly=True), @@ -90,6 +91,7 @@ class report_project_task_user(osv.osv): t.company_id, t.partner_id, t.type, + w.user_id as done_by, sum(remaining_hours) as remaining_hours, sum(total_hours) as total_hours, sum(planned_hours) as hours_planned, @@ -104,6 +106,7 @@ class report_project_task_user(osv.osv): to_char(date_start, 'MM'), t.priority, t.user_id, + w.user_id, t.state, date_trunc('day',t.date_end), to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY'), diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index 9babb1655ef..8fa33ad77ec 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -12,6 +12,7 @@ + @@ -110,6 +111,7 @@ + @@ -122,6 +124,7 @@ + From fc5904091a10418a795253835f90f664e249fddb Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Mon, 31 May 2010 15:48:33 +0530 Subject: [PATCH 3/7] [IMP]:account:Improved Invioce Analysis report as guidline defined by al and nel. bzr revid: apa@tinyerp.com-20100531101833-p2nx1tz2xn2327tk --- .../account/report/account_invoice_report.py | 44 ++++++++++++++----- .../report/account_invoice_report_view.xml | 9 ++-- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index cd1477e79cf..523d77c84e3 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -36,10 +36,12 @@ class account_invoice_report(osv.osv): ('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True), 'product_id':fields.many2one('product.product', 'Product', readonly=True), 'product_qty':fields.float('Qty', readonly=True), + 'uom_name': fields.char('Default UoM', size=128, readonly=True), 'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True), 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')],readonly=True), 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',readonly=True), 'currency_id': fields.many2one('res.currency', 'Currency', readonly=True), + 'categ_id': fields.many2one('product.category','Category of Product', readonly=True), 'journal_id': fields.many2one('account.journal', 'Journal',readonly=True), 'partner_id':fields.many2one('res.partner', 'Partner', readonly=True), 'company_id':fields.many2one('res.company', 'Company', readonly=True), @@ -81,46 +83,64 @@ class account_invoice_report(osv.osv): to_char(s.date_invoice, 'MM') as month, to_char(s.date_invoice, 'YYYY-MM-DD') as day, l.product_id as product_id, - sum(l.quantity * u.factor) as product_qty, + sum(case when s.type in ('out_refund','in_invoice') then + l.quantity * u.factor * -1 + else + l.quantity * u.factor + end) as product_qty, s.partner_id as partner_id, s.payment_term as payment_term, s.period_id as period_id, + u.name as uom_name, s.currency_id as currency_id, s.journal_id as journal_id, s.fiscal_position as fiscal_position, s.user_id as user_id, s.company_id as company_id, - sum(l.quantity*l.price_unit) as price_total, - (sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average, + sum(case when s.type in ('out_refund','in_invoice') then + l.quantity*l.price_unit * -1 + else + l.quantity*l.price_unit + end) as price_total, + sum(case when s.type in ('out_refund','in_invoice') then + l.quantity*l.price_unit * -1 + else + l.quantity*l.price_unit + end) / sum(l.quantity * u.factor)::decimal(16,2) as price_average, count(*) as nbr, s.type as type, s.state, + pt.categ_id, s.date_due as date_due, s.address_contact_id as address_contact_id, s.address_invoice_id as address_invoice_id, s.account_id as account_id, s.partner_bank as partner_bank, - s.residual as residual, + sum(case when s.type in ('out_refund','in_invoice') then + s.residual * -1 + else + s.residual + end) as residual, case when s.state != 'paid' then null else - extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2) + extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2) end as delay_to_pay - from - account_invoice_line l - left join - account_invoice s on (s.id=l.invoice_id) - left join product_uom u on (u.id=l.uos_id), + from account_invoice_line l + left join account_invoice s on (s.id=l.invoice_id) + left join product_template pt on (pt.id=l.product_id) + left join product_uom u on (u.id=l.uos_id), account_move_line am left join account_invoice i on (i.move_id=am.move_id) - where - am.account_id=i.account_id + where am.account_id=i.account_id group by s.type, s.date_invoice, s.partner_id, l.product_id, + u.name, l.uos_id, s.user_id, s.state, s.residual, + pt.categ_id, s.company_id, s.payment_term, s.period_id, diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index 94f181cd587..965d5078ae9 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -16,8 +16,10 @@ - + + + @@ -97,16 +99,17 @@ - + + - + From f25789bbfc4eb7e3854b05d1a8ea9f7b770cba6d Mon Sep 17 00:00:00 2001 From: "Jni (Open ERP)" Date: Mon, 31 May 2010 17:03:15 +0530 Subject: [PATCH 4/7] [IMP]: Make Done By fieldvisible in a view bzr revid: jni@tinyerp.co.in-20100531113315-7fk4aosz91prm0bs --- addons/project/report/project_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/report/project_report_view.xml b/addons/project/report/project_report_view.xml index 8fa33ad77ec..b444d175311 100644 --- a/addons/project/report/project_report_view.xml +++ b/addons/project/report/project_report_view.xml @@ -12,7 +12,7 @@ - + From f1274a2a72772622d4e77d5c5320e00601fc2db3 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 31 May 2010 18:16:48 +0530 Subject: [PATCH 5/7] [REF] bzr revid: jvo@tinyerp.com-20100531124648-0sweu1d8yvtznyst --- addons/mail_gateway/__openerp__.py | 4 ++-- addons/mail_gateway/mail_gateway.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/mail_gateway/__openerp__.py b/addons/mail_gateway/__openerp__.py index b5e56a03ee1..aaf12b926b3 100644 --- a/addons/mail_gateway/__openerp__.py +++ b/addons/mail_gateway/__openerp__.py @@ -27,8 +27,8 @@ * IMAP / IMAP with SSL * POP / POP with SSL * SMTP / SMTP with TLS - * ACL basd access polocy - * Queing and History for Emails + * ACL based access policy + * Queueing and History for Emails * Easy Integration with any Module""", 'author': 'Tiny', 'website': 'http://www.openerp.com', diff --git a/addons/mail_gateway/mail_gateway.py b/addons/mail_gateway/mail_gateway.py index 8534c32c510..05d27ce3ef2 100644 --- a/addons/mail_gateway/mail_gateway.py +++ b/addons/mail_gateway/mail_gateway.py @@ -30,7 +30,7 @@ class one2many_domain(fields.one2many): user=user, context=context) def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): - if not context: + if context is None: context = {} res = {} msg_obj = obj.pool.get('mailgate.message') @@ -65,7 +65,7 @@ class mailgate_thread(osv.osv): @param email: Email address if any @param details: Details of case history if any @param context: A standard dictionary for contextual values""" - if not context: + if context is None: context = {} # The mailgate sends the ids of the cases and not the object list if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'): From 552c994c373b0531456193bbdcc3a532feab52b5 Mon Sep 17 00:00:00 2001 From: "DSH (Open ERP)" Date: Mon, 31 May 2010 20:22:20 +0530 Subject: [PATCH 6/7] [NEW] mailchimp module for marketing campaign - only mailchimp account access bzr revid: dsh@tinyerp.com-20100531145220-6j6mu3huol444535 --- .../marketing_campaign_mailchimp/__init__.py | 24 ++++ .../__openerp__.py | 41 ++++++ .../marketing_campaign_mailchimp.py | 131 ++++++++++++++++++ .../marketing_campaign_mailchimp_view.xml | 87 ++++++++++++ 4 files changed, 283 insertions(+) create mode 100644 addons/marketing_campaign_mailchimp/__init__.py create mode 100644 addons/marketing_campaign_mailchimp/__openerp__.py create mode 100644 addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp.py create mode 100644 addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp_view.xml diff --git a/addons/marketing_campaign_mailchimp/__init__.py b/addons/marketing_campaign_mailchimp/__init__.py new file mode 100644 index 00000000000..0f354314327 --- /dev/null +++ b/addons/marketing_campaign_mailchimp/__init__.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 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 marketing_campaign_mailchimp + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/marketing_campaign_mailchimp/__openerp__.py b/addons/marketing_campaign_mailchimp/__openerp__.py new file mode 100644 index 00000000000..bd614607b97 --- /dev/null +++ b/addons/marketing_campaign_mailchimp/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 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 . +# +############################################################################## + + +{ + "name" : "", + "version" : "1.1", + "depends" : ['marketing_campaign'], + "author" : "Tiny", + "category": 'Generic Modules/Marketing', + "description": """ + """, + 'website': 'http://www.openerp.com', + 'init_xml': [], + 'update_xml': [ + 'marketing_campaign_mailchimp_view.xml', + ], + 'demo_xml': [], + 'installable': True, + 'active': False, +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp.py b/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp.py new file mode 100644 index 00000000000..a1c3162cee2 --- /dev/null +++ b/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp.py @@ -0,0 +1,131 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 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 . +# +############################################################################## + +from osv import fields, osv + +import urllib2 +import simplejson as json + +mailchimp_url = 'http://%s.api.mailchimp.com/1.2' + +class marketing_campaign_mailchimp_account(osv.osv): #{{{ + _name = "marketing.campaign.mailchimp.account" + + _columns = { + 'name': fields.char('Account Name', size=64), + 'username': fields.char('Username', size=64, required=True), + 'password': fields.char('Password', size=64, required=True), + 'apikey': fields.char('API Key', size=128), + 'data_center': fields.selection([('us1', 'US1'), ('us2', 'US2'), + ('uk1', 'UK1')], 'Data Center'), + 'state': fields.selection([('draft', 'Draft'), ('approved', 'Approved'), + ('cancelled', 'Cancelled')], 'State', readonly=True) + } + + _defaults = { + 'state': lambda *a: 'draft' + } + + def get_response(self, cr, uid, mailchimp_id, method, params={}): + mailchimp_account = self.browse(cr, uid, mailchimp_id) + params['output'] = 'json' + if method == 'login': + params['username'] = mailchimp_account.username + params['password'] = mailchimp_account.password + else : + params['apikey'] = mailchimp_account.apikey + params = '&'.join(map(lambda x : '%s=%s' %(x, params[x]), params)) + url = mailchimp_url%mailchimp_account.data_center+ '/?method=%s'%method + req = urllib2.Request(url, params) + handle = urllib2.urlopen(req) + response = json.loads(handle.read()) + return response + + def button_approve(self, cr, uid, ids, context): + acc_obj = self.browse(cr, uid, ids)[0] + vals = {} + if not acc_obj.apikey: + method = 'login' + else: + method = 'ping' + response = self.get_response(cr, uid, acc_obj.id, method) + if 'error' not in response: + if method == 'login' : + vals['apikey'] = response + vals['state'] = 'approved' + self.write(cr, uid, ids, vals) + else : + raise osv.except_osv('Error!!!', + "Can't approved accoutnt : %s"%response['error']) + return True + + def button_cancel(self, cr, uid, ids, context): + self.write(cr, uid, ids, {'state': 'cancelled'}) + return True + +marketing_campaign_mailchimp_account() #}}} + +#class marketing_campaign_mailchimp_list(osv.osv_memory): #{{{ +# _name = "marketing.campaign.mailchimp.list" +# +# _columns = { +# 'name': fields.char('Name', size=64), +# 'mailchimp_account_id': fields.many2one('marketing.campaign.mailchimp.account', 'Account'), +# 'list_id': fields.char('List Id', size=64,), +# } +# +# _defaults = { +# 'state': lambda *a: 'draft' +# } +# +#marketing_campaign_mailchimp_list() #}}} + +class marketing_campaign_segment(osv.osv): #{{{ + _inherit = "marketing.campaign.segment" + + _columns = { + 'synchro': fields.boolean('Mailchimp Synchro'), + 'mailchimp_account_id': fields.many2one( + 'marketing.campaign.mailchimp.account', 'Account'), + 'mailchimp_list': fields.char('List', size=64), + } + + def onchange_mailchimp(self, cr, uid, ids, mailchimp_account_id): + if mailchimp_account_id: + return {'value':{'mailchimp_list':''}} + return {'value':{}} + + def onchange_mailchimp_list(self, cr, uid, ids, mailchimp_account_id, + mailchimp_list): + if mailchimp_account_id and mailchimp_list: + lists = self.pool.get('marketing.campaign.mailchimp.account').get_response(cr, + uid, mailchimp_account_id, 'lists') + list_names = [list['name'] for list in lists] + if mailchimp_list not in list_names: + raise osv.except_osv('Error!!!',"Lists doesn't exists") + else : + return {} + return {'value':{}} +marketing_campaign_segment() #}}} + + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp_view.xml b/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp_view.xml new file mode 100644 index 00000000000..6721cfc4fba --- /dev/null +++ b/addons/marketing_campaign_mailchimp/marketing_campaign_mailchimp_view.xml @@ -0,0 +1,87 @@ + + + + + + + + marketing.campaign.segment.form.inherit + marketing.campaign.segment + form + + + + + + + + + + + + + + + + + + + + + marketing.campaign.mailchimp.account.tree + marketing.campaign.mailchimp.account + tree + + + + + + + + + + + + + marketing.campaign.mailchimp.account.form + marketing.campaign.mailchimp.account + form + +
+ + + + + + + + + +