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) - - return slug_str[:max_length] + 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 -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: