Create sale and related with sale opportunity

This commit is contained in:
resteve 2013-11-12 16:01:45 +01:00
parent 7acabb50e3
commit 2adad114ef
2 changed files with 10 additions and 1 deletions

View file

@ -3,7 +3,7 @@
# copyright notices and license terms.
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.pool import Pool, PoolMeta
__metaclass__ = PoolMeta
@ -15,6 +15,13 @@ class SaleOpportunity:
quotes = fields.One2Many('sale.sale', 'opportunity', 'Sales')
def create_sale(self):
Sale = Pool().get('sale.sale')
sale = super(SaleOpportunity, self).create_sale()
Sale.write([sale], {'opportunity': self.id})
return sale
class Sale:
__name__ = 'sale.sale'

View file

@ -2,3 +2,5 @@
# copyright notices and license terms.
from .test import suite
__all__ = ['suite']