Handle the case where name of account_move_line has the name field of the invoice
This commit is contained in:
@@ -101,8 +101,10 @@ class AccountInvoice(models.Model):
|
|||||||
for inv in self:
|
for inv in self:
|
||||||
if inv.type in ('out_invoice', 'out_refund'):
|
if inv.type in ('out_invoice', 'out_refund'):
|
||||||
self._cr.execute(
|
self._cr.execute(
|
||||||
"UPDATE account_move_line SET name=%s WHERE "
|
"UPDATE account_move_line SET name= "
|
||||||
"move_id=%s AND name='/'", (inv.number, inv.move_id.id))
|
"CASE WHEN name='/' THEN %s "
|
||||||
|
"ELSE %s||' - '||name END "
|
||||||
|
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
|
||||||
self.invalidate_cache()
|
self.invalidate_cache()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ def migrate(cr, version):
|
|||||||
# cf the inherit of action_number() of account.invoice
|
# cf the inherit of action_number() of account.invoice
|
||||||
# in account_usability/account.py
|
# in account_usability/account.py
|
||||||
cr.execute(
|
cr.execute(
|
||||||
"UPDATE account_move_line SET name=ref WHERE name='/' "
|
"UPDATE account_move_line SET name= "
|
||||||
"AND ref is not null AND journal_id in "
|
"CASE WHEN name='/' THEN ref ELSE ref||' - '||name END "
|
||||||
|
"WHERE ref is not null AND journal_id in "
|
||||||
"(SELECT id FROM account_journal WHERE type in ('sale', 'sale_refund'))")
|
"(SELECT id FROM account_journal WHERE type in ('sale', 'sale_refund'))")
|
||||||
|
|||||||
Reference in New Issue
Block a user