Merge lp:~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve into lp:fiscal-module-ve

Proposed by [Kadima] Jose Moreno
Status: Merged
Approved by: [Kadima] Jose Moreno
Approved revision: 13
Merged at revision: 13
Proposed branch: lp:~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve
Merge into: lp:fiscal-module-ve
Diff against target: 602 lines (+488/-56)
9 files modified
__init__.py (+0/-22)
__openerp__.py (+0/-34)
kadima_wh_iva/__init__.py (+22/-0)
kadima_wh_iva/__openerp__.py (+36/-0)
kadima_wh_iva/data/sequence.xml (+36/-0)
kadima_wh_iva/model/__init__.py (+22/-0)
kadima_wh_iva/model/kadima_wh_iva.py (+244/-0)
kadima_wh_iva/view/inherits_views.xml (+52/-0)
kadima_wh_iva/view/kadima_wh_iva.xml (+76/-0)
To merge this branch: bzr merge lp:~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve
Reviewer Review Type Date Requested Status
[Kadima] Jose Moreno Approve
Review via email: mp+118274@code.launchpad.net

Description of the change

Merge para Actualizar código

To post a comment you must log in.
Revision history for this message
[Kadima] Jose Moreno (n-jmoreno) :
review: Approve
Revision history for this message
[Kadima] Jose Moreno (n-jmoreno) :
review: Approve
Revision history for this message
[KADIMA] Domingo Montes (dmontes) wrote :
Download full text (30.1 KiB)

no se

2012/8/5 [Kadima] Jose Moreno <email address hidden>

> [Kadima] Jose Moreno has proposed merging
> lp:~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve into
> lp:fiscal-module-ve.
>
> Requested reviews:
> [Kadima] Jose Moreno (n-jmoreno)
>
> For more details, see:
>
> https://code.launchpad.net/~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve/+merge/118274
>
> Merge para Actualizar código
> --
>
> https://code.launchpad.net/~katech/fiscal-module-ve/jose_moreno_fiscal_module_ve/+merge/118274
> You are subscribed to branch lp:fiscal-module-ve.
>
> === removed file '__init__.py'
> --- __init__.py 2012-05-07 16:19:16 +0000
> +++ __init__.py 1970-01-01 00:00:00 +0000
> @@ -1,22 +0,0 @@
> -#!/usr/bin/python
> -# -*- encoding: utf-8 -*-
>
> -###########################################################################
> -# Module Writen to OpenERP, Open Source Management Solution
> -# All Rights Reserved
>
> -###############Credits######################################################
>
> -#############################################################################
> -# This program is free software: you can redistribute it and/or modify
> -# it under the terms of the GNU Affero General Public License as
> published by
> -# the Free Software Foundation, either version 3 of the License, or
> -# (at your option) any later version.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU Affero General Public License for more details.
> -#
> -# You should have received a copy of the GNU Affero General Public
> License
> -# along with this program. If not, see <http://www.gnu.org/licenses/
> >.
>
> -##############################################################################
> -
> -import model
>
> === removed file '__openerp__.py'
> --- __openerp__.py 2012-05-07 16:19:16 +0000
> +++ __openerp__.py 1970-01-01 00:00:00 +0000
> @@ -1,34 +0,0 @@
> -#!/usr/bin/python
> -# -*- encoding: utf-8 -*-
>
> -###########################################################################
> -# Module Writen to OpenERP, Open Source Management Solution
> -# All Rights Reserved
> -# This program is free software: you can redistribute it and/or modify
> -# it under the terms of the GNU Affero General Public License as
> published by
> -# the Free Software Foundation, either version 3 of the License, or
> -# (at your option) any later version.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU Affero General Public License for more details.
> -#
> -# You should have received a copy of the GNU Affero General Public
> License
> -# along with this program. If not, see <http://www.gnu.org/licenses/
> >.
>
> -##############################################################################
> -
> -{
> - "name" : "Fiscal Module Venezuela",
> - "version...

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file '__init__.py'
2--- __init__.py 2012-05-07 16:19:16 +0000
3+++ __init__.py 1970-01-01 00:00:00 +0000
4@@ -1,22 +0,0 @@
5-#!/usr/bin/python
6-# -*- encoding: utf-8 -*-
7-###########################################################################
8-# Module Writen to OpenERP, Open Source Management Solution
9-# All Rights Reserved
10-###############Credits######################################################
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.
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-
26-import model
27
28=== removed file '__openerp__.py'
29--- __openerp__.py 2012-05-07 16:19:16 +0000
30+++ __openerp__.py 1970-01-01 00:00:00 +0000
31@@ -1,34 +0,0 @@
32-#!/usr/bin/python
33-# -*- encoding: utf-8 -*-
34-###########################################################################
35-# Module Writen to OpenERP, Open Source Management Solution
36-# All Rights Reserved
37-# This program is free software: you can redistribute it and/or modify
38-# it under the terms of the GNU Affero General Public License as published by
39-# the Free Software Foundation, either version 3 of the License, or
40-# (at your option) any later version.
41-#
42-# This program is distributed in the hope that it will be useful,
43-# but WITHOUT ANY WARRANTY; without even the implied warranty of
44-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45-# GNU Affero General Public License for more details.
46-#
47-# You should have received a copy of the GNU Affero General Public License
48-# along with this program. If not, see <http://www.gnu.org/licenses/>.
49-##############################################################################
50-
51-{
52- "name" : "Fiscal Module Venezuela",
53- "version" : "Beta 0.1",
54- "author" : "Kadima Technologies, C.A.",
55- "category" : "General",
56- "website": "http://",
57- "description": '''Integrated Module for Withholding IVA and ISLR''',
58- "depends" : ["account","account_voucher"],
59- "init_xml" : [],
60- "update_xml" : [
61- "view/main.xml",
62- ],
63- "active": False,
64- "installable": True
65-}
66
67=== removed directory 'images'
68=== added directory 'kadima_wh_iva'
69=== added file 'kadima_wh_iva/__init__.py'
70--- kadima_wh_iva/__init__.py 1970-01-01 00:00:00 +0000
71+++ kadima_wh_iva/__init__.py 2012-08-05 21:50:21 +0000
72@@ -0,0 +1,22 @@
73+#!/usr/bin/python
74+# -*- encoding: utf-8 -*-
75+###########################################################################
76+# Module Writen to OpenERP, Open Source Management Solution
77+# All Rights Reserved
78+###############Credits######################################################
79+#############################################################################
80+# This program is free software: you can redistribute it and/or modify
81+# it under the terms of the GNU Affero General Public License as published by
82+# the Free Software Foundation, either version 3 of the License, or
83+# (at your option) any later version.
84+#
85+# This program is distributed in the hope that it will be useful,
86+# but WITHOUT ANY WARRANTY; without even the implied warranty of
87+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88+# GNU Affero General Public License for more details.
89+#
90+# You should have received a copy of the GNU Affero General Public License
91+# along with this program. If not, see <http://www.gnu.org/licenses/>.
92+##############################################################################
93+
94+import model
95
96=== added file 'kadima_wh_iva/__openerp__.py'
97--- kadima_wh_iva/__openerp__.py 1970-01-01 00:00:00 +0000
98+++ kadima_wh_iva/__openerp__.py 2012-08-05 21:50:21 +0000
99@@ -0,0 +1,36 @@
100+#!/usr/bin/python
101+# -*- encoding: utf-8 -*-
102+###########################################################################
103+# Module Writen to OpenERP, Open Source Management Solution
104+# All Rights Reserved
105+# This program is free software: you can redistribute it and/or modify
106+# it under the terms of the GNU Affero General Public License as published by
107+# the Free Software Foundation, either version 3 of the License, or
108+# (at your option) any later version.
109+#
110+# This program is distributed in the hope that it will be useful,
111+# but WITHOUT ANY WARRANTY; without even the implied warranty of
112+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113+# GNU Affero General Public License for more details.
114+#
115+# You should have received a copy of the GNU Affero General Public License
116+# along with this program. If not, see <http://www.gnu.org/licenses/>.
117+##############################################################################
118+
119+{
120+ "name" : "Fiscal Module Venezuela",
121+ "version" : "Beta 0.6",
122+ "author" : "Kadima Technologies, C.A.",
123+ "category" : "General",
124+ "website": "http://",
125+ "description": '''Integrated Module for Withholding IVA''',
126+ "depends" : ["account","account_voucher"],
127+ "init_xml" : [],
128+ "update_xml" : [
129+ "view/inherits_views.xml",
130+ "view/kadima_wh_iva.xml",
131+ "data/sequence.xml",
132+ ],
133+ "active": False,
134+ "installable": True
135+}
136
137=== added directory 'kadima_wh_iva/data'
138=== added file 'kadima_wh_iva/data/sequence.xml'
139--- kadima_wh_iva/data/sequence.xml 1970-01-01 00:00:00 +0000
140+++ kadima_wh_iva/data/sequence.xml 2012-08-05 21:50:21 +0000
141@@ -0,0 +1,36 @@
142+<?xml version="1.0" encoding="utf-8"?>
143+<openerp>
144+ <data noupdate="1">
145+
146+ <!-- Sequences type for kadima.wh.iva -->
147+
148+ <record id="seq_type_account_kadima_wh_iva" model="ir.sequence.type">
149+ <field name="name">Withholding IVA</field>
150+ <field name="code">kadima.wh.iva</field>
151+ </record>
152+
153+ <record id="seq_type_account_kadima_wh_iva_purchase" model="ir.sequence.type">
154+ <field name="name">Withholding IVA purchase</field>
155+ <field name="code">kadima.wh.iva.in_invoice</field>
156+ </record>
157+
158+ <!-- Sequences for account.wh.iva -->
159+
160+ <record id="seq_account_wh_iva" model="ir.sequence">
161+ <field name="name">Withholding IVA</field>
162+ <field name="code">kadima.wh.iva</field>
163+ <field name="prefix">IVA:</field>
164+ <field name="padding">8</field>
165+ <field name="number_increment">1</field>
166+ </record>
167+
168+ <record id="seq_account_wh_iva_purchase" model="ir.sequence">
169+ <field name="name">Withholding IVA purchase</field>
170+ <field name="code">kadima.wh.iva</field>
171+ <field name="prefix">%(year)s-%(month)s-</field>
172+ <field name="padding">8</field>
173+ <field name="number_increment">1</field>
174+ </record>
175+
176+ </data>
177+</openerp>
178
179=== added directory 'kadima_wh_iva/images'
180=== added directory 'kadima_wh_iva/model'
181=== added file 'kadima_wh_iva/model/__init__.py'
182--- kadima_wh_iva/model/__init__.py 1970-01-01 00:00:00 +0000
183+++ kadima_wh_iva/model/__init__.py 2012-08-05 21:50:21 +0000
184@@ -0,0 +1,22 @@
185+#!/usr/bin/python
186+# -*- encoding: utf-8 -*-
187+###########################################################################
188+# Module Writen to OpenERP, Open Source Management Solution
189+# All Rights Reserved
190+###############Credits######################################################
191+#############################################################################
192+# This program is free software: you can redistribute it and/or modify
193+# it under the terms of the GNU Affero General Public License as published by
194+# the Free Software Foundation, either version 3 of the License, or
195+# (at your option) any later version.
196+#
197+# This program is distributed in the hope that it will be useful,
198+# but WITHOUT ANY WARRANTY; without even the implied warranty of
199+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
200+# GNU Affero General Public License for more details.
201+#
202+# You should have received a copy of the GNU Affero General Public License
203+# along with this program. If not, see <http://www.gnu.org/licenses/>.
204+##############################################################################
205+
206+import kadima_wh_iva
207
208=== added file 'kadima_wh_iva/model/kadima_wh_iva.py'
209--- kadima_wh_iva/model/kadima_wh_iva.py 1970-01-01 00:00:00 +0000
210+++ kadima_wh_iva/model/kadima_wh_iva.py 2012-08-05 21:50:21 +0000
211@@ -0,0 +1,244 @@
212+#!/usr/bin/python
213+# -*- encoding: utf-8 -*-
214+###########################################################################
215+# Module Writen to OpenERP, Open Source Management Solution
216+# Copyright (C) Kadima Developers, C.A. (<http://www.kadima.com.ve>).
217+# All Rights Reserved
218+###############Credits######################################################
219+# Coded by: Kadima C.A.
220+# Planified by: José Moreno
221+# Audited by: Kadima C.A.
222+#############################################################################
223+# This program is free software: you can redistribute it and/or modify
224+# it under the terms of the GNU Affero General Public License as published by
225+# the Free Software Foundation, either version 3 of the License, or
226+# (at your option) any later version.
227+#
228+# This program is distributed in the hope that it will be useful,
229+# but WITHOUT ANY WARRANTY; without even the implied warranty of
230+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
231+# GNU Affero General Public License for more details.
232+#
233+# You should have received a copy of the GNU Affero General Public License
234+# along with this program. If not, see <http://www.gnu.org/licenses/>.
235+################################################################################
236+from osv import osv
237+from osv import fields
238+from tools.translate import _
239+import time
240+from datetime import datetime
241+
242+
243+class kadima_wh_iva(osv.osv):
244+ _name = 'kadima.wh.iva'
245+
246+ #~ El estado draft es cuando se genera la retencion
247+ #~ El estado done es cuando se ha realizado la retencion
248+
249+ STATE_WH = [ ('draft', 'Borrador'),
250+ ('done', 'Retenido'),
251+ ('cancel', 'Anulado')]
252+ _rec_name = 'doc_number'
253+
254+ _columns = {
255+ #~ Aqui van las columnas
256+ 'period_id':fields.many2one('account.period','Periodo',help='Este es campo del periodo en el que se genero la retencion'),
257+ 'date_wh': fields.date('Fecha de la Retencion',help='Es la fecha en la que se pagala factura'),
258+ 'doc_number': fields.char('Numero de Documento',size=128, help='Es el numero de documento que posee la retencion en el sistema'),
259+ 'partner_id':fields.many2one('res.partner','Proveedor',required=True,help='Proveedor al que se le aplicara la retencion'),
260+ 'wh_number': fields.char('Numero de Retencion', size=128,help='Es el numero de la retencion en el sistema'),
261+ 'wh_lines': fields.one2many('kadima.wh.iva.lines','wh_header','Lineas de retencion'),
262+ 'invoice_id': fields.many2one('account.invoice','Facturas',required=True),
263+ 'journal_id': fields.many2one('account.journal', 'Journal', required=True),
264+ 'company_id': fields.many2one('res.company', 'Company', required=True, help="Company"),
265+ 'state': fields.selection(STATE_WH, 'Estado', readonly=True, help='Estado del documento de retencion'),
266+ }
267+
268+ _defaults = {
269+ #~ Aqui van los valores default de los campos
270+ 'company_id': lambda self, cr, uid, context: self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id,
271+ 'state': 'draft',
272+ }
273+
274+
275+ def create_wh_details(self, cr, uid, invoice_id, wh_iva_id,context=None):
276+ #~ Aqui instancio la clase account.invoice.tax y la guardo en una variable
277+ ait_obj = self.pool.get('account.invoice.tax')
278+ """ En esta linea hago un search en donde le digo buscame todos los
279+ registros de account_invoice_tax donde invoice_id sea igual al que
280+ te estoy dando a buscar, luego guardo esos ids en ait_ids """
281+ ait_ids = ait_obj.search(cr,uid,[('invoice_id','=',invoice_id)])
282+ """ Aqui hago un browse sobre los ids devueltos anteriormente
283+ y saco del objecto los valores que necesito para crear el detalle
284+ de la retencion """
285+ ait_brw = ait_obj.browse(cr,uid,ait_ids)
286+ percent_wh = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context=context)[0].percent_wh
287+ if ait_brw:
288+ for lines in ait_brw:
289+ kwil = {
290+ 'base' : lines.base,
291+ 'amount_iva' : lines.amount,
292+ 'name' : 'Retencion %s'%lines.name,
293+ 'percent_iva' : lines.tax_amount,
294+ 'percent_wh' : percent_wh,
295+ 'amount_wh' : (lines.amount * (percent_wh / 100)),
296+ 'wh_header' : wh_iva_id,
297+ }
298+ kwil_ids = self.pool.get('kadima.wh.iva.lines').create(cr, uid, kwil)
299+ return True
300+
301+kadima_wh_iva()
302+
303+class kadima_wh_iva_lines(osv.osv):
304+ _name = 'kadima.wh.iva.lines'
305+
306+ STATE_WH = [ ('draft', 'Borrador'),
307+ ('done', 'Retenido'),
308+ ('cancel', 'Anulado')]
309+
310+ #~ Si en el futuro se necesita hacer imputaciones presupuestarias
311+ #~ Se debe cambiar el codigo y enlazar las retenciones por linea de factura.
312+
313+ _columns = {
314+ #~ Estas son las columanas de detalle
315+ 'name':fields.char('Descripcion',size=128),
316+ 'wh_header': fields.many2one('kadima.wh.iva','Retencion de IVA'),
317+ 'base':fields.float('Monto Base Imponible'),
318+ 'percent_iva':fields.float('Porcentaje de IVA'),
319+ 'amount_iva': fields.float('Monto IVA'),
320+ 'percent_wh': fields.float('Porcentaje Retencion'),
321+ 'amount_wh':fields.float('Monto Retencion'),
322+ 'state': fields.selection(STATE_WH, 'Estado', readonly=True, help='Estado del documento de retencion'),
323+ }
324+
325+ _defaults = {
326+ #~ Aqui van los valores default de los campos
327+ 'state': 'draft',
328+ }
329+
330+kadima_wh_iva_lines()
331+
332+class account_invoice_tax(osv.osv):
333+ _name = 'account.invoice.tax'
334+ _inherit = 'account.invoice.tax'
335+
336+ """ Con esta funcion calculo la retencion de iva para devolversela en
337+ un diccionario al campo funcional """
338+ def _amount_wh(self, cr, uid, ids, field_name, arg, context=None):
339+ res = {}
340+ #~ Hago un browse de los ids de account_invoice_tax
341+ ait_brw = self.browse(cr, uid, ids)
342+ #~ Aqui intero sobre el objecto que contiene los registros
343+ for tax in ait_brw:
344+ #~ Me traigo el porcentaje de retencion de iva de la factura
345+ percent_wh = self.pool.get('account.invoice').browse(cr, uid, [tax.invoice_id.id], context=context)[0].percent_wh
346+ #~ Realizo el calculo de retencion
347+ amount = (tax.amount * (percent_wh / 100))
348+ """ Agrego al diccionario los ids con los montos calculados
349+ en donde el id del registro es la clave del diccionario """
350+ res.update({tax.id:amount})
351+ #~ Retorno el diccionario
352+ return res
353+
354+ #~ Aqui declaro un campo funcional para mostrar las retenciones en la factura.
355+ _columns = {
356+ 'amount_wh': fields.function(_amount_wh, method=True, type='float', string='Monto Retenido', help="Monto de la Retencion"),
357+ }
358+
359+account_invoice_tax()
360+
361+class account_invoice(osv.osv):
362+ _name = 'account.invoice'
363+ _inherit = 'account.invoice'
364+ #~ Esta relacion se creo para enlazar la retencion con la factura
365+ #~ Se agrego el percent_wh para guardar el porcentaje a retener del proveedor
366+ _columns = {
367+ 'wh_iva_id': fields.many2one('kadima.wh.iva','Numero de Retencion',readonly=True),
368+ 'percent_wh':fields.float('% de Ret. IVA'),
369+ }
370+
371+ """ Esto lo agregue para que cuando la factura se cree. automaticamente tome el porcentaje de
372+ retencion del proveedor """
373+ def create(self, cr, uid, values, context=None):
374+ """ Con la funcion anonima lambda me ahorro escribir lineas
375+ ya que ejecuta el browse en una sola linea y me retorna el resultado
376+ este busca en res_partner el proveedor y el porcentaje de retencion
377+ para luego retornarlo y guardarlo en el diccionario """
378+ values.update({'percent_wh': self.pool.get('res.partner').browse(cr, uid, values['partner_id'], context=context).percent_wh,})
379+ return super(account_invoice,self).create(cr, uid, values, context=context)
380+
381+ #~ Esta Funcion evita que al duplicar la factura se le coloque el mismo numero de la retencion
382+ def copy(self, cr, uid, id, default=None, context=None):
383+ if default is None:
384+ default = {}
385+ default = default.copy()
386+ default.update({'wh_iva_id':0 })
387+ return super(account_invoice, self).copy(cr, uid, id, default, context=context)
388+
389+ #~ Se sobreescribio la funcion de action_number para generar la retencion
390+ def action_number(self, cr, uid, ids, context=None):
391+ """ Con el super se llama a la funcion original para no sobre escribirla
392+ y guardo su resultado en la variable res que es de tipo booleano """
393+ res = super(account_invoice, self).action_number(cr, uid, ids, context=context)
394+
395+ """ Si res es true entonces instancio el objecto de la clase kadima.wh.iva
396+ el cual es la cabecera del documento de retencion de IVA, luego creo un
397+ diccionario con los valores necesarios y creo la cabecera del documento de
398+ retencion de IVA """
399+ if res:
400+ kwhi_obj = self.pool.get('kadima.wh.iva')
401+ """ Hago un browse y busco el id del partner como se que me devolvera solo
402+ un registro utilizo self.browse(cr,uid,ids)[0].partner_id.id de lo contrario
403+ tendria que interar el objecto para sacar el id """
404+ partner_id = self.browse(cr,uid,ids)[0].partner_id.id
405+ invoice_id = self.browse(cr,uid,ids)[0].id
406+ journal_id = self.pool.get('account.journal').search(cr,uid,[('type','=','purchase_iva')])
407+ if not journal_id:
408+ raise osv.except_osv(('Error !'),('Debe crear un diario de tipo "Iva en Compras".'))
409+ kwhi_dict = {
410+ 'doc_numer': '.',
411+ 'journal_id': journal_id[0],
412+ 'partner_id':partner_id,
413+ 'invoice_id': invoice_id,
414+ 'state':'draft',
415+ }
416+ print "Este es el Diccionario ", kwhi_dict
417+ wh_iva_id = kwhi_obj.create(cr, uid, kwhi_dict)
418+ #~ Con esta linea me traigo el correlativo del documento
419+ doc_number = self.pool.get('ir.sequence').get(cr, uid, 'kadima.wh.iva')
420+ #~ Aqui guardo el correlativo en el registro
421+ res = kwhi_obj.write(cr,uid,wh_iva_id,{'doc_number':doc_number})
422+ if res:
423+ #~ Aqui llamo la funcion que crea las lineas de retencion
424+ res = kwhi_obj.create_wh_details(cr,uid,ids,wh_iva_id,context=context)
425+ if res:
426+ """ Aqui actualizo el registro y guardo el id de la cabecera de la
427+ retencion en la cabecera de la factura si no hay errores devuelve
428+ True sino devolvera False """
429+ res = self.write(cr,uid,ids,{'wh_iva_id':wh_iva_id})
430+ return res
431+
432+account_invoice()
433+
434+class res_partner(osv.osv):
435+ _name = 'res.partner'
436+ _inherit = 'res.partner'
437+ #~ Se crea el campo para guardar el porcentaje en el registro del proveedor
438+ _columns = {
439+ 'percent_wh':fields.float('% de Ret. IVA'),
440+ }
441+res_partner()
442+
443+class account_journal(osv.osv):
444+ _name = 'account.journal'
445+ _inherit = 'account.journal'
446+
447+ _columns = {
448+ 'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), ('situation', 'Opening/Closing Situation'),('purchase_iva','Iva en Compras'),('purchase_islr','ISLR en Compras')], 'Type', size=32, required=True,
449+ help="Select 'Sale' for Sale journal to be used at the time of making invoice."\
450+ " Select 'Purchase' for Purchase Journal to be used at the time of approving purchase order."\
451+ " Select 'Cash' to be used at the time of making payment."\
452+ " Select 'General' for miscellaneous operations."\
453+ " Select 'Opening/Closing Situation' to be used at the time of new fiscal year creation or end of year entries generation."),
454+ }
455+account_journal()
456
457=== added directory 'kadima_wh_iva/report'
458=== added directory 'kadima_wh_iva/security'
459=== added directory 'kadima_wh_iva/view'
460=== added file 'kadima_wh_iva/view/inherits_views.xml'
461--- kadima_wh_iva/view/inherits_views.xml 1970-01-01 00:00:00 +0000
462+++ kadima_wh_iva/view/inherits_views.xml 2012-08-05 21:50:21 +0000
463@@ -0,0 +1,52 @@
464+<?xml version="1.0"?>
465+<openerp>
466+ <data>
467+
468+ <record id="kadima_iva_partner" model="ir.ui.view">
469+ <field name="name">res.partner.iva.form</field>
470+ <field name="model">res.partner</field>
471+ <field name="type">form</field>
472+ <field name="inherit_id" ref="base.view_partner_form"/>
473+ <field name="arch" type="xml">
474+ <xpath expr="/form/notebook/page[@string='Notes']" position="after">
475+ <page string="Retenciones de Impuestos" >
476+ <separator colspan='4' string="Retenciones de Impuestos"/>
477+ <field name="percent_wh"/>
478+ </page>
479+ </xpath>
480+ </field>
481+ </record>
482+
483+ <record id="view_kadima_invoice_supplier" model="ir.ui.view">
484+ <field name="name">account.invoice.inherit.tax</field>
485+ <field name="model">account.invoice</field>
486+ <field name="type">form</field>
487+ <field name="inherit_id" ref="account.invoice_supplier_form"/>
488+ <field name="arch" type="xml">
489+ <xpath expr="/form/notebook/page[@string='Invoice']/group/field[@name='tax_line']" position="replace">
490+ <field name="tax_line" nolabel="1">
491+ <tree editable="bottom" string="Taxes">
492+ <field name="name"/>
493+ <field name="account_id" groups="account.group_account_invoice"/>
494+ <field name="base" on_change="base_change(base,parent.currency_id,parent.company_id,parent.date_invoice)" readonly="1"/>
495+ <field name="amount" on_change="amount_change(amount,parent.currency_id,parent.company_id,parent.date_invoice)"/>
496+
497+ <field name="amount_wh"/>
498+ <field invisible="True" name="base_amount"/>
499+ <field invisible="True" name="tax_amount"/>
500+ <field name="factor_base" invisible="True"/>
501+ <field name="factor_tax" invisible="True"/>
502+ </tree>
503+ </field>
504+ </xpath>
505+ <xpath expr="/form/notebook/page[@string='Invoice']" position="after">
506+ <page string="Reteciones de Impuestos" >
507+ <separator colspan='4' string="Retenciones de IVA"/>
508+ <field name="percent_wh"/>
509+ </page>
510+ </xpath>
511+ </field>
512+ </record>
513+
514+ </data>
515+</openerp>
516
517=== added file 'kadima_wh_iva/view/kadima_wh_iva.xml'
518--- kadima_wh_iva/view/kadima_wh_iva.xml 1970-01-01 00:00:00 +0000
519+++ kadima_wh_iva/view/kadima_wh_iva.xml 2012-08-05 21:50:21 +0000
520@@ -0,0 +1,76 @@
521+<openerp>
522+<data>
523+
524+ <record id="view_kadima_wh_iva_tree_suppliers" model="ir.ui.view">
525+ <field name="name">kadima.wh.iva.tree</field>
526+ <field name="model">kadima.wh.iva</field>
527+ <field name="type">tree</field>
528+ <field name="arch" type="xml">
529+ <tree colors="green:state=='draft'" string="Supplier Withholding Income">
530+ <field name="doc_number"/>
531+ <field name="wh_number"/>
532+ <field name="date_wh"/>
533+ <field name="period_id"/>
534+ <field name="state"/>
535+ </tree>
536+ </field>
537+ </record>
538+
539+ <record id="view_kadima_wh_iva_form_suppliers" model="ir.ui.view">
540+ <field name="name">kadima.wh.iva.form</field>
541+ <field name="model">kadima.wh.iva</field>
542+ <field name="type">form</field>
543+ <field name="arch" type="xml">
544+ <form string="Retenciones de IVA a Proveedores">
545+ <group colspan="4" col="6">
546+ <field name="journal_id" domain="[('type','=','general')]"/>
547+ <field name="wh_number"/>
548+ <field name="doc_number"/>
549+ <field name="partner_id" domain="[('supplier','=',True)]"/>
550+ <field name="date_wh" attrs="{'readonly': [('state','=','done')]}"/>
551+ <field name="period_id"/>
552+ <field name="invoice_id" />
553+ </group>
554+ <notebook colspan="6">
555+ <page string="Withholding Income">
556+ <field colspan="6" name="wh_lines" nolabel="1">
557+ <tree string="lineas de Retencion">
558+ <field name="name"/>
559+ <field name="base"/>
560+ <field name="amount_iva"/>
561+ <field name="percent_wh"/>
562+ <field name="amount_wh" sum="Monto Retencion"/>
563+ </tree>
564+ </field>
565+ </page>
566+ <page string="Other Information">
567+ <field name="company_id"/>
568+ </page>
569+ </notebook>
570+ <group colspan="6" col="6">
571+ <field name="state"/>
572+ <button name="calculate_wh" string="Calcular Retencion" states="draft" icon="gtk-execute" type="object"/>
573+ <button name="act_progress" string="Retener" states="draft" icon="gtk-go-forward" type="object"/>
574+ <button name="act_cancel" string="Cancel" states="done" colspan="2" icon="gtk-go-forward" type="object"/>
575+ </group>
576+ </form>
577+ </field>
578+ </record>
579+
580+ <record model="ir.actions.act_window" id="action_kadima_wh_iva_supplier">
581+ <field name="name">Retenciones de IVA a Proveedores</field>
582+ <field name="res_model">kadima.wh.iva</field>
583+ <field name="type">ir.actions.act_window</field>
584+ <field name="view_type">form</field>
585+ <field name="view_mode">tree,form</field>
586+ </record>
587+
588+ <menuitem
589+ id="menu_action_wh_islr_supplier"
590+ name="Retenciones de IVA"
591+ parent="account.menu_finance_payables"
592+ action="action_kadima_wh_iva_supplier"/>
593+
594+ </data>
595+</openerp>
596+
597
598=== added directory 'kadima_wh_iva/wizard'
599=== removed directory 'report'
600=== removed directory 'security'
601=== removed directory 'view'
602=== removed directory 'wizard'

Subscribers

People subscribed via source and target branches