Skip to content

Commit

Permalink
[FIX] Set key to False because context isn't reinitialized
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienpeiffer committed May 18, 2015
1 parent 06dfa82 commit 8c29554
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions account_cash_discount_payment/wizard/account_payment_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ def _prepare_payment_line(self, payment, line):
@api.model
def extend_payment_order_domain(self, payment_order, domain):
# TODO : Improvement to remove partial domain (while loop)
context = self.env.context
super(PaymentOrderCreate, self)\
.extend_payment_order_domain(payment_order, domain)
if self.env.context.get('cash_discount_date', False) and \
self.env.context.get('due_date', False):
due_date = self.env.context.get('due_date', False)
if context.get('cash_discount_date', False) and \
context.get('due_date', False):
due_date = context.get('due_date', False)
pos = 0
while pos < len(domain):
if pos < len(domain)-2 and domain[pos] == '|' and \
Expand All @@ -75,5 +76,7 @@ def search_entries(self):
if self.cash_discount_date:
ctx.update({'cash_discount_date': True,
'due_date': self.duedate})
self.env.context = ctx
return super(PaymentOrderCreate, self).search_entries()
else:
ctx.update({'cash_discount_date': False})
return super(PaymentOrderCreate, self.with_context(ctx))\
.search_entries()

0 comments on commit 8c29554

Please sign in to comment.