Skip to content

Commit

Permalink
allow to cancel a draft SO
Browse files Browse the repository at this point in the history
  • Loading branch information
gurneyalex committed Mar 17, 2017
1 parent 3b9cd56 commit 4236cb3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions odoo/local-src/specific_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ def _check_validators(self):

def write(self, vals):
# from ' draft you can switch only to 'final_quote'
target_state = vals.get('state', 'final_quote')
if (self.state == 'draft' and
vals.get('state', 'final_quote') != 'final_quote'):
target_state not in ('cancel', 'final_quote')):
raise UserError(
'A Draft Sale Order can only step to "final_quote" ')
if vals.get('state', 'draft') != 'draft':
_('A Draft Sale Order can only step to '
'"final_quote" or "cancel"'))
if vals.get('state', 'draft') not in ('cancel', 'draft'):
self._check_ghost()
self._check_sales_condition()
self._check_validators()
Expand Down

0 comments on commit 4236cb3

Please sign in to comment.