1
# -*- coding: utf-8 -*-
2
###############################################################################
4
# exception_rule for OpenERP
5
# Copyright (C) 2013 Akretion (http://www.akretion.com).
6
# @author Sébastien BEAU <sebastien.beau@akretion.com>
7
# Copyright Camptocamp SA
8
# @author: Guewen Baconnier
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU Affero General Public License as
12
# published by the Free Software Foundation, either version 3 of the
13
# License, or (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU Affero General Public License for more details.
20
# You should have received a copy of the GNU Affero General Public License
21
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
###############################################################################
26
from openerp.osv import fields, orm
29
class WizardExceptionConfirm(orm.TransientModel):
30
_name = 'wizard.exception.confirm'
33
#'sale_id': fields.many2one('sale.order', 'Sale'),
34
'exception_ids': fields.many2many('exception.rule', string='Exceptions to resolve', readonly=True),
35
'ignore': fields.boolean('Ignore Exceptions'),
38
def default_get(self, cr, uid, fields, context=None):
39
res = super(WizardExceptionConfirm, self).default_get(cr, uid, fields, context=context)
40
order_obj = self.pool.get('sale.order')
41
sale_id = context.get('active_id', False)
43
sale = order_obj.browse(cr, uid, sale_id, context=context)
44
exception_ids = [e.id for e in sale.exceptions_ids]
45
res.update({'exception_ids': [(6, 0, exception_ids)]})
48
def action_confirm(self, cr, uid, ids, context):
49
form = self.browse(cr, uid, ids[0], context=context)
51
self.pool.get(context['active_model']).write(cr, uid,
53
{'ignore_exceptions': True},
55
return {'type': 'ir.actions.act_window_close'}