From b68da05833012dfadf6cd0157c8d0c86cb2a0c6c Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 1 Aug 2014 14:20:55 +0200 Subject: [PATCH 01/10] [FIX] mass_mailing: possibility to subscribe again to a mailing list It was not possible to subscribe again to a mailing list once unsubscribed --- addons/mass_mailing/controllers/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/mass_mailing/controllers/main.py b/addons/mass_mailing/controllers/main.py index bfe975059c5..2fcc6afd946 100644 --- a/addons/mass_mailing/controllers/main.py +++ b/addons/mass_mailing/controllers/main.py @@ -55,7 +55,7 @@ class MassMailController(http.Controller): email = request.session['mass_mailing_email'] if email: - contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], context=context) + contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email), ('opt_out', '=', False)], context=context) is_subscriber = len(contact_ids) > 0 return {'is_subscriber': is_subscriber, 'email': email} @@ -65,9 +65,12 @@ class MassMailController(http.Controller): cr, uid, context = request.cr, request.uid, request.context Contacts = request.registry['mail.mass_mailing.contact'] - contact_ids = Contacts.search(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], context=context) + contact_ids = Contacts.search_read(cr, SUPERUSER_ID, [('list_id', '=', int(list_id)), ('email', '=', email)], ['opt_out'], context=context) if not contact_ids: Contacts.add_to_list(cr, SUPERUSER_ID, email, int(list_id), context=context) + else: + if contact_ids[0]['opt_out']: + Contacts.write(cr, SUPERUSER_ID, [contact_ids[0]['id']], {'opt_out': False}, context=context) # add email to session request.session['mass_mailing_email'] = email return True From 0023955074c146c19da8e51798ea3ec0c7f01da4 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 1 Aug 2014 14:48:16 +0200 Subject: [PATCH 02/10] [FIX] website_sale: confirm sale order on payment_confirmation Same behavior than in saas-5 --- addons/website_sale/controllers/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/website_sale/controllers/main.py b/addons/website_sale/controllers/main.py index 1871dd64e02..083f9651fd1 100644 --- a/addons/website_sale/controllers/main.py +++ b/addons/website_sale/controllers/main.py @@ -673,6 +673,7 @@ class Ecommerce(http.Controller): acquirer_form_post_url = payment_obj.get_form_action_url(cr, uid, acquirer_id, context=context) acquirer_total_url = '%s?%s' % (acquirer_form_post_url, werkzeug.url_encode(post)) + request.registry['sale.order'].action_button_confirm(cr, SUPERUSER_ID, [order.id], context=request.context) return request.redirect(acquirer_total_url) @http.route('/shop/payment/get_status/', type='json', auth="public", website=True, multilang=True) From b20636e0b2fa8590c9b80862249b98689cbcf285 Mon Sep 17 00:00:00 2001 From: Julien Legros Date: Fri, 1 Aug 2014 15:33:58 +0200 Subject: [PATCH 03/10] [FIX] website: update url in the footer --- addons/website/views/website_templates.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 5932931688a..312db8c6e76 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -192,8 +192,8 @@
- Create a free website with - OpenERP + Create a free website with + OpenERP
Copyright © Company name From eb775fc2ead0133f735d94af8b0fa275827d4bbe Mon Sep 17 00:00:00 2001 From: dhr-odoo Date: Wed, 9 Jul 2014 12:53:36 +0530 Subject: [PATCH 04/10] [FIX] orm: set default before removing magic fields When a record is created, the magic fields (id, create_date,...) are first removed from the vals as the user should not set a value for these. However if a value for this is given in default value (e.g. defined in an ir.value), the creation would crash (sql error : column specified more than once) as the magic column would be added again. --- openerp/osv/orm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 0a38ccf03d4..f0c8337ea6d 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4394,6 +4394,8 @@ class BaseModel(object): self._transient_vacuum(cr, user) self.check_access_rights(cr, user, 'create') + + vals = self._add_missing_default_values(cr, user, vals, context) if self._log_access: for f in LOG_ACCESS_COLUMNS: @@ -4401,7 +4403,6 @@ class BaseModel(object): _logger.warning( 'Field `%s` is not allowed when creating the model `%s`.', f, self._name) - vals = self._add_missing_default_values(cr, user, vals, context) tocreate = {} for v in self._inherits: From f6fb2b69df826cd582bd04b3b4d3b348d44067c0 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 1 Aug 2014 12:43:31 +0200 Subject: [PATCH 05/10] [FIX] product_visible_discount: multicurrency pricelists When we compute the discount of a product to display (result of product_id_change), we compare prices in the currency of the product while we expect prices in the currency of the pricelist. opw 606188 --- .../product_visible_discount/product_visible_discount.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index b8a6e4552ea..275bfcd68b1 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -84,10 +84,15 @@ class sale_order_line(osv.osv): list_price = pricelist_obj.price_get(cr, uid, [pricelist], product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order }) - pricelists = pricelist_obj.read(cr,uid,[pricelist],['visible_discount']) + so_pricelist = pricelist_obj.browse(cr, uid, pricelist, context=context) new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist) - if len(pricelists)>0 and pricelists[0]['visible_discount'] and list_price[pricelist] != 0 and new_list_price != 0: + if so_pricelist.visible_discount and list_price[pricelist] != 0 and new_list_price != 0: + if so_pricelist.currency_id.id != product.company_id.currency_id.id: + # new_list_price is in company's currency while price in pricelist currency + new_list_price = self.pool['res.currency'].compute(cr, uid, + product.company_id.currency_id.id, so_pricelist.currency_id.id, + new_list_price, context=context) discount = (new_list_price - price) / new_list_price * 100 if discount > 0: result['price_unit'] = new_list_price From 19e401adf0d85f07a013c29d64690bd4c88a92e6 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Fri, 1 Aug 2014 17:07:56 +0200 Subject: [PATCH 06/10] [IMP] base: show possible titles for companies (opw 608243) --- openerp/addons/base/res/res_partner_view.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/res/res_partner_view.xml b/openerp/addons/base/res/res_partner_view.xml index 724cce7bb5f..5f4cd26bbd7 100644 --- a/openerp/addons/base/res/res_partner_view.xml +++ b/openerp/addons/base/res/res_partner_view.xml @@ -31,6 +31,7 @@ + @@ -179,8 +180,8 @@ - + + From b4cbef43330ab7ae83c080934cb376352cfaeac3 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 1 Aug 2014 17:29:20 +0200 Subject: [PATCH 07/10] [FIX] account: res.partner: limit access to "total_invoiced" field to group "group_account_invoice". Use SUPERUSER_ID to access data --- addons/account/partner.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/account/partner.py b/addons/account/partner.py index 36ad47fb159..2de2c0fd4d9 100644 --- a/addons/account/partner.py +++ b/addons/account/partner.py @@ -22,6 +22,7 @@ from operator import itemgetter import time +from openerp import SUPERUSER_ID from openerp.osv import fields, osv class account_fiscal_position(osv.osv): @@ -166,8 +167,9 @@ class res_partner(osv.osv): result = {} account_invoice_report = self.pool.get('account.invoice.report') for partner in self.browse(cr, uid, ids, context=context): - invoice_ids = account_invoice_report.search(cr, uid, [('partner_id','child_of',partner.id)], context=context) - invoices = account_invoice_report.browse(cr, uid, invoice_ids, context=context) + domain = [('partner_id', 'child_of', partner.id)] + invoice_ids = account_invoice_report.search(cr, SUPERUSER_ID, domain, context=context) + invoices = account_invoice_report.browse(cr, SUPERUSER_ID, invoice_ids, context=context) result[partner.id] = sum(inv.user_currency_price_total for inv in invoices) return result @@ -210,7 +212,8 @@ class res_partner(osv.osv): fnct_search=_credit_search, string='Total Receivable', multi='dc', help="Total amount this customer owes you."), 'debit': fields.function(_credit_debit_get, fnct_search=_debit_search, string='Total Payable', multi='dc', help="Total amount you have to pay to this supplier."), 'debit_limit': fields.float('Payable Limit'), - 'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float'), + 'total_invoiced': fields.function(_invoice_total, string="Total Invoiced", type='float', groups='account.group_account_invoice'), + 'contracts_count': fields.function(_journal_item_count, string="Contracts", type='integer', multi="invoice_journal"), 'journal_item_count': fields.function(_journal_item_count, string="Journal Items", type="integer", multi="invoice_journal"), 'property_account_payable': fields.property( From 9411a2da03ebfe9d1aeacc43c8bd789a64f647e9 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 1 Aug 2014 22:42:01 +0200 Subject: [PATCH 08/10] [FIX] Model.load(): extra error checking while importing data If any missing or partially incorrect values cause an exception other than a psycopg2 error, we should still catch it, rollback that record and report the error, rather than letting bubble and fail without any feedback to the user. Fixes #1485 --- openerp/osv/orm.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index f0c8337ea6d..00093999bca 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -1389,6 +1389,16 @@ class BaseModel(object): # Failed to write, log to messages, rollback savepoint (to # avoid broken transaction) and keep going cr.execute('ROLLBACK TO SAVEPOINT model_load_save') + except Exception, e: + message = (_('Unknown error during import:') + + u' %s: %s' % (type(e), unicode(e))) + moreinfo = _('Resolve other errors first') + messages.append(dict(info, type='error', + message=message, + moreinfo=moreinfo)) + # Failed for some reason, perhaps due to invalid data supplied, + # rollback savepoint and keep going + cr.execute('ROLLBACK TO SAVEPOINT model_load_save') if any(message['type'] == 'error' for message in messages): cr.execute('ROLLBACK TO SAVEPOINT model_load') ids = False From fc920279797f8aef09c6e40b4b2fc1682823382e Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Fri, 1 Aug 2014 23:04:42 +0200 Subject: [PATCH 09/10] [FIX] website: OpenERP->Odoo in website footer --- addons/website/views/website_templates.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml index 312db8c6e76..be3ad6a5a1e 100644 --- a/addons/website/views/website_templates.xml +++ b/addons/website/views/website_templates.xml @@ -193,7 +193,7 @@
Create a free website with - OpenERP + Odoo
Copyright © Company name From 37ba23d5538fcb466b69b0474974e4088bd84a1c Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Sat, 2 Aug 2014 03:32:09 +0200 Subject: [PATCH 10/10] [FIX] product_visible_discount: no crash when no pricelist passed or product without company Fixes an error introduced in f6fb2b6 --- addons/product_visible_discount/product_visible_discount.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/product_visible_discount/product_visible_discount.py b/addons/product_visible_discount/product_visible_discount.py index cdc858dbbd6..9b0968ad1ac 100644 --- a/addons/product_visible_discount/product_visible_discount.py +++ b/addons/product_visible_discount/product_visible_discount.py @@ -67,7 +67,7 @@ class sale_order_line(osv.osv): result=res['value'] pricelist_obj=self.pool.get('product.pricelist') product_obj = self.pool.get('product.product') - if product: + if product and pricelist: if result.get('price_unit',False): price=result['price_unit'] else: @@ -81,7 +81,7 @@ class sale_order_line(osv.osv): new_list_price = get_real_price(list_price, product.id, qty, uom, pricelist) if so_pricelist.visible_discount and list_price[pricelist] != 0 and new_list_price != 0: - if so_pricelist.currency_id.id != product.company_id.currency_id.id: + if product.company_id and so_pricelist.currency_id.id != product.company_id.currency_id.id: # new_list_price is in company's currency while price in pricelist currency new_list_price = self.pool['res.currency'].compute(cr, uid, product.company_id.currency_id.id, so_pricelist.currency_id.id, @@ -94,4 +94,6 @@ class sale_order_line(osv.osv): result['discount'] = 0.0 else: result['discount'] = 0.0 + else: + result['discount'] = 0.0 return res