Merge lp:~vauxoo/openerp-venezuela-localization/nhomar_imp-with-islr-wkf into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by Nhomar - Vauxoo
Status: Merged
Merged at revision: 408
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/nhomar_imp-with-islr-wkf
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 118 lines (+37/-33)
3 files modified
l10n_ve_islr_withholding/invoice.py (+3/-27)
l10n_ve_islr_withholding/islr_wh_doc.py (+32/-1)
l10n_ve_islr_withholding/view/islr_wh_doc_view.xml (+2/-5)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/nhomar_imp-with-islr-wkf
Reviewer Review Type Date Requested Status
OpenERP para localizaciĆ³n Venezolana. Pending
Review via email: mp+78193@code.launchpad.net

Commit message

Included the workflow for withholding ISLR to workflow of invoices, corrected search view to avoid problems with new records created on WH ISLR, moved one method from account.invoice to wh.islr.doc to have more consistency on structure of classes

Description of the change

Included the workflow for withholding ISLR to workflow of invoices, corrected search view to avoid problems with new records created on WH ISLR, moved one method from account.invoice to wh.islr.doc to have more consistency on structure of classes

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_islr_withholding/invoice.py'
2--- l10n_ve_islr_withholding/invoice.py 2011-10-04 15:30:46 +0000
3+++ l10n_ve_islr_withholding/invoice.py 2011-10-05 02:52:03 +0000
4@@ -575,34 +575,10 @@
5 pass
6 return islr_wh_doc_id
7
8-
9 def action_ret_islr(self, cr, uid, ids, context={}):
10- invoices_brw = self.browse(cr, uid, ids, context)
11- wh_doc_list = []
12- for invoice in invoices_brw:
13- wh_doc_list = self.pool.get('islr.wh.doc.invoices').search(cr,uid,[('invoice_id','=',invoice.id)])
14- if wh_doc_list: #Chequear que la factura no haya sido retenida.
15- raise osv.except_osv(_('Invalid action !'),_("The Withholding invoice '%s' has already been done!") % (invoice.number))
16- else: # 1.- Si la factura no ha sido retenida
17- wh_dict={}
18- dict_rate={}
19- dict_completo={}
20- vendor, buyer, apply_wh = self._get_partners(cr,uid,invoice) # Se obtiene el (vendedor, el comprador, si el comprador es agente de retencion)
21- concept_list = self._get_concepts(cr,uid,invoice)# Se obtiene la lista de conceptos de las lineas de la factura actual.
22- if concept_list: # 2.- Si existe algun concepto de retencion en las lineas de la factura.
23- if apply_wh: # 3.- Si el comprador es agente de retencion
24- wh_dict = self._get_service_wh(cr, uid, invoice, concept_list) # Se obtiene un dic con la lista de lineas de factura, si se aplico retencion alguna vez, el monto base total de las lineas.
25- residence = self._get_residence(cr, uid, vendor, buyer) # Retorna el tipo de residencia del vendedor
26- nature = self._get_nature(cr, uid, vendor) # Retorna la naturaleza del vendedor.
27- dict_rate = self._get_rate_dict(cr, uid, concept_list, residence, nature,context) # Retorna las tasas por cada concepto
28- self._pop_dict(cr,uid,concept_list,dict_rate,wh_dict) # Borra los conceptos y las lineas de factura que no tengan tasa asociada.
29- dict_completo = self._get_wh_apply(cr,uid,dict_rate,wh_dict,nature) # Retorna el dict con todos los datos de la retencion por linea de factura.
30- islr_wh_doc_id=self._logic_create(cr,uid,dict_completo,context.get('wh_doc_id',False))# Se escribe y crea en todos los modelos asociados al islr.
31- else:
32- raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the supplier '%s' withholding agent is not!") % (buyer.name))
33- else:
34- raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the lines of the invoice has not concept withholding!"))
35- return islr_wh_doc_id
36+ return self.pool.get('islr.wh.doc').action_ret_islr(cr,uid,ids,context)
37+
38+
39 account_invoice()
40
41
42
43=== modified file 'l10n_ve_islr_withholding/islr_wh_doc.py'
44--- l10n_ve_islr_withholding/islr_wh_doc.py 2011-10-04 15:30:46 +0000
45+++ l10n_ve_islr_withholding/islr_wh_doc.py 2011-10-05 02:52:03 +0000
46@@ -8,7 +8,7 @@
47 # Coded by: Humberto Arocha <hbto@vauxoo.com>
48 # Maria Gabriela Quilarque <gabriela@vauxoo.com>
49 # Javier Duran <javier@vauxoo.com>
50-# Planified by: Nhomar Hernandez
51+# Planified by: Nhomar Hernandez <nhomar@vauxoo.com>
52 # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
53 # Audited by: Humberto Arocha hbto@vauxoo.com
54 #############################################################################
55@@ -382,6 +382,37 @@
56 self.pool.get('account.invoice').write(cr, uid, invoice_id, {}, context=context)
57 return {'move_id': move_id}
58
59+
60+ def action_ret_islr(self, cr, uid, ids, context={}):
61+ inv_obj = self.pool.get('account.invoice')
62+ invoices_brw = inv_obj.browse(cr, uid, ids, context)
63+ wh_doc_list = []
64+ for invoice in invoices_brw:
65+ wh_doc_list = inv_obj.pool.get('islr.wh.doc.invoices').search(cr,uid,[('invoice_id','=',invoice.id)])
66+ if wh_doc_list: #Chequear que la factura no haya sido retenida.
67+ raise osv.except_osv(_('Invalid action !'),_("The Withholding invoice '%s' has already been done!") % (invoice.number))
68+ else: # 1.- Si la factura no ha sido retenida
69+ wh_dict={}
70+ dict_rate={}
71+ dict_completo={}
72+ vendor, buyer, apply_wh = inv_obj._get_partners(cr,uid,invoice) # Se obtiene el (vendedor, el comprador, si el comprador es agente de retencion)
73+ concept_list = inv_obj._get_concepts(cr,uid,invoice)# Se obtiene la lista de conceptos de las lineas de la factura actual.
74+ if concept_list: # 2.- Si existe algun concepto de retencion en las lineas de la factura.
75+ if apply_wh: # 3.- Si el comprador es agente de retencion
76+ wh_dict = inv_obj._get_service_wh(cr, uid, invoice, concept_list) # Se obtiene un dic con la lista de lineas de factura, si se aplico retencion alguna vez, el monto base total de las lineas.
77+ residence = inv_obj._get_residence(cr, uid, vendor, buyer) # Retorna el tipo de residencia del vendedor
78+ nature = inv_obj._get_nature(cr, uid, vendor) # Retorna la naturaleza del vendedor.
79+ dict_rate = inv_obj._get_rate_dict(cr, uid, concept_list, residence, nature,context) # Retorna las tasas por cada concepto
80+ inv_obj._pop_dict(cr,uid,concept_list,dict_rate,wh_dict) # Borra los conceptos y las lineas de factura que no tengan tasa asociada.
81+ dict_completo = inv_obj._get_wh_apply(cr,uid,dict_rate,wh_dict,nature) # Retorna el dict con todos los datos de la retencion por linea de factura.
82+ islr_wh_doc_id=inv_obj._logic_create(cr,uid,dict_completo,context.get('wh_doc_id',False))# Se escribe y crea en todos los modelos asociados al islr.
83+ else:
84+ raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the supplier '%s' withholding agent is not!") % (buyer.name))
85+ else:
86+ raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the lines of the invoice has not concept withholding!"))
87+ return islr_wh_doc_id
88+
89+
90 islr_wh_doc()
91
92
93
94=== modified file 'l10n_ve_islr_withholding/view/islr_wh_doc_view.xml'
95--- l10n_ve_islr_withholding/view/islr_wh_doc_view.xml 2011-10-04 02:53:28 +0000
96+++ l10n_ve_islr_withholding/view/islr_wh_doc_view.xml 2011-10-05 02:52:03 +0000
97@@ -171,9 +171,6 @@
98 <field name="code"/>
99 <field name="partner_id"/>
100 <field name="journal_id" select="1" widget="selection" string="Journal"/>
101- <field name="user_id" select="1" widget="selection" string="Salesman">
102- <filter domain="[('user_id','=',uid)]" help="My Withholding Income" icon="terp-personal" separator="1"/>
103- </field>
104 </group>
105 <newline/>
106 <group expand="1" string="Group By...">
107@@ -330,9 +327,9 @@
108 <field name="view_type">form</field>
109 <field name="view_mode">tree,form,calendar,graph</field>
110 <field name="domain">[('type','=','in_invoice')]</field>
111- <field name="context">{'type':'in_invoice'}</field>
112+ <field name="context">{'type':'in_invoice', 'search_default_draft': 1}</field>
113 <field name="search_view_id" ref="view_wh_islr_filter_suppliers"/>
114- <field name="help">With Supplier Withholding you can manage document withholding issued to your suppliers. OpenERP can also generate document withholding automatically from invoices. To generate the withholding income you must confirm and validate the document withholding.</field>
115+ <field name="help">With Supplier Withholding you can manage document withholding issued to your suppliers. OpenERP can Just generate document withholding for purchase process automatically from invoices. To generate the withholding income and all accounting process you must confirm and validate the document withholding.</field>
116
117 </record>
118 <record model="ir.actions.act_window.view" id="action_wh_islr_tree">