Handle the case where name of account_move_line has the name field of the invoice

This commit is contained in:
Alexis de Lattre
2016-09-14 18:25:01 +02:00
parent 6583ea0cd9
commit 40ef119999
2 changed files with 7 additions and 4 deletions

View File

@@ -101,8 +101,10 @@ class AccountInvoice(models.Model):
for inv in self:
if inv.type in ('out_invoice', 'out_refund'):
self._cr.execute(
"UPDATE account_move_line SET name=%s WHERE "
"move_id=%s AND name='/'", (inv.number, inv.move_id.id))
"UPDATE account_move_line SET name= "
"CASE WHEN name='/' THEN %s "
"ELSE %s||' - '||name END "
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
self.invalidate_cache()
return res