Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pool = Pool()
- PackageType = pool.get('stock.package.type')
- cursor = Transaction().connection.cursor()
- sql_table = cls.__table__()
- package_type = PackageType.__table__()
- table = cls.__table_handler__(module_name)
- dimension_columns = ['length', 'length_uom', 'height', 'height_uom',
- 'width', 'width_uom']
- dimension_exists = any(
- table.column_exist('length') for c in dimension_columns)
- super().__register__(module_name)
- # Migration from 5.8: Update dimensions on package from package_type
- if not dimension_exists:
- cursor.execute(*sql_table.update(
- columns=[Column(sql_table, c) for c in dimension_columns],
- values=package_type.select(
- *[Column(package_type, c) for c in dimension_columns],
- where=package_type.id == sql_table.type)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement