Merge lp:~vauxoo/openerp-venezuela-localization/israel_l10n-ve-invoice-nro-ctrl-migration into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Israel Fermin Montilla
Status: Merged
Merged at revision: 390
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/israel_l10n-ve-invoice-nro-ctrl-migration
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 405 lines (+350/-1)
9 files modified
l10n_ve_fiscal_requirements/invoice.py (+1/-1)
l10n_ve_invoice_nro_ctrl/__init__.py (+28/-0)
l10n_ve_invoice_nro_ctrl/__openerp__.py (+45/-0)
l10n_ve_invoice_nro_ctrl/model/__init__.py (+28/-0)
l10n_ve_invoice_nro_ctrl/model/res_company.py (+41/-0)
l10n_ve_invoice_nro_ctrl/view/res_company_view.xml (+20/-0)
l10n_ve_invoice_nro_ctrl/wizard/__init__.py (+27/-0)
l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl.py (+118/-0)
l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl_view.xml (+42/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/israel_l10n-ve-invoice-nro-ctrl-migration
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Pending
Review via email: mp+77720@code.launchpad.net

Description of the change

Module migrated to version 6 and integrated with the localization.

Currently moving the functionality to the l10n_ve_fiscal_requirement module as requested

Documentation status: pending

To post a comment you must log in.
400. By Israel Fermin Montilla

[IMP] changed requested label

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_requirements/invoice.py'
2--- l10n_ve_fiscal_requirements/invoice.py 2011-05-11 16:42:07 +0000
3+++ l10n_ve_fiscal_requirements/invoice.py 2011-09-30 15:43:37 +0000
4@@ -25,7 +25,7 @@
5 class account_invoice(osv.osv):
6 _inherit = 'account.invoice'
7 _columns = {
8- 'nro_ctrl': fields.char('Invoice ref.', size=32, readonly=True, states={'draft':[('readonly',False)]}, help="Invoice reference"),
9+ 'nro_ctrl': fields.char('Control Number', size=32, readonly=True, states={'draft':[('readonly',False)]}, help="Invoice reference"),
10 'sin_cred': fields.boolean('Tax-exempt?', readonly=False, help="setting to true if the invoice is exempt from V.A.T"),
11 }
12
13
14=== added directory 'l10n_ve_invoice_nro_ctrl'
15=== added file 'l10n_ve_invoice_nro_ctrl/__init__.py'
16--- l10n_ve_invoice_nro_ctrl/__init__.py 1970-01-01 00:00:00 +0000
17+++ l10n_ve_invoice_nro_ctrl/__init__.py 2011-09-30 15:43:37 +0000
18@@ -0,0 +1,28 @@
19+#!/usr/bin/python
20+# -*- encoding: utf-8 -*-
21+###########################################################################
22+# Module Writen to OpenERP, Open Source Management Solution
23+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
24+# All Rights Reserved
25+###############Credits######################################################
26+# Coded by: Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
27+# Planified by: Nhomar Hernandez
28+# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
29+# Audited by: Humberto Arocha humberto@openerp.com.ve
30+#############################################################################
31+# This program is free software: you can redistribute it and/or modify
32+# it under the terms of the GNU General Public License as published by
33+# the Free Software Foundation, either version 3 of the License, or
34+# (at your option) any later version.
35+#
36+# This program is distributed in the hope that it will be useful,
37+# but WITHOUT ANY WARRANTY; without even the implied warranty of
38+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39+# GNU General Public License for more details.
40+#
41+# You should have received a copy of the GNU General Public License
42+# along with this program. If not, see <http://www.gnu.org/licenses/>.
43+##############################################################################
44+
45+import wizard
46+import model
47
48=== added file 'l10n_ve_invoice_nro_ctrl/__openerp__.py'
49--- l10n_ve_invoice_nro_ctrl/__openerp__.py 1970-01-01 00:00:00 +0000
50+++ l10n_ve_invoice_nro_ctrl/__openerp__.py 2011-09-30 15:43:37 +0000
51@@ -0,0 +1,45 @@
52+#!/usr/bin/python
53+# -*- encoding: utf-8 -*-
54+###########################################################################
55+# Module Writen to OpenERP, Open Source Management Solution
56+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
57+# All Rights Reserved
58+###############Credits######################################################
59+# Coded by: Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
60+# Planified by: Nhomar Hernandez
61+# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
62+# Audited by: Humberto Arocha humberto@openerp.com.ve
63+#############################################################################
64+# This program is free software: you can redistribute it and/or modify
65+# it under the terms of the GNU General Public License as published by
66+# the Free Software Foundation, either version 3 of the License, or
67+# (at your option) any later version.
68+#
69+# This program is distributed in the hope that it will be useful,
70+# but WITHOUT ANY WARRANTY; without even the implied warranty of
71+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
72+# GNU General Public License for more details.
73+#
74+# You should have received a copy of the GNU General Public License
75+# along with this program. If not, see <http://www.gnu.org/licenses/>.
76+##############################################################################
77+
78+{
79+ "name" : "Generate Invoice Damaged",
80+ "version" : "0.1",
81+ "author" : "Openerp Venezuela",
82+ "category" : "Generic Modules/Others",
83+ "website": "http://wiki.openerp.org.ve/",
84+ "description": '''
85+ Generate Invoice from customer invoice form,
86+ for justify invoice(paper) damaged.
87+ ''',
88+ "depends" : ["account", "l10n_ve_islr_withholding"],
89+ "init_xml" : [],
90+ "update_xml" : [
91+ "wizard/wizard_invoice_nro_ctrl_view.xml",
92+ "view/res_company_view.xml",
93+ ],
94+ "active": False,
95+ "installable": True
96+}
97
98=== added directory 'l10n_ve_invoice_nro_ctrl/model'
99=== added file 'l10n_ve_invoice_nro_ctrl/model/__init__.py'
100--- l10n_ve_invoice_nro_ctrl/model/__init__.py 1970-01-01 00:00:00 +0000
101+++ l10n_ve_invoice_nro_ctrl/model/__init__.py 2011-09-30 15:43:37 +0000
102@@ -0,0 +1,28 @@
103+# -*- encoding: utf-8 -*-
104+##############################################################################
105+# Copyright (c) 2011 OpenERP Venezuela (http://openerp.com.ve)
106+# All Rights Reserved.
107+# Programmed by: Israel Fermín Montilla <israel@openerp.com.ve>
108+#
109+# WARNING: This program as such is intended to be used by professional
110+# programmers who take the whole responsability of assessing all potential
111+# consequences resulting from its eventual inadequacies and bugs
112+# End users who are looking for a ready-to-use solution with commercial
113+# garantees and support are strongly adviced to contract a Free Software
114+# Service Company
115+#
116+# This program is Free Software; you can redistribute it and/or
117+# modify it under the terms of the GNU General Public License
118+# as published by the Free Software Foundation; either version 2
119+# of the License, or (at your option) any later version.
120+#
121+# This program is distributed in the hope that it will be useful,
122+# but WITHOUT ANY WARRANTY; without even the implied warranty of
123+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
124+# GNU General Public License for more details.
125+#
126+# You should have received a copy of the GNU General Public License
127+# along with this program; if not, write to the Free Software
128+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
129+###############################################################################
130+import res_company
131
132=== added file 'l10n_ve_invoice_nro_ctrl/model/res_company.py'
133--- l10n_ve_invoice_nro_ctrl/model/res_company.py 1970-01-01 00:00:00 +0000
134+++ l10n_ve_invoice_nro_ctrl/model/res_company.py 2011-09-30 15:43:37 +0000
135@@ -0,0 +1,41 @@
136+#!/usr/bin/python
137+# -*- encoding: utf-8 -*-
138+###########################################################################
139+# Module Writen to OpenERP, Open Source Management Solution
140+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
141+# All Rights Reserved
142+###############Credits######################################################
143+# Coded by: Humberto Arocha <humberto@vauxoo.com>
144+# María Gabriela Quilarque <gabriela@vauxoo.com>
145+# Nhomar Hernandez <nhomar@vauxoo.com>
146+# Planified by: Humberto Arocha
147+# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
148+# Audited by: Humberto Arocha humberto@openerp.com.ve
149+#############################################################################
150+# This program is free software: you can redistribute it and/or modify
151+# it under the terms of the GNU General Public License as published by
152+# the Free Software Foundation, either version 3 of the License, or
153+# (at your option) any later version.
154+#
155+# This program is distributed in the hope that it will be useful,
156+# but WITHOUT ANY WARRANTY; without even the implied warranty of
157+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
158+# GNU General Public License for more details.
159+#
160+# You should have received a copy of the GNU General Public License
161+# along with this program. If not, see <http://www.gnu.org/licenses/>.
162+##############################################################################
163+
164+from osv import fields, osv
165+import tools
166+from tools.translate import _
167+from tools import config
168+
169+class res_company(osv.osv):
170+ _inherit = 'res.company'
171+ _columns = {
172+ 'journal_id': fields.many2one('account.journal', 'Journal',required=True,help="Journal used by default for invoices damaged"),
173+ 'account_id': fields.many2one('account.account', 'Account',required=True,help="Account used by default for invoices and lines of invoices damaged"),
174+ }
175+res_company()
176+
177
178=== added directory 'l10n_ve_invoice_nro_ctrl/view'
179=== added file 'l10n_ve_invoice_nro_ctrl/view/res_company_view.xml'
180--- l10n_ve_invoice_nro_ctrl/view/res_company_view.xml 1970-01-01 00:00:00 +0000
181+++ l10n_ve_invoice_nro_ctrl/view/res_company_view.xml 2011-09-30 15:43:37 +0000
182@@ -0,0 +1,20 @@
183+<?xml version="1.0" encoding="utf-8"?>
184+<openerp>
185+ <data>
186+ <record id="il_company_invoice_damaged" model="ir.ui.view">
187+ <field name="name">il_company_invoice_damaged</field>
188+ <field name="model">res.company</field>
189+ <field name="type">form</field>
190+ <field name="inherit_id" ref="base.view_company_form"/>
191+ <field name="arch" type="xml">
192+ <page string="Configuration" position="inside">
193+ <separator string="Data used by default for invoices damaged" colspan="4"/>
194+ <field name="journal_id"/>
195+ <field name="account_id"/>
196+ <newline/>
197+ </page>
198+ </field>
199+ </record>
200+ </data>
201+</openerp>
202+
203
204=== added directory 'l10n_ve_invoice_nro_ctrl/wizard'
205=== added file 'l10n_ve_invoice_nro_ctrl/wizard/__init__.py'
206--- l10n_ve_invoice_nro_ctrl/wizard/__init__.py 1970-01-01 00:00:00 +0000
207+++ l10n_ve_invoice_nro_ctrl/wizard/__init__.py 2011-09-30 15:43:37 +0000
208@@ -0,0 +1,27 @@
209+#!/usr/bin/python
210+# -*- encoding: utf-8 -*-
211+###########################################################################
212+# Module Writen to OpenERP, Open Source Management Solution
213+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
214+# All Rights Reserved
215+###############Credits######################################################
216+# Coded by: Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
217+# Planified by: Nhomar Hernandez
218+# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
219+# Audited by: Humberto Arocha humberto@openerp.com.ve
220+#############################################################################
221+# This program is free software: you can redistribute it and/or modify
222+# it under the terms of the GNU General Public License as published by
223+# the Free Software Foundation, either version 3 of the License, or
224+# (at your option) any later version.
225+#
226+# This program is distributed in the hope that it will be useful,
227+# but WITHOUT ANY WARRANTY; without even the implied warranty of
228+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
229+# GNU General Public License for more details.
230+#
231+# You should have received a copy of the GNU General Public License
232+# along with this program. If not, see <http://www.gnu.org/licenses/>.
233+##############################################################################
234+
235+import wizard_invoice_nro_ctrl
236
237=== added file 'l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl.py'
238--- l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl.py 1970-01-01 00:00:00 +0000
239+++ l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl.py 2011-09-30 15:43:37 +0000
240@@ -0,0 +1,118 @@
241+#!/usr/bin/python
242+# -*- encoding: utf-8 -*-
243+###########################################################################
244+# Module Writen to OpenERP, Open Source Management Solution
245+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
246+# All Rights Reserved
247+###############Credits######################################################
248+# Coded by: Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
249+# Planified by: Nhomar Hernandez
250+# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
251+# Audited by: Humberto Arocha humberto@openerp.com.ve
252+#############################################################################
253+# This program is free software: you can redistribute it and/or modify
254+# it under the terms of the GNU General Public License as published by
255+# the Free Software Foundation, either version 3 of the License, or
256+# (at your option) any later version.
257+#
258+# This program is distributed in the hope that it will be useful,
259+# but WITHOUT ANY WARRANTY; without even the implied warranty of
260+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
261+# GNU General Public License for more details.
262+#
263+# You should have received a copy of the GNU General Public License
264+# along with this program. If not, see <http://www.gnu.org/licenses/>.
265+##############################################################################
266+
267+from osv import fields, osv
268+import tools
269+from tools.translate import _
270+from tools import config
271+
272+class wizard_invoice_nro_ctrl(osv.osv_memory):
273+
274+ _name = "wizard.invoice.nro.ctrl"
275+ _columns = {
276+ 'nro_ctrl': fields.char('Control Number',size= 32,required=True,help="New control number of the invoice damaged."),
277+ 'sure': fields.boolean('Are You Sure?'),
278+ }
279+
280+ def action_invoice_create(self, cr, uid, ids, wizard_brw,invoice_id,context=None):
281+
282+ invoice_line_obj = self.pool.get('account.invoice.line')
283+ invoice_obj = self.pool.get('account.invoice')
284+ inv_brw = invoice_obj.browse(cr,uid,invoice_id,context)
285+ invoice={}
286+ invoice_line ={}
287+
288+ address_invoice_id = self.pool.get('res.partner.address').search(cr,uid,[('partner_id','=',inv_brw.partner_id.id),('type','=','invoice')])
289+ if address_invoice_id == []:
290+ raise osv.except_osv(_("ERROR !"), _("This partner does not have an invoice address"))
291+
292+ invoice.update({
293+ 'company_id': inv_brw.company_id.id,
294+ 'date_invoice': inv_brw.date_invoice,
295+ 'number': inv_brw.number,
296+ 'journal_id': inv_brw.company_id.journal_id.id,
297+ 'partner_id': inv_brw.company_id.partner_id.id,
298+ 'address_invoice_id' : address_invoice_id[0],
299+ 'nro_ctrl': wizard_brw.nro_ctrl,
300+ 'account_id': inv_brw.company_id.account_id.id,
301+ 'currency_id': inv_brw.company_id.currency_id.id,
302+ 'name': 'PAPELANULADO_NRO_CTRL_'+wizard_brw.nro_ctrl,
303+ 'state':'paid',
304+ })
305+ inv_id = invoice_obj.create(cr, uid, invoice,{})
306+ tax_id=self.pool.get('account.invoice.tax').create(cr,uid,{'name':'SDCF',
307+ 'tax_id': 1,
308+ 'amount':0.00,
309+ 'tax_amount':0.00,
310+ 'base':0.00,
311+ 'account_id':inv_brw.company_id.account_id.id,
312+ 'invoice_id':inv_id},{})
313+ invoice_line.update({
314+ 'name': 'PAPELANULADO_NRO_CTRL_'+wizard_brw.nro_ctrl,
315+ 'account_id': inv_brw.company_id.account_id.id,
316+ 'price_unit': 0,
317+ 'quantity': 0,
318+ 'invoice_id': inv_id,
319+ })
320+ for inv_line in inv_brw.invoice_line:
321+ if inv_line.concept_id or False:
322+ invoice_line.update({
323+ 'concept_id':inv_line.concept_id.id,
324+ })
325+ break
326+ invoice_line_id = invoice_line_obj.create(cr, uid, invoice_line, {})
327+ return inv_id
328+
329+ def new_open_window(self,cr,uid,ids,list_ids,xml_id,module,context=None):
330+ '''
331+ Generate new window at view form or tree
332+ '''
333+ mod_obj = self.pool.get('ir.model.data')
334+ act_obj = self.pool.get('ir.actions.act_window')
335+ result = mod_obj._get_id(cr, uid, module, xml_id)
336+ id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
337+ result = act_obj.read(cr, uid, id)
338+ result['res_id'] = list_ids
339+ return result
340+
341+ def create_invoice(self, cr, uid, ids, context=None):
342+ wizard_brw = self.browse(cr, uid, ids, context=None)
343+ wizard_deli_obj = self.pool.get('wz.picking.delivery.note')
344+ inv_id = context['active_id']
345+ invoice_obj = self.pool.get('account.invoice')
346+ inv_brw = invoice_obj.browse(cr,uid,inv_id,context)
347+
348+ for wizard in wizard_brw:
349+ if not wizard.sure:
350+ raise osv.except_osv(_("Error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))
351+ if inv_brw.company_id.journal_id and inv_brw.company_id.account_id:
352+ inv_id = self.action_invoice_create(cr,uid,ids,wizard,inv_id,context)
353+ else:
354+ raise osv.except_osv(_('Error!'), _("You must go to the company form and configure a journal and an account for damaged invoices"))
355+ return self.new_open_window(cr,uid,ids,[inv_id],'action_invoice_tree1','account')
356+
357+wizard_invoice_nro_ctrl()
358+
359
360=== added file 'l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl_view.xml'
361--- l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl_view.xml 1970-01-01 00:00:00 +0000
362+++ l10n_ve_invoice_nro_ctrl/wizard/wizard_invoice_nro_ctrl_view.xml 2011-09-30 15:43:37 +0000
363@@ -0,0 +1,42 @@
364+<?xml version="1.0" encoding="utf-8"?>
365+<openerp>
366+ <data>
367+ <record id="view_wizard_invoice_nro_ctrl" model="ir.ui.view">
368+ <field name="name">view.wizard.invoice.nro.ctrl</field>
369+ <field name="model">wizard.invoice.nro.ctrl</field>
370+ <field name="type">form</field>
371+ <field name="arch" type="xml">
372+ <form string="Create an invoice to justify the damaged one">
373+ <field name="nro_ctrl"/>
374+ <separator string="Are you sure you want to do this?" colspan="4"/>
375+ <field name="sure"/>
376+ <group colspan="8" col="8">
377+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
378+ <button icon="gtk-ok" name="create_invoice" string="Create Invoice" type="object"/>
379+ </group>
380+ </form>
381+ </field>
382+ </record>
383+
384+ <act_window
385+ name="Generate null paper"
386+ res_model="wizard.invoice.nro.ctrl"
387+ src_model="account.invoice"
388+ view_mode="form"
389+ key2="client_action_multi"
390+ target="new"
391+ id="menu_create_invoice_duplicate"
392+ />
393+
394+ <record id="wizard_invoice_nro_control" model="ir.actions.act_window">
395+ <field name="name">Create null paper</field>
396+ <field name="res_model">wizard.invoice.nro.ctrl</field>
397+ <field name="src_model">wizard.invoice.nro.ctrl</field>
398+ <field name="view_type">form</field>
399+ <field name="view_mode">tree,form</field>
400+ <field name="view_id" ref="view_wizard_invoice_nro_ctrl"/>
401+ <field name="target">new</field>
402+ </record>
403+
404+ </data>
405+</openerp>