2009-01-02 17:54:34 +01:00
|
|
|
#This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
#this repository contains the full copyright notices and license terms.
|
2009-02-28 16:57:26 +01:00
|
|
|
from trytond.model import ModelView, ModelSQL, fields
|
2012-09-24 22:17:32 +02:00
|
|
|
from trytond.pool import Pool, PoolMeta
|
|
|
|
|
|
|
|
|
|
__all__ = ['Address', 'Party']
|
|
|
|
|
__metaclass__ = PoolMeta
|
2009-01-02 17:54:34 +01:00
|
|
|
|
|
|
|
|
|
2012-09-24 22:17:32 +02:00
|
|
|
class Address:
|
|
|
|
|
__name__ = 'party.address'
|
2009-01-02 17:54:34 +01:00
|
|
|
invoice = fields.Boolean('Invoice')
|
|
|
|
|
|
|
|
|
|
|
2009-02-28 16:57:26 +01:00
|
|
|
class Party(ModelSQL, ModelView):
|
2012-09-24 22:17:32 +02:00
|
|
|
__name__ = 'party.party'
|
2012-03-03 19:08:55 +01:00
|
|
|
customer_payment_term = fields.Property(fields.Many2One(
|
|
|
|
|
'account.invoice.payment_term', string='Customer Payment Term'))
|
2010-03-11 16:45:42 +01:00
|
|
|
supplier_payment_term = fields.Property(fields.Many2One(
|
|
|
|
|
'account.invoice.payment_term', string='Supplier Payment Term'))
|
2009-01-02 17:54:34 +01:00
|
|
|
|
2012-09-24 22:17:32 +02:00
|
|
|
@classmethod
|
|
|
|
|
def __register__(cls, module_name):
|
|
|
|
|
ModelField = Pool().get('ir.model.field')
|
2012-03-03 19:08:55 +01:00
|
|
|
|
|
|
|
|
# Migration from 2.2: property field payment_term renamed
|
|
|
|
|
# to customer_payment_term
|
2012-09-24 22:17:32 +02:00
|
|
|
fields = ModelField.search([
|
2012-04-01 18:22:06 +02:00
|
|
|
('name', '=', 'payment_term'),
|
|
|
|
|
('model.model', '=', 'party.party')
|
2012-03-03 19:08:55 +01:00
|
|
|
])
|
2012-09-24 22:17:32 +02:00
|
|
|
if fields:
|
|
|
|
|
ModelField.write(fields, {
|
2012-03-03 19:08:55 +01:00
|
|
|
'name': 'customer_payment_term',
|
|
|
|
|
})
|
|
|
|
|
|
2012-09-24 22:17:32 +02:00
|
|
|
super(Party, cls).__register__(module_name)
|