Remove migration before 3.0

issue6470
review52421002
This commit is contained in:
Cédric Krier committed 2018-08-09 20:43:51 +02:00
1 parent ccc6ca8633
commit 6485829233
5 files changed
-135

No files matched your search

-18
View File
@@ -59,15 +59,6 @@ class TypeTemplate(
('credit-debit', 'Credit - Debit'),
], 'Display Balance', required=True)
@classmethod
def __register__(cls, module_name):
super(TypeTemplate, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
@staticmethod
def default_balance_sheet():
return False
@@ -182,15 +173,6 @@ class Type(sequence_ordered(), tree(separator='\\'), ModelSQL, ModelView):
depends=['template'])
del _states
@classmethod
def __register__(cls, module_name):
super(Type, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
@staticmethod
def default_balance_sheet():
return False
-20
View File
@@ -95,26 +95,6 @@ class Journal(
super(Journal, cls).__setup__()
cls._order.insert(0, ('name', 'ASC'))
@classmethod
def __register__(cls, module_name):
pool = Pool()
JournalSequence = pool.get('account.journal.sequence')
sql_table = cls.__table__()
journal_sequence = JournalSequence.__table__()
super(Journal, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 1.0 sequence Many2One change into MultiValue
if table.column_exist('sequence'):
query = journal_sequence.insert(
[journal_sequence.journal, journal_sequence.sequence],
sql_table.select(sql_table.id, sql_table.sequence))
cursor.execute(*query)
table.drop_column('sequence')
@classmethod
def multivalue_model(cls, field):
pool = Pool()
-22
View File
@@ -115,14 +115,6 @@ class Move(ModelSQL, ModelView):
FiscalYear = pool.get('account.fiscalyear')
fiscalyear = FiscalYear.__table__()
# Migration from 2.4:
# - name renamed into number
# - reference renamed into post_number
if table.column_exist('name'):
table.column_rename('name', 'number')
if table.column_exist('reference'):
table.column_rename('reference', 'post_number')
created_company = not table.column_exist('company')
super(Move, cls).__register__(module_name)
@@ -706,26 +698,12 @@ class Line(ModelSQL, ModelView):
@classmethod
def __register__(cls, module_name):
table = cls.__table_handler__(module_name)
# Migration from 2.4: reference renamed into description
if table.column_exist('reference'):
table.column_rename('reference', 'description')
super(Line, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Index for General Ledger
table.index_action(['move', 'account'], 'add')
# Migration from 1.2
table.not_null_action('blocked', action='remove')
# Migration from 2.4: remove name, active
table.not_null_action('name', action='remove')
table.not_null_action('active', action='remove')
table.index_action('active', action='remove')
@classmethod
def default_date(cls):
'''
-8
View File
@@ -49,14 +49,6 @@ class Period(Workflow, ModelSQL, ModelView):
'on_change_with_company', searcher='search_company')
icon = fields.Function(fields.Char("Icon"), 'get_icon')
@classmethod
def __register__(cls, module_name):
super(Period, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 2.6: post_move_sequence is no longer required
table.not_null_action('post_move_sequence', 'remove')
@classmethod
def __setup__(cls):
super(Period, cls).__setup__()
-67
View File
@@ -41,14 +41,6 @@ class TaxGroup(ModelSQL, ModelView):
code = fields.Char('Code', size=None, required=True)
kind = fields.Selection(KINDS, 'Kind', required=True)
@classmethod
def __register__(cls, module_name):
super(TaxGroup, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 1.4 drop code_uniq constraint
table.drop_constraint('code_uniq')
@staticmethod
def default_kind():
return 'both'
@@ -516,26 +508,6 @@ class TaxTemplate(sequence_ordered(), ModelSQL, ModelView):
'not be set on tax "%(template)s" which has a parent.'),
})
@classmethod
def __register__(cls, module_name):
super(TaxTemplate, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 1.0 group is no more required
table.not_null_action('group', action='remove')
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
# Migration from 2.8: rename percentage into rate
if table.column_exist('percentage'):
sql_table = cls.__table__()
cursor.execute(*sql_table.update(
columns=[sql_table.rate],
values=[sql_table.percentage / 100]))
table.drop_column('percentage')
@classmethod
def validate(cls, tax_templates):
super(TaxTemplate, cls).validate(tax_templates)
@@ -754,26 +726,6 @@ class Tax(sequence_ordered(), ModelSQL, ModelView, DeactivableMixin):
'not be set on tax "%(template)s" which has a parent.'),
})
@classmethod
def __register__(cls, module_name):
super(Tax, cls).__register__(module_name)
cursor = Transaction().connection.cursor()
table = cls.__table_handler__(module_name)
# Migration from 1.0 group is no more required
table.not_null_action('group', action='remove')
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
# Migration from 2.8: rename percentage into rate
if table.column_exist('percentage'):
sql_table = cls.__table__()
cursor.execute(*sql_table.update(
columns=[sql_table.rate],
values=[sql_table.percentage / 100]))
table.drop_column('percentage')
@classmethod
def validate(cls, taxes):
super(Tax, cls).validate(taxes)
@@ -1471,16 +1423,6 @@ class TaxRuleLineTemplate(sequence_ordered(), ModelSQL, ModelView):
super(TaxRuleLineTemplate, cls).__setup__()
cls._order.insert(1, ('rule', 'ASC'))
@classmethod
def __register__(cls, module_name):
super(TaxRuleLineTemplate, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
def _get_tax_rule_line_value(self, rule_line=None):
'''
Set values for tax rule line creation.
@@ -1592,15 +1534,6 @@ class TaxRuleLine(sequence_ordered(), ModelSQL, ModelView, MatchMixin):
super(TaxRuleLine, cls).__setup__()
cls._order.insert(1, ('rule', 'ASC'))
@classmethod
def __register__(cls, module_name):
super(TaxRuleLine, cls).__register__(module_name)
table = cls.__table_handler__(module_name)
# Migration from 2.4: drop required on sequence
table.not_null_action('sequence', action='remove')
@classmethod
def copy(cls, lines, default=None):
if default is None: