From 39892cdaa17707afc9528ca332abbb944806acc7 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 1 Aug 2017 16:03:46 +0200 Subject: [PATCH 1/3] [FIX] account: Only 64 characters for the name of an entry When creating a customer invoice with description/reference with more than 64 characters, the description was cut to generate the name of the account move lines. But it's possible to create an entry with more than 64 characters as name by the interface. The limitation is deprecated. opw:760316 --- addons/account/models/account_invoice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index d09e1600f87..afbcd6f6b69 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -926,7 +926,7 @@ class AccountInvoice(models.Model): return { 'date_maturity': line.get('date_maturity', False), 'partner_id': part, - 'name': line['name'][:64], + 'name': line['name'], 'debit': line['price'] > 0 and line['price'], 'credit': line['price'] < 0 and -line['price'], 'account_id': line['account_id'], From ed369292653ac58a22501da310df93401818ca37 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 1 Aug 2017 22:03:39 +0200 Subject: [PATCH 2/3] [FIX] core: avoid tests to contact gravatar server --- openerp/tests/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/tests/common.py b/openerp/tests/common.py index 1ca787ad380..475d0d1adba 100644 --- a/openerp/tests/common.py +++ b/openerp/tests/common.py @@ -160,6 +160,8 @@ class TransactionCase(BaseCase): self.cr.rollback() self.cr.close() + self.patch(type(self.env['res.partner']), '_get_gravatar_image', lambda *a: False) + def patch(self, obj, key, val): """ Do the patch ``setattr(obj, key, val)``, and prepare cleanup. """ old = getattr(obj, key) From afd4b68acc1c60152776e0fffd99c4e567c6058f Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 1 Aug 2017 22:39:29 +0200 Subject: [PATCH 3/3] [FIX] website_crm_partner_assign: mock geolocalisation during tests --- .../tests/test_partner_assign.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/addons/website_crm_partner_assign/tests/test_partner_assign.py b/addons/website_crm_partner_assign/tests/test_partner_assign.py index f5c056fa839..6bf5e00af76 100644 --- a/addons/website_crm_partner_assign/tests/test_partner_assign.py +++ b/addons/website_crm_partner_assign/tests/test_partner_assign.py @@ -1,11 +1,31 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +from mock import patch + from odoo.tests.common import TransactionCase class TestPartnerAssign(TransactionCase): + def setUp(self): + super(TestPartnerAssign, self).setUp() + + def geo_find(addr): + return { + 'Wavre, Belgium': (50.7158956, 4.6128075), + 'Cannon Hill Park, B46 3AG Birmingham, United Kingdom': (52.45216, -1.898578), + }.get(addr) + + patcher = patch('odoo.addons.base_geolocalize.models.res_partner.geo_find', wraps=geo_find) + patcher.start() + self.addCleanup(patcher.stop) + + patcher = patch('odoo.addons.website_crm_partner_assign.models.crm_lead.geo_find', + wraps=geo_find) + patcher.start() + self.addCleanup(patcher.stop) + def test_00_partner_assign(self): partner2 = self.env.ref('base.res_partner_2') lead = self.env.ref('crm.crm_case_21')