From 1b80bfd95b96eb56a754a08043039896bf156c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 4 Feb 2009 13:31:03 +0100 Subject: [PATCH] Use new TableHandler --- purchase.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/purchase.py b/purchase.py index e0befa8b2c..9edbc969f3 100644 --- a/purchase.py +++ b/purchase.py @@ -3,12 +3,12 @@ "Purchase" from trytond.osv import fields, OSV -from decimal import Decimal -import datetime from trytond.netsvc import LocalService from trytond.report import CompanyReport from trytond.wizard import Wizard, WizardOSV -from trytond.sql_db import table_handler +from trytond.backend import TableHandler +from decimal import Decimal +import datetime _STATES = { 'readonly': "state != 'draft'", @@ -834,14 +834,13 @@ class PurchaseLine(OSV): def init(self, cursor, module_name): super(PurchaseLine, self).init(cursor, module_name) - table = table_handler(cursor, self._table, self._name, module_name) + table = TableHandler(cursor, self._table, self._name, module_name) # Migration from 1.0 comment change into note - if 'comment' in table.table: + if table.column_exist('comment'): cursor.execute('UPDATE "' + self._table + '" ' \ 'SET note = comment') - cursor.execute('ALTER TABLE "' + self._table + '" ' \ - 'DROP COLUMN comment') + table.drop_column('comment', exception=True) def default_type(self, cursor, user, context=None): return 'line'