diff --git a/opportunity.py b/opportunity.py index 70a0ccfe0c..e76d3b358d 100644 --- a/opportunity.py +++ b/opportunity.py @@ -216,14 +216,7 @@ class SaleOpportunity(Workflow, ModelSQL, ModelView): @staticmethod def default_employee(): - User = Pool().get('res.user') - - if Transaction().context.get('employee'): - return Transaction().context['employee'] - else: - user = User(Transaction().user) - if user.employee: - return user.employee.id + return Transaction().context.get('employee') @classmethod def default_payment_term(cls): diff --git a/tests/scenario_sale_opportunity.rst b/tests/scenario_sale_opportunity.rst index c64db634b8..30f4e7e3e1 100644 --- a/tests/scenario_sale_opportunity.rst +++ b/tests/scenario_sale_opportunity.rst @@ -98,6 +98,7 @@ Create an lead:: >>> config.user = sale_opportunity_user.id >>> Opportunity = Model.get('sale.opportunity') >>> opportunity = Opportunity() + >>> opportunity.employee = employee >>> opportunity.description = 'Opportunity' >>> opportunity.save() >>> opportunity.state