From 77971798819b0e2aa53fdc38abdbcdd82eac08c0 Mon Sep 17 00:00:00 2001 From: Udo Spallek Date: Fri, 3 Jun 2016 21:31:58 +0200 Subject: [PATCH] Rename long model name for payment term delta issue5445 review16161002 --- CHANGELOG | 2 ++ payment_term.py | 12 ++++++++++-- payment_term.xml | 10 +++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6d313f4073..cfc54e8070 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Rename account.invoice.payment_term.line.relativedelta + into account.invoice.payment_term.line.delta * Make payment term not required Version 4.0.0 - 2016-05-02 diff --git a/payment_term.py b/payment_term.py index 25fafc6e6d..50f5a415d1 100644 --- a/payment_term.py +++ b/payment_term.py @@ -12,6 +12,7 @@ from trytond.pyson import Eval from trytond.transaction import Transaction from trytond.pool import Pool from trytond.wizard import Wizard, StateView, Button +from trytond.config import config __all__ = ['PaymentTerm', 'PaymentTermLine', 'PaymentTermLineRelativeDelta', 'TestPaymentTerm', 'TestPaymentTermView', 'TestPaymentTermViewResult'] @@ -133,7 +134,7 @@ class PaymentTermLine(ModelSQL, ModelView): currency_digits = fields.Function(fields.Integer('Currency Digits'), 'on_change_with_currency_digits') relativedeltas = fields.One2Many( - 'account.invoice.payment_term.line.relativedelta', 'line', 'Deltas') + 'account.invoice.payment_term.line.delta', 'line', 'Deltas') @classmethod def __setup__(cls): @@ -291,7 +292,7 @@ class PaymentTermLine(ModelSQL, ModelView): class PaymentTermLineRelativeDelta(ModelSQL, ModelView): 'Payment Term Line Relative Delta' - __name__ = 'account.invoice.payment_term.line.relativedelta' + __name__ = 'account.invoice.payment_term.line.delta' sequence = fields.Integer('Sequence') line = fields.Many2One('account.invoice.payment_term.line', 'Payment Term Line', required=True, ondelete='CASCADE') @@ -343,6 +344,13 @@ class PaymentTermLineRelativeDelta(ModelSQL, ModelView): sql_table = cls.__table__() line = Line.__table__() + # Migration from 4.0: rename long table + old_model_name = 'account.invoice.payment_term.line.relativedelta' + old_table = config.get( + 'table', old_model_name, default=old_model_name.replace('.', '_')) + if TableHandler.table_exist(old_table): + TableHandler.table_rename(old_table, cls._table) + super(PaymentTermLineRelativeDelta, cls).__register__(module_name) line_table = TableHandler(Line, module_name) diff --git a/payment_term.xml b/payment_term.xml index 948ac76e92..7fcc5e00f8 100644 --- a/payment_term.xml +++ b/payment_term.xml @@ -87,28 +87,28 @@ this repository contains the full copyright notices and license terms. --> - account.invoice.payment_term.line.relativedelta + account.invoice.payment_term.line.delta tree payment_term_line_relativedelta_list - account.invoice.payment_term.line.relativedelta + account.invoice.payment_term.line.delta tree payment_term_line_relativedelta_list_sequence - account.invoice.payment_term.line.relativedelta + account.invoice.payment_term.line.delta form payment_term_line_relativedelta_form + search="[('model', '=', 'account.invoice.payment_term.line.delta')]"/> @@ -117,7 +117,7 @@ this repository contains the full copyright notices and license terms. --> + search="[('model', '=', 'account.invoice.payment_term.line.delta')]"/>