From f09e11f55b663da8f8bab41c5fc784b8ab694b05 Mon Sep 17 00:00:00 2001 From: Anael Closson Date: Mon, 4 Aug 2014 17:24:56 +0200 Subject: [PATCH 01/29] [FIX] sale: quote character in company name is converted to html entity Avoid to get company names such as "L'abc" to be transformed as "L'abc" opw 607221 --- addons/account/edi/invoice_action_data.xml | 2 +- addons/portal_sale/portal_sale_data.xml | 4 ++-- addons/purchase/edi/purchase_order_action_data.xml | 2 +- addons/sale/edi/sale_order_action_data.xml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/account/edi/invoice_action_data.xml b/addons/account/edi/invoice_action_data.xml index 013d259e874..2dbeb707009 100644 --- a/addons/account/edi/invoice_action_data.xml +++ b/addons/account/edi/invoice_action_data.xml @@ -23,7 +23,7 @@ Invoice - Send by Email ${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe} - ${object.company_id.name} Invoice (Ref ${object.number or 'n/a'}) + ${object.company_id.name|safe} Invoice (Ref ${object.number or 'n/a'}) ${object.partner_id.id} diff --git a/addons/portal_sale/portal_sale_data.xml b/addons/portal_sale/portal_sale_data.xml index f313e774fe0..3aed0beb2ae 100644 --- a/addons/portal_sale/portal_sale_data.xml +++ b/addons/portal_sale/portal_sale_data.xml @@ -7,7 +7,7 @@ Sales Order - Send by Email (Portal) ${(object.user_id.email or '')|safe} - ${object.company_id.name} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' }) + ${object.company_id.name|safe} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' }) ${object.partner_invoice_id.id} @@ -97,7 +97,7 @@ Invoice - Send by Email (Portal) ${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe} - ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) + ${object.company_id.name|safe} Invoice (Ref ${object.number or 'n/a' }) ${object.partner_id.id} diff --git a/addons/purchase/edi/purchase_order_action_data.xml b/addons/purchase/edi/purchase_order_action_data.xml index ab2b652bf4e..c9aae5a9317 100644 --- a/addons/purchase/edi/purchase_order_action_data.xml +++ b/addons/purchase/edi/purchase_order_action_data.xml @@ -20,7 +20,7 @@ Purchase Order - Send by mail ${(object.validator.email or '')|safe} - ${object.company_id.name} Order (Ref ${object.name or 'n/a' }) + ${object.company_id.name|safe} Order (Ref ${object.name or 'n/a' }) ${object.partner_id.id} diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml index 0d388a1896a..4fedfd7da09 100644 --- a/addons/sale/edi/sale_order_action_data.xml +++ b/addons/sale/edi/sale_order_action_data.xml @@ -21,7 +21,7 @@ Sales Order - Send by Email ${(object.user_id.email or '')|safe} - ${object.company_id.name} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' }) + ${object.company_id.name|safe} ${object.state in ('draft', 'sent') and 'Quotation' or 'Order'} (Ref ${object.name or 'n/a' }) ${object.partner_invoice_id.id} From 70b246c3c7d6c7b197f1d36cf6c86aeed896d077 Mon Sep 17 00:00:00 2001 From: Anael Closson Date: Tue, 5 Aug 2014 17:01:23 +0200 Subject: [PATCH 02/29] [FIX] analytic: name_search on accounts The name_search was hardcoding ilike operator while it could be different. This means that a name_search "name != Agrolait" would return accounts with agrolait. A side effect of this was the impossibility to import account_analytic_account whose parent is a substring of another - opw 607315 --- addons/analytic/analytic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 5a77b86f14f..5c91caad3a5 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -301,7 +301,7 @@ class account_analytic_account(osv.osv): dom = [] for name2 in name.split('/'): name = name2.strip() - account_ids = self.search(cr, uid, dom + [('name', 'ilike', name)] + args, limit=limit, context=context) + account_ids = self.search(cr, uid, dom + [('name', operator, name)] + args, limit=limit, context=context) if not account_ids: break dom = [('parent_id','in',account_ids)] else: From bc4217ced23288f8ab2a67659903b89625584e68 Mon Sep 17 00:00:00 2001 From: Rifakat Husen Date: Tue, 5 Aug 2014 17:15:06 +0200 Subject: [PATCH 03/29] [FIX] stock: onchange method should take the description The onchange_product_id method used to only change the description if the stock.move is not saved yet. That does not make much sense. opw 607347, bug lp:1314700 --- addons/stock/stock.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 64284f7c0c2..e3e7d539771 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1939,14 +1939,13 @@ class stock_move(osv.osv): product = self.pool.get('product.product').browse(cr, uid, [prod_id], context=ctx)[0] uos_id = product.uos_id and product.uos_id.id or False result = { + 'name': product.partner_ref, 'product_uom': product.uom_id.id, 'product_uos': uos_id, 'product_qty': 1.00, 'product_uos_qty' : self.pool.get('stock.move').onchange_quantity(cr, uid, ids, prod_id, 1.00, product.uom_id.id, uos_id)['value']['product_uos_qty'], 'prodlot_id' : False, } - if not ids: - result['name'] = product.partner_ref if loc_id: result['location_id'] = loc_id if loc_dest_id: From c45c2eb58eef5f62e32a7987a8b9a71c134a2a24 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 11:17:39 +0200 Subject: [PATCH 04/29] [FIX] website_quote: add description sale to quote line description --- addons/website_quote/models/order.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/website_quote/models/order.py b/addons/website_quote/models/order.py index c031baf7632..6b5d365e203 100644 --- a/addons/website_quote/models/order.py +++ b/addons/website_quote/models/order.py @@ -64,11 +64,14 @@ class sale_quote_line(osv.osv): def on_change_product_id(self, cr, uid, ids, product, context=None): vals = {} product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context) + name = product_obj.name + if product_obj.description_sale: + name += '\n' + product_obj.description_sale vals.update({ 'price_unit': product_obj.list_price, 'product_uom_id': product_obj.uom_id.id, 'website_description': product_obj.website_description, - 'name': product_obj.name, + 'name': name, }) return {'value': vals} From 3bb6136055d582c1db53f750bfdaea827acfb6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Sladkevi=C4=8Dius?= Date: Mon, 4 Aug 2014 13:37:50 +0300 Subject: [PATCH 05/29] [FIX] point_of_sale: clear tag in pos order sheet layout Without clear tag total amounts breaks sheet layout. --- addons/point_of_sale/point_of_sale_view.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/point_of_sale/point_of_sale_view.xml b/addons/point_of_sale/point_of_sale_view.xml index b2a2d4ad002..716dd7d4570 100644 --- a/addons/point_of_sale/point_of_sale_view.xml +++ b/addons/point_of_sale/point_of_sale_view.xml @@ -64,6 +64,7 @@ +
From 095be21ab17f7f731877d61c99b48b51119ff39a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 12:47:40 +0200 Subject: [PATCH 06/29] [FIX] crm_claim: allow to create claim as portal user It wasn't possible to create claims as a portal user when the portal user had a parent_id --- addons/portal_claim/__init__.py | 1 + addons/portal_claim/portal_claim.py | 39 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 addons/portal_claim/portal_claim.py diff --git a/addons/portal_claim/__init__.py b/addons/portal_claim/__init__.py index 26c654db9dd..dbd07a05428 100644 --- a/addons/portal_claim/__init__.py +++ b/addons/portal_claim/__init__.py @@ -19,3 +19,4 @@ # ############################################################################## +import portal_claim \ No newline at end of file diff --git a/addons/portal_claim/portal_claim.py b/addons/portal_claim/portal_claim.py new file mode 100644 index 00000000000..d7c9c1af6ca --- /dev/null +++ b/addons/portal_claim/portal_claim.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-today OpenERP SA () +# +# 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 openerp import SUPERUSER_ID +from openerp.addons.base_status.base_stage import base_stage +from openerp.osv import osv + + +class crm_claim(base_stage, osv.osv): + _inherit = "crm.claim" + + def default_get(self, cr, uid, fields, context=None): + res = super(crm_claim, self).default_get(cr, uid, fields, context=context) + if isinstance(res.get('partner_id'), (int, long)): + # Special case for portal users, as they are not allowed to call name_get on res.partner + # We save this call for the web client by returning it in default get + res['partner_id'] = self.pool['res.partner'].name_get( + cr, SUPERUSER_ID, [res['partner_id']], context=context)[0] + return res + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 5666c219ad35bfc5ff550a1ef056b1e8ab8e8353 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 13:06:46 +0200 Subject: [PATCH 07/29] [FIX] crm_claim: set options no_create, no_open instead of selection To avoid access denied errors for portal users --- addons/crm_claim/crm_claim_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_claim/crm_claim_view.xml b/addons/crm_claim/crm_claim_view.xml index e7724cb3b6d..b608be8acaa 100644 --- a/addons/crm_claim/crm_claim_view.xml +++ b/addons/crm_claim/crm_claim_view.xml @@ -124,7 +124,7 @@ - From 63dffd5e79e69f8377d13abba02b0a41781cd9d0 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 13:50:35 +0200 Subject: [PATCH 08/29] [FIX] portal_sale: inadvertence during the forward port 978fd47261d3a6cb6e39053892fb291bf61b511c --- addons/portal_sale/portal_sale_data.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/portal_sale/portal_sale_data.xml b/addons/portal_sale/portal_sale_data.xml index 49f7c172e27..dc015777288 100644 --- a/addons/portal_sale/portal_sale_data.xml +++ b/addons/portal_sale/portal_sale_data.xml @@ -97,13 +97,8 @@ Invoice - Send by Email (Portal) ${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe} -<<<<<<< HEAD - ${object.company_id.name} Invoice (Ref ${object.number or 'n/a' }) - ${object.partner_id.id} -======= ${object.company_id.name|safe} Invoice (Ref ${object.number or 'n/a' }) - ${object.partner_id.id} ->>>>>>> 7.0 + ${object.partner_id.id} From d909f763b8d6c57c23f71b14e66fbb3e8fe79044 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 14:18:57 +0200 Subject: [PATCH 09/29] [FIX] mail: add tooltip to send a message and log a note links --- addons/mail/static/src/xml/mail.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index e718a42c813..1e52105c739 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -50,9 +50,10 @@
From 02f0caf1b8adf3a56931dc4e5feb0f9abc32e0df Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 6 Aug 2014 14:51:48 +0200 Subject: [PATCH 10/29] [FIX] account_voucher: validation of refund in multicurrency Fixing several issues for refunds in multicurrency mode that prevented the moves to be balanced. The amount_currency needs to use the absolute value, as a refund will have a negative amount. The sign for currency_rate_difference needs to use the line instead of the voucher as they can have different value. e.g. a voucher of 1000$ with invoice of 1200$ and refund of 200$ will have two lines and their currency_rate_difference should have different signs. Avoids doubling the value in foreign_currency_diff Fixes #1490, opw 607118 & 611580 --- addons/account_voucher/account_voucher.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index a7c7646f6e1..ce6a35adb32 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -1055,7 +1055,8 @@ class account_voucher(osv.osv): 'period_id': voucher.period_id.id, 'partner_id': voucher.partner_id.id, 'currency_id': company_currency <> current_currency and current_currency or False, - 'amount_currency': company_currency <> current_currency and sign * voucher.amount or 0.0, + 'amount_currency': (sign * abs(voucher.amount) # amount < 0 for refunds + if company_currency != current_currency else 0.0), 'date': voucher.date, 'date_maturity': voucher.date_due } @@ -1217,7 +1218,7 @@ class account_voucher(osv.osv): if line.amount == line.amount_unreconciled: if not line.move_line_id: raise osv.except_osv(_('Wrong voucher line'),_("The invoice you are willing to pay is not valid anymore.")) - sign = voucher.type in ('payment', 'purchase') and -1 or 1 + sign = line.type =='dr' and -1 or 1 currency_rate_difference = sign * (line.move_line_id.amount_residual - amount) else: currency_rate_difference = 0.0 @@ -1275,8 +1276,7 @@ class account_voucher(osv.osv): # otherwise we use the rates of the system amount_currency = currency_obj.compute(cr, uid, company_currency, line.move_line_id.currency_id.id, move_line['debit']-move_line['credit'], context=ctx) if line.amount == line.amount_unreconciled: - sign = voucher.type in ('payment', 'purchase') and -1 or 1 - foreign_currency_diff = sign * line.move_line_id.amount_residual_currency + amount_currency + foreign_currency_diff = line.move_line_id.amount_residual_currency - abs(amount_currency) move_line['amount_currency'] = amount_currency voucher_line = move_line_obj.create(cr, uid, move_line) From 518649c371bf6a2ec528e4e5eb66dc266ba3b64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= Date: Thu, 17 Jul 2014 17:43:02 +0200 Subject: [PATCH 11/29] [FIX] l10n_be: spelling error in financial reports --- addons/l10n_be/account_financial_report.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be/account_financial_report.xml b/addons/l10n_be/account_financial_report.xml index ccc118d30ae..2abfce472f7 100644 --- a/addons/l10n_be/account_financial_report.xml +++ b/addons/l10n_be/account_financial_report.xml @@ -640,7 +640,7 @@
- Bénéfice (Perte) de l'excercice avant impôts + Bénéfice (Perte) de l'exercice avant impôts no_detail @@ -674,7 +674,7 @@ - Bénéfice (Perte) de l'excercice + Bénéfice (Perte) de l'exercice no_detail From 629e3709d019cb570cdae08e02dd5b416c526b5e Mon Sep 17 00:00:00 2001 From: Humberto Arocha Date: Thu, 10 Jul 2014 01:23:51 -0430 Subject: [PATCH 12/29] [FIX] Account: Consolidation Account should not be carried to next fiscalyear --- addons/account/wizard/account_fiscalyear_close.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index 28ddf39cd7f..5b6881f6ae1 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -132,7 +132,7 @@ class account_fiscalyear_close(osv.osv_memory): FROM account_account a LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active - AND a.type != 'view' + AND a.type not in ('view', 'consolidation') AND a.company_id = %s AND t.close_method = %s''', (company_id, 'unreconciled', )) account_ids = map(lambda x: x[0], cr.fetchall()) @@ -182,7 +182,7 @@ class account_fiscalyear_close(osv.osv_memory): FROM account_account a LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active - AND a.type != 'view' + AND a.type not in ('view', 'consolidation') AND a.company_id = %s AND t.close_method = %s''', (company_id, 'detail', )) account_ids = map(lambda x: x[0], cr.fetchall()) @@ -211,7 +211,7 @@ class account_fiscalyear_close(osv.osv_memory): FROM account_account a LEFT JOIN account_account_type t ON (a.user_type = t.id) WHERE a.active - AND a.type != 'view' + AND a.type not in ('view', 'consolidation') AND a.company_id = %s AND t.close_method = %s''', (company_id, 'balance', )) account_ids = map(lambda x: x[0], cr.fetchall()) From 5ca6b09375ce018e8e44e7e3cb5d0107c5a3a835 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Wed, 6 Aug 2014 19:00:01 +0200 Subject: [PATCH 13/29] [FIX] account: payment_ids should list payments of same account than the invoice account --- addons/account/account_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index afd0077bbc8..00d0b0d57a0 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -177,6 +177,8 @@ class account_invoice(osv.osv): lines = [] if invoice.move_id: for m in invoice.move_id.line_id: + if m.account_id != invoice.account_id: + continue temp_lines = [] if m.reconcile_id: temp_lines = map(lambda x: x.id, m.reconcile_id.line_id) From ed79bc203fdcbb4e7c3b6b6b68bd73ef0bb15bad Mon Sep 17 00:00:00 2001 From: fka-odoo Date: Wed, 23 Jul 2014 17:27:25 +0530 Subject: [PATCH 14/29] [FIX] account: child_of operator in invoice analysis report When displaying invoice analysis of a company, include the invoices of the members of this company (opw 611084) --- addons/account/report/account_invoice_report_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_invoice_report_view.xml b/addons/account/report/account_invoice_report_view.xml index dad70f695dc..93c80708253 100644 --- a/addons/account/report/account_invoice_report_view.xml +++ b/addons/account/report/account_invoice_report_view.xml @@ -61,7 +61,7 @@ - + From 1826f6d4eca499754a1f4bbe7179987eab473a55 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 7 Aug 2014 11:41:18 +0200 Subject: [PATCH 15/29] [FIX] payment_paypal: use the validate url according to the acquirer env --- addons/payment_paypal/controllers/main.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/addons/payment_paypal/controllers/main.py b/addons/payment_paypal/controllers/main.py index 967059e59ae..909f6a34843 100644 --- a/addons/payment_paypal/controllers/main.py +++ b/addons/payment_paypal/controllers/main.py @@ -40,12 +40,20 @@ class PaypalController(http.Controller): Once data is validated, process it. """ res = False new_post = dict(post, cmd='_notify-validate') - urequest = urllib2.Request("https://www.sandbox.paypal.com/cgi-bin/webscr", werkzeug.url_encode(new_post)) + cr, uid, context = request.cr, request.uid, request.context + reference = post.get('item_number') + tx = None + if reference: + tx_ids = request.registry['payment.transaction'].search(cr, uid, [('reference', '=', reference)], context=context) + if tx_ids: + tx = request.registry['payment.transaction'].browse(cr, uid, tx_ids[0], context=context) + paypal_urls = request.registry['payment.acquirer']._get_paypal_urls(cr, uid, tx and tx.acquirer_id and tx.acquirer_id.env or 'prod', context=context) + validate_url = paypal_urls['paypal_form_url'] + urequest = urllib2.Request(validate_url, werkzeug.url_encode(new_post)) uopen = urllib2.urlopen(urequest) resp = uopen.read() if resp == 'VERIFIED': _logger.info('Paypal: validated data') - cr, uid, context = request.cr, SUPERUSER_ID, request.context res = request.registry['payment.transaction'].form_feedback(cr, uid, post, 'paypal', context=context) elif resp == 'INVALID': _logger.warning('Paypal: answered INVALID on data verification') From b0b9153cf765b027080b26905d571caf80bb9d26 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 7 Aug 2014 11:54:30 +0200 Subject: [PATCH 16/29] [FIX] payment_paypal: SUPERUSER_ID removed by inadvertence in 1826f6d4eca499754a1f4bbe7179987eab473a55 --- addons/payment_paypal/controllers/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_paypal/controllers/main.py b/addons/payment_paypal/controllers/main.py index 909f6a34843..e07fa3d738f 100644 --- a/addons/payment_paypal/controllers/main.py +++ b/addons/payment_paypal/controllers/main.py @@ -54,7 +54,7 @@ class PaypalController(http.Controller): resp = uopen.read() if resp == 'VERIFIED': _logger.info('Paypal: validated data') - res = request.registry['payment.transaction'].form_feedback(cr, uid, post, 'paypal', context=context) + res = request.registry['payment.transaction'].form_feedback(cr, SUPERUSER_ID, post, 'paypal', context=context) elif resp == 'INVALID': _logger.warning('Paypal: answered INVALID on data verification') else: From 6655a020c3b3fdc3cfcb6336203afc0027892ca1 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Thu, 7 Aug 2014 13:02:59 +0200 Subject: [PATCH 17/29] [FIX] calendar/crm: Add active_id (if in model partner_id) in defaults values from partner_ids when we creates a new meeting. Bug was that when you click on meeting button from a res_partner form (Customers in menu), the button overwrites the context to use the active partner as a default in the calendar meeting. By consequence, the context overwritte the default partner who are the creator. Now the context could be removed from action and that is in get_default for partner_ids (from model calendar_event) that we add the creator AND the active_id if from a model res_partner. --- addons/calendar/calendar.py | 11 ++++++++++- addons/crm/res_partner_view.xml | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 34a348c5b25..5420f67acc0 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -855,6 +855,15 @@ class calendar_event(osv.Model): 'alarm_ids': fields.many2many('calendar.alarm', string='Reminders', ondelete="restrict"), } + + def _get_default_partners(self, cr, uid, ctx=None): + ret = [self.pool['res.users'].browse(cr, uid, uid, context=ctx).partner_id.id] + active_id = ctx.get('active_id') + if ctx.get('active_model') == 'res.partner' and active_id: + if active_id not in ret: + ret.append(active_id) + return ret + _defaults = { 'end_type': 'count', 'count': 1, @@ -866,7 +875,7 @@ class calendar_event(osv.Model): 'interval': 1, 'active': 1, 'user_id': lambda self, cr, uid, ctx: uid, - 'partner_ids': lambda self, cr, uid, ctx: [self.pool['res.users'].browse(cr, uid, [uid], context=ctx)[0].partner_id.id] + 'partner_ids': _get_default_partners, } def _check_closing_date(self, cr, uid, ids, context=None): diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 7613c2161fc..ad7cee3a27e 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -97,7 +97,7 @@