Rename comment into note because there is now a comment type

This commit is contained in:
Cédric Krier
2009-01-16 19:06:34 +01:00
parent f842192ef8
commit 02854d4e67
2 changed files with 16 additions and 7 deletions
+13 -4
View File
@@ -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'
+3 -3
View File
@@ -612,9 +612,9 @@ this repository contains the full copyright notices and license terms. -->
<separator name="taxes" colspan="4"/>
<field name="taxes" colspan="4"/>
</page>
<page string="Comment" id="comment">
<separator name="comment" colspan="4"/>
<field name="comment" colspan="4"
<page string="Notes" id="notes">
<separator name="note" colspan="4"/>
<field name="note" colspan="4"
spell="_parent_purchase.party_lang"/>
</page>
</notebook>