[MERGE] forward port branch 10.0 up to afd4b68acc
This commit is contained in:
@@ -932,7 +932,7 @@ class AccountInvoice(models.Model):
|
|||||||
return {
|
return {
|
||||||
'date_maturity': line.get('date_maturity', False),
|
'date_maturity': line.get('date_maturity', False),
|
||||||
'partner_id': part,
|
'partner_id': part,
|
||||||
'name': line['name'][:64],
|
'name': line['name'],
|
||||||
'debit': line['price'] > 0 and line['price'],
|
'debit': line['price'] > 0 and line['price'],
|
||||||
'credit': line['price'] < 0 and -line['price'],
|
'credit': line['price'] < 0 and -line['price'],
|
||||||
'account_id': line['account_id'],
|
'account_id': line['account_id'],
|
||||||
|
|||||||
@@ -1,11 +1,31 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
from mock import patch
|
||||||
|
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestPartnerAssign(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):
|
def test_00_partner_assign(self):
|
||||||
partner2 = self.env.ref('base.res_partner_2')
|
partner2 = self.env.ref('base.res_partner_2')
|
||||||
lead = self.env.ref('crm.crm_case_21')
|
lead = self.env.ref('crm.crm_case_21')
|
||||||
|
|||||||
@@ -155,6 +155,8 @@ class TransactionCase(BaseCase):
|
|||||||
self.cr.rollback()
|
self.cr.rollback()
|
||||||
self.cr.close()
|
self.cr.close()
|
||||||
|
|
||||||
|
self.patch(type(self.env['res.partner']), '_get_gravatar_image', lambda *a: False)
|
||||||
|
|
||||||
def patch(self, obj, key, val):
|
def patch(self, obj, key, val):
|
||||||
""" Do the patch ``setattr(obj, key, val)``, and prepare cleanup. """
|
""" Do the patch ``setattr(obj, key, val)``, and prepare cleanup. """
|
||||||
old = getattr(obj, key)
|
old = getattr(obj, key)
|
||||||
|
|||||||
Reference in New Issue
Block a user