From 35a1c2809f3e64a1263a638f4534507a9efc289b Mon Sep 17 00:00:00 2001 From: resteve Date: Thu, 28 Apr 2016 14:45:15 +0200 Subject: [PATCH] Since 3.6 create_sale return object --- opportunity.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/opportunity.py b/opportunity.py index d6f7986..143ca28 100644 --- a/opportunity.py +++ b/opportunity.py @@ -1,29 +1,26 @@ #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 -from trytond.pool import Pool, PoolMeta - -__metaclass__ = PoolMeta +from trytond.pool import PoolMeta __all__ = ['SaleOpportunity', 'Sale'] class SaleOpportunity: + __metaclass__ = PoolMeta __name__ = 'sale.opportunity' 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}) + sale.opportunity = self return sale class Sale: + __metaclass__ = PoolMeta __name__ = 'sale.sale' opportunity = fields.Many2One('sale.opportunity', 'Opportunity')