Also avoid to have '/' on move line label of supplier invoices
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Account Usability',
|
'name': 'Account Usability',
|
||||||
'version': '0.2',
|
'version': '0.3',
|
||||||
'category': 'Accounting & Finance',
|
'category': 'Accounting & Finance',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'summary': 'Small usability enhancements in account module',
|
'summary': 'Small usability enhancements in account module',
|
||||||
|
|||||||
@@ -60,13 +60,12 @@ class AccountInvoice(models.Model):
|
|||||||
def action_number(self):
|
def action_number(self):
|
||||||
res = super(AccountInvoice, self).action_number()
|
res = super(AccountInvoice, self).action_number()
|
||||||
for inv in self:
|
for inv in self:
|
||||||
if inv.type in ('out_invoice', 'out_refund'):
|
self._cr.execute(
|
||||||
self._cr.execute(
|
"UPDATE account_move_line SET name= "
|
||||||
"UPDATE account_move_line SET name= "
|
"CASE WHEN name='/' THEN %s "
|
||||||
"CASE WHEN name='/' THEN %s "
|
"ELSE %s||' - '||name END "
|
||||||
"ELSE %s||' - '||name END "
|
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
|
||||||
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
|
self.invalidate_cache()
|
||||||
self.invalidate_cache()
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
account_usability/migrations/8.0.0.3/pre-migration.py
Normal file
16
account_usability/migrations/8.0.0.3/pre-migration.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
def migrate(cr, version):
|
||||||
|
if not version:
|
||||||
|
return
|
||||||
|
|
||||||
|
# cf the inherit of action_number() of account.invoice
|
||||||
|
# in account_usability/account.py
|
||||||
|
cr.execute(
|
||||||
|
"UPDATE account_move_line SET name=account_move.name "
|
||||||
|
"FROM account_move WHERE account_move_line.move_id = account_move.id "
|
||||||
|
"AND account_move_line.name='/' "
|
||||||
|
"AND account_move_line.journal_id in "
|
||||||
|
"(SELECT id FROM account_journal WHERE type in ('purchase', 'purchase_refund'))")
|
||||||
Reference in New Issue
Block a user