[MERGE] forward port branch saas-14 up to d0ece6cd89

This commit is contained in:
Christophe Simonis
2017-08-01 23:07:22 +02:00
3 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -941,7 +941,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'],
@@ -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')
+2
View File
@@ -155,6 +155,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)