[FIX] point_of_sale: add rank to customer on sale

It is a partial revert of the commit: https://github.com/odoo/odoo/commit/36c05f5e056794d68c363343e267c592bd9bce31
because the behavior has been fixed in stable in commit https://github.com/odoo/odoo/commit/577dac5baee5e503baba9f30dff67e69daafa00b
almost at the same time.

So no need of double increade the ranking of a sale in the POS.

closes odoo/odoo#42397

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Pierre Masereel
2019-12-26 13:32:38 +00:00
parent 78a64fed28
commit 193040ada2
-14
View File
@@ -367,20 +367,6 @@ class PosOrder(models.Model):
self.write({'state': 'paid'})
if self.partner_id:
try:
with self.env.cr.savepoint():
self.env.cr.execute("SELECT 'customer_rank' FROM res_partner WHERE ID=%s FOR UPDATE NOWAIT",
(self.partner_id.id,))
self.env.cr.execute("UPDATE res_partner SET customer_rank = customer_rank +1 WHERE ID=%s",
(self.partner_id.id,))
self.env.cache.remove(self.partner_id, self.partner_id._fields['customer_rank'])
except psycopg2.DatabaseError as e:
if e.pgcode == '55P03':
_logger.debug('Another transaction already locked partner rows. Cannot update partner ranks.')
else:
raise e
return True
def action_pos_order_invoice(self):