diff --git a/product_cost_price_migration.diff b/product_cost_price_migration.diff new file mode 100644 index 0000000..e26525c --- /dev/null +++ b/product_cost_price_migration.diff @@ -0,0 +1,13 @@ +diff --git a/tryton/modules/product/product.py b/tryton/modules/product/product.py +index e46f608dcb..13d04d0212 100644 +--- a/tryton/modules/product/product.py ++++ b/tryton/modules/product/product.py +@@ -806,7 +806,7 @@ class ProductCostPrice(ModelSQL, CompanyValueMixin): + # Migration from 4.4: replace template by product + if table.column_exist('template'): + columns = ['create_uid', 'create_date', +- 'write_uid', 'write_date', 'cost_price'] ++ 'write_uid', 'write_date', 'cost_price', 'company'] + cursor.execute(*sql_table.insert( + columns=[Column(sql_table, c) for c in columns] + + [sql_table.product], diff --git a/sequence_exist.diff b/sequence_exist.diff new file mode 100644 index 0000000..38d443d --- /dev/null +++ b/sequence_exist.diff @@ -0,0 +1,24 @@ +diff --git a/tryton/trytond/trytond/backend/postgresql/database.py b/tryton/trytond/trytond/backend/postgresql/database.py +index 3c891d48f3..e5ef92947c 100644 +--- a/tryton/trytond/trytond/backend/postgresql/database.py ++++ b/tryton/trytond/trytond/backend/postgresql/database.py +@@ -676,13 +676,12 @@ class Database(DatabaseInterface): + + def sequence_exist(self, connection, name): + cursor = connection.cursor() +- for schema in self.search_path: +- cursor.execute('SELECT 1 ' +- 'FROM information_schema.sequences ' +- 'WHERE sequence_name = %s AND sequence_schema = %s', +- (name, schema)) +- if cursor.rowcount: +- return True ++ cursor.execute('SELECT 1 ' ++ 'FROM pg_sequences ' ++ 'WHERE sequencename = %s', ++ (name,)) ++ if cursor.rowcount: ++ return True + return False + + def sequence_create( diff --git a/series b/series index 7eafa16..6aa5a5d 100644 --- a/series +++ b/series @@ -53,3 +53,9 @@ issue12480.diff # [trytond] Support GIN index with btree_gin PostgreSQL extensio merge_request779.diff # [account_payment] Warn when submitting, approving or proceeding payment with reconciled line issue12576.diff # [account_stock_eu] Could not find the intrastat countries for moves + +product_cost_price_migration.diff # [product] Add missing column in product_cost_price + +table_rename.diff # [trytond] Add missing sequence rename in table_rename function + +sequence_exist.diff # [trytond] Search sequences using pg_sequences instead of information_schema.sequences diff --git a/table_rename.diff b/table_rename.diff new file mode 100644 index 0000000..7ffe3b9 --- /dev/null +++ b/table_rename.diff @@ -0,0 +1,16 @@ +diff --git a/tryton/trytond/trytond/backend/postgresql/table.py b/tryton/trytond/trytond/backend/postgresql/table.py +index e874ee61c0..769f07ccd5 100644 +--- a/tryton/trytond/trytond/backend/postgresql/table.py ++++ b/tryton/trytond/trytond/backend/postgresql/table.py +@@ -132,6 +132,11 @@ class TableHandler(TableHandlerInterface): + and not cls.table_exist(new_name)): + cursor.execute(SQL('ALTER TABLE {} RENAME TO {}').format( + Identifier(old_name), Identifier(new_name))) ++ # Migrate from 6.6: rename old sequence ++ old_sequence = old_name + '_id_seq' ++ new_sequence = new_name + '_id_seq' ++ transaction.database.sequence_rename( ++ transaction.connection, old_sequence, new_sequence) + # Rename history table + old_history = old_name + "__history" + new_history = new_name + "__history"