1
# -*- encoding: utf-8 -*-
2
###########################################################################
3
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
8
############################################################################
9
# Coded by: julio (julio@vauxoo.com)
10
############################################################################
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.
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.
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/>.
25
##############################################################################
26
from osv import osv,fields
27
import decimal_precision as dp
29
class mrp_production(osv.osv):
30
_inherit='mrp.production'
32
def _create_account_variation_move_line(self, cr, uid, prod_variation, src_account_id, dest_account_id, reference_amount, context=None):
33
res = super(mrp_production, self)._create_account_variation_move_line(cr, uid, prod_variation, src_account_id, dest_account_id, reference_amount, context=context)
35
lin[2]['production_id'] = prod_variation.production_id and prod_variation.production_id.id or False
38
def action_cancel(self, cr, uid, ids, context=None):
39
account_move_line = self.pool.get('account.move.line')
40
account_move = self.pool.get('account.move')
45
move_obj = self.pool.get('stock.move')
47
for production in self.browse(cr, uid, ids, context=context):
48
account_move_line_id = account_move_line.search(cr,uid,[('production_id','=',production.id)])
49
for move_line in account_move_line.browse(cr, uid, account_move_line_id, context=context):
50
result.setdefault(move_line.move_id.id, production.id)
51
for lin in result.items():
53
account_move.button_cancel(cr, uid, [lin[0]], context=context)
56
account_move.unlink(cr, uid, [lin[0]])
57
return super(mrp_production, self).action_cancel(cr, uid, ids, context=context)
b'\\ No newline at end of file'