From 02854d4e672ff1e6444c3720e2c5b58313aecd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 16 Jan 2009 19:06:34 +0100 Subject: [PATCH] Rename comment into note because there is now a comment type --- purchase.py | 17 +++++++++++++---- purchase.xml | 6 +++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/purchase.py b/purchase.py index 641be87fd6..6f432b89f4 100644 --- a/purchase.py +++ b/purchase.py @@ -8,6 +8,7 @@ import datetime from trytond.netsvc import LocalService from trytond.report import CompanyReport from trytond.wizard import Wizard +from trytond.sql_db import table_handler _STATES = { 'readonly': "state != 'draft'", @@ -801,10 +802,7 @@ class PurchaseLine(OSV): }, on_change_with=['type', 'quantity', 'unit_price', '_parent_purchase.currency']) description = fields.Text('Description', size=None, required=True) - comment = fields.Text('Comment', - states={ - 'invisible': "type != 'line'", - }) + note = fields.Text('Note') taxes = fields.Many2Many('account.tax', 'purchase_line_account_tax', 'line', 'tax', 'Taxes', domain=[('parent', '=', False)], states={ @@ -831,6 +829,17 @@ class PurchaseLine(OSV): 'an "account_expense" default property!', }) + def _auto_init(self, cursor, module_name): + super(PurchaseLine, self)._auto_init(cursor, module_name) + table = table_handler(cursor, self._table, self._name, module_name) + + # Migration from 1.0 comment change into note + if 'comment' in table.table: + cursor.execute('UPDATE "' + self._table + '" ' \ + 'SET note = comment') + cursor.execute('ALTER TABLE "' + self._table + '" ' \ + 'DROP COLUMN comment') + def default_type(self, cursor, user, context=None): return 'line' diff --git a/purchase.xml b/purchase.xml index 4b9dab0615..ac346c2337 100644 --- a/purchase.xml +++ b/purchase.xml @@ -612,9 +612,9 @@ this repository contains the full copyright notices and license terms. --> - - - + +