2
# -*- encoding: utf-8 -*-
3
###########################################################################
4
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
7
# Credits######################################################
8
# Coded by: Vauxoo C.A.
9
# Planified by: Nhomar Hernandez
10
# Audited by: Vauxoo C.A.
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 published by
14
# the Free Software Foundation, either version 3 of the License, or
15
# (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/>.
24
##########################################################################
27
from openerp.osv import osv, fields
28
import decimal_precision as dp
29
from openerp.tools.translate import _
31
import openerp.netsvc as netsvc
34
class account_invoice(osv.Model):
35
_inherit = 'account.invoice'
38
#~ def action_cancel_draft(self, cr, uid, ids, *args):
40
#~ wf_service = netsvc.LocalService("workflow")
41
#~ res = super(account_invoice, self).action_cancel_draft(cr, uid, ids, ())
42
#~ for i in self.browse(cr,uid,ids,context={}):
43
#~ if i.islr_wh_doc_id:
44
#~ wf_service.trg_validate(uid, 'islr.wh.doc',i.islr_wh_doc_id.id, 'act_draft', cr)
47
def action_number(self, cr, uid, ids, context=None):
49
Modified to witholding vat validate
51
wf_service = netsvc.LocalService("workflow")
52
res = super(account_invoice, self).action_number(cr, uid, ids)
53
iva_line_obj = self.pool.get('account.wh.iva.line')
54
iva_obj = self.pool.get('account.wh.iva')
55
invo_brw = self.browse(cr, uid, ids, context=context)[0]
56
state = [('draft', 'act_draft'), ('progress', 'act_progress'), (
57
'confirmed', 'act_confirmed'), ('done', 'act_done')]
58
if invo_brw.cancel_true:
59
if invo_brw.islr_wh_doc_id:
62
if invo_brw.islr_wh_doc_id.prev_state == 'cancel':
65
wf_service.trg_validate(
66
uid, 'islr.wh.doc', invo_brw.islr_wh_doc_id.id, i[1],
69
if i[0] == invo_brw.islr_wh_doc_id.prev_state:
74
def invoice_cancel(self, cr, uid, ids, context=None):
78
islr_obj = self.pool.get('islr.wh.doc')
79
context.update({'islr': True})
80
invo_brw = self.browse(cr, uid, ids, context=context)[0]
81
if invo_brw.islr_wh_doc_id:
82
islr_obj.write(cr, uid, [invo_brw.islr_wh_doc_id.id], {
83
'prev_state': invo_brw.islr_wh_doc_id.state},
85
res = super(account_invoice, self).invoice_cancel(
86
cr, uid, ids, context=context)
90
def check_islr(self, cr, uid, ids, context=None):
93
invo_brw = self.browse(cr, uid, ids[0], context=context)
94
if invo_brw.islr_wh_doc_id: