1
# -*- encoding: utf-8 -*-
2
###########################################################################
3
# Module Writen to OpenERP, Open Source Management Solution
5
# Copyright (c) 2011 Vauxoo - http://www.vauxoo.com
7
# info Vauxoo (info@vauxoo.com)
8
############################################################################
9
# Coded by: moylop260 (moylop260@vauxoo.com)
10
# Coded by: isaac (isaac@vauxoo.com)
11
# Financed by: http://www.sfsoluciones.com (aef@sfsoluciones.com)
12
############################################################################
14
# This program is free software: you can redistribute it and/or modify
15
# it under the terms of the GNU Affero General Public License as
16
# published by the Free Software Foundation, either version 3 of the
17
# License, or (at your option) any later version.
19
# This program is distributed in the hope that it will be useful,
20
# but WITHOUT ANY WARRANTY; without even the implied warranty of
21
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
# GNU Affero General Public License for more details.
24
# You should have received a copy of the GNU Affero General Public License
25
# along with this program. If not, see <http://www.gnu.org/licenses/>.
27
##############################################################################
29
from openerp.osv import fields, osv
30
from openerp.tools.translate import _
31
from openerp import pooler, tools, netsvc
32
from openerp.tools.misc import ustr
42
import xml.dom.minidom
43
from datetime import datetime, timedelta
47
class wizard_export_invoice_pac_sf_v6(osv.TransientModel):
48
_name = 'wizard.export.invoice.pac.sf.v6'
50
def _get_invoice_id(self, cr, uid, data, context={}):
52
@params data : Dictionary with information of the user, and active ids
55
invoice_obj = self.pool.get('account.invoice')
56
res = invoice_obj._get_file(cr, uid, data['active_ids'])
57
file_xml = res['file']
60
def upload_to_pac(self, cr, uid, ids, context={}):
62
factura_attachment_pool = self.pool.get('ir.attachment.facturae.mx')
63
factura_attachment_ids = factura_attachment_pool.search(cr, uid, [('invoice_id', 'in', context['active_ids'])],
65
res = factura_attachment_pool._upload_ws_file(cr, uid, factura_attachment_ids)
66
self.write(cr, uid, ids, {'message': res['msg']}, context=None)
68
'type': 'ir.actions.act_window',
69
'name': 'Export invoice V6',
72
'res_model': 'wizard.export.invoice.pac.sf.v6',
76
'views': [(False, 'form')],
80
'file': fields.binary('File', readonly=True,
81
help='Shows the file returned'),
82
'message': fields.text('text', readonly=True, help='Shows the message \
83
that returned after of upload the xml to sign'),
87
'message': 'Choose the button Upload Invoice for export to PAC',
88
'file': _get_invoice_id,