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. --> - - - + +