summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-06-26 13:52:44 +0200
committerChristophe Simonis <chs@odoo.com>2019-06-26 13:52:44 +0200
commitb5beeb090196f0aa7d787e83a3b616d2ae705b13 (patch)
treec92970455045c5308c7dbb8ecc05412cc6f97c7d
parent35aeabb64775300fc4f5d2535904a13fde9da185 (diff)
parent7742887e963f805d461d8a3b0b19b8fb1a628328 (diff)
[MERGE] forward port branch 11.0 up to 7742887e963
-rw-r--r--addons/account/models/account_move.py3
-rw-r--r--addons/account/models/account_payment.py4
-rw-r--r--addons/crm/models/crm_lead.py2
-rw-r--r--addons/http_routing/models/ir_http.py11
4 files changed, 9 insertions, 11 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index 6253235442d..23a60c1423c 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -1389,7 +1389,8 @@ class AccountPartialReconcile(models.Model):
move_date = self.debit_move_id.date
newly_created_move = self.env['account.move']
with self.env.norecompute():
- for move in (self.debit_move_id.move_id, self.credit_move_id.move_id):
+ # We use a set here in case the reconciled lines belong to the same move (it happens with POS)
+ for move in {self.debit_move_id.move_id, self.credit_move_id.move_id}:
#move_date is the max of the 2 reconciled items
if move_date < move.date:
move_date = move.date
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index 26433ea3325..44096edfbd1 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -257,13 +257,11 @@ class account_register_payments(models.TransientModel):
'''
amount = self._compute_payment_amount(invoices=invoices) if self.multi else self.amount
payment_type = ('inbound' if amount > 0 else 'outbound') if self.multi else self.payment_type
- communication = (' '.join([inv.reference or inv.number for inv in invoices])
- if self.multi else self.communication)
return {
'journal_id': self.journal_id.id,
'payment_method_id': self.payment_method_id.id,
'payment_date': self.payment_date,
- 'communication': communication, # DO NOT FORWARD PORT TO V12 OR ABOVE
+ 'communication': self.communication, # DO NOT FORWARD PORT TO V12 OR ABOVE
'invoice_ids': [(6, 0, invoices.ids)],
'payment_type': payment_type,
'amount': abs(amount),
diff --git a/addons/crm/models/crm_lead.py b/addons/crm/models/crm_lead.py
index c86d132ed23..2241442527a 100644
--- a/addons/crm/models/crm_lead.py
+++ b/addons/crm/models/crm_lead.py
@@ -241,7 +241,7 @@ class Lead(models.Model):
return {}
if user_id and self._context.get('team_id'):
team = self.env['crm.team'].browse(self._context['team_id'])
- if user_id in team.member_ids.ids:
+ if user_id in team.member_ids.ids or user_id == team.user_id.id:
return {}
team_id = self.env['crm.team']._get_default_team_id(user_id=user_id)
return {'team_id': team_id}
diff --git a/addons/http_routing/models/ir_http.py b/addons/http_routing/models/ir_http.py
index c68eb681cca..2a579d8db6c 100644
--- a/addons/http_routing/models/ir_http.py
+++ b/addons/http_routing/models/ir_http.py
@@ -43,7 +43,7 @@ def _guess_mimetype(ext=False, default='text/html'):
return ext is not False and exts.get(ext, default) or exts
-def slugify_one(s, max_length=None):
+def slugify_one(s, max_length=0):
""" Transform a string to a slug that can be used in a url path.
This method will first try to do the job with python-slugify if present.
Otherwise it will process string by stripping leading and ending spaces,
@@ -61,13 +61,12 @@ def slugify_one(s, max_length=None):
except TypeError:
pass
uni = unicodedata.normalize('NFKD', s).encode('ascii', 'ignore').decode('ascii')
- slug_str = re.sub('[\W_]', ' ', uni).strip().lower()
- slug_str = re.sub('[-\s]+', '-', slug_str)
+ slug_str = re.sub(r'[\W_]', ' ', uni).strip().lower()
+ slug_str = re.sub(r'[-\s]+', '-', slug_str)
+ return slug_str[:max_length] if max_length > 0 else slug_str
- return slug_str[:max_length]
-
-def slugify(s, max_length=None, path=False):
+def slugify(s, max_length=0, path=False):
if not path:
return slugify_one(s, max_length=max_length)
else: