Simplify default employee

issue4793
review33351002
This commit is contained in:
Xavier Codinas
2016-09-22 12:25:16 +02:00
parent 6e0a8f188e
commit b2e4d2b754
2 changed files with 2 additions and 8 deletions
+1 -8
View File
@@ -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):
+1
View File
@@ -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