Simplify default employee
issue4793 review33351002
This commit is contained in:
+1
-8
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user