trytond-sale_opportunity_qu.../opportunity.py

27 lines
717 B
Python
Raw Permalink Normal View History

2013-07-25 17:08:55 +02:00
#This file is part of sale_opportunity_quote module for Tryton.
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
from trytond.model import fields
2016-04-28 14:45:15 +02:00
from trytond.pool import PoolMeta
2013-07-25 17:08:55 +02:00
__all__ = ['SaleOpportunity', 'Sale']
class SaleOpportunity:
2016-03-29 12:00:39 +02:00
__metaclass__ = PoolMeta
2013-07-25 17:08:55 +02:00
__name__ = 'sale.opportunity'
quotes = fields.One2Many('sale.sale', 'opportunity', 'Sales')
def create_sale(self):
sale = super(SaleOpportunity, self).create_sale()
2016-04-28 14:45:15 +02:00
sale.opportunity = self
return sale
2013-07-25 17:08:55 +02:00
class Sale:
2016-03-29 12:00:39 +02:00
__metaclass__ = PoolMeta
2013-07-25 17:08:55 +02:00
__name__ = 'sale.sale'
opportunity = fields.Many2One('sale.opportunity', 'Opportunity')