~vauxoo/addons-vauxoo/7.0-ifrs_agrinos-dev-hbto

501.26.2 by fernando_ld at vauxoo
[IMP]Analize function of action_cancel from mrp_production
1
# -*- coding: utf-8 -*-
2
###########################################################################
3
#    Module Writen to OpenERP, Open Source Management Solution
4
#
5
#    Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
6
#    All Rights Reserved.
7
#    info@vauxoo.com
8
############################################################################
9
#    Coded by: julio (fernando_ld@vauxoo.com)
10
############################################################################
11
#
12
#    This program is free software: you can redistribute it and/or modify
13
#    it under the terms of the GNU Affero General Public License as
14
#    published by the Free Software Foundation, either version 3 of the
15
#    License, or (at your option) any later version.
16
#
17
#    This program is distributed in the hope that it will be useful,
18
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
19
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
#    GNU Affero General Public License for more details.
21
#
22
#    You should have received a copy of the GNU Affero General Public License
23
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
#
25
##############################################################################
542.1.173 by Julio Serna
[V7-MIGRATION]
26
from openerp.osv import osv, fields
27
from openerp.tools.translate import _
28
501.26.2 by fernando_ld at vauxoo
[IMP]Analize function of action_cancel from mrp_production
29
from datetime import datetime
542.1.173 by Julio Serna
[V7-MIGRATION]
30
import openerp.netsvc as netsvc
31
32
33
class mrp_production(osv.Model):
501.26.2 by fernando_ld at vauxoo
[IMP]Analize function of action_cancel from mrp_production
34
    _inherit = "mrp.production"
542.1.172 by Julio Serna
[AUTOPEP8]
35
501.26.2 by fernando_ld at vauxoo
[IMP]Analize function of action_cancel from mrp_production
36
    def action_cancel(self, cr, uid, ids, context=None):
37
38
        if context is None:
39
            context = {}
542.1.172 by Julio Serna
[AUTOPEP8]
40
501.26.4 by fernando_ld at vauxoo
[IMP] Improved
41
        wf_service = netsvc.LocalService("workflow")
542.1.172 by Julio Serna
[AUTOPEP8]
42
501.26.2 by fernando_ld at vauxoo
[IMP]Analize function of action_cancel from mrp_production
43
        move_obj = self.pool.get('stock.move')
44
        for production in self.browse(cr, uid, ids, context=context):
501.26.4 by fernando_ld at vauxoo
[IMP] Improved
45
            for line in production.picking_ids:
542.1.172 by Julio Serna
[AUTOPEP8]
46
                wf_service.trg_validate(
47
                    uid, 'stock.picking', line.id, 'button_cancel', cr)
543.2.189 by Julio Serna
[AUTOPEP8]
48
        return super(mrp_production, self).action_cancel(cr, uid, ids,
49
                                                            context=context)