Merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-yani into lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto

Proposed by Yanina Aular (Vauxoo)
Status: Needs review
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-yani
Merge into: lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-hbto
Diff against target: 883 lines (+374/-151)
17 files modified
l10n_ve_fiscal_requirements/__openerp__.py (+1/-0)
l10n_ve_fiscal_requirements/model/res_company.py (+0/-1)
l10n_ve_fiscal_requirements/view/partner_view.xml (+1/-0)
l10n_ve_fiscal_requirements/view/res_company_view.xml (+10/-0)
l10n_ve_fiscal_requirements/wizard/__init__.py (+1/-0)
l10n_ve_fiscal_requirements/wizard/wizard_update_name.py (+63/-0)
l10n_ve_fiscal_requirements/wizard/wizard_update_name_view.xml (+33/-0)
l10n_ve_withholding/test/wh_pay_invoice.yml (+6/-5)
l10n_ve_withholding_islr/__openerp__.py (+2/-0)
l10n_ve_withholding_islr/model/__init__.py (+1/-0)
l10n_ve_withholding_islr/model/invoice.py (+6/-0)
l10n_ve_withholding_islr/model/islr_wh_doc.py (+93/-32)
l10n_ve_withholding_islr/model/res_company.py (+47/-0)
l10n_ve_withholding_islr/view/islr_wh_doc_view.xml (+78/-54)
l10n_ve_withholding_islr/view/res_company_view.xml (+16/-0)
l10n_ve_withholding_islr/workflow/account_workflow.xml (+8/-35)
l10n_ve_withholding_islr/workflow/islr_wh_workflow.xml (+8/-24)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fr-rev-yani
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Pending
Review via email: mp+145188@code.launchpad.net

This proposal supersedes a proposal from 2012-12-11.

Description of the change

Mejora en la vista res_company de fiscal_requirements

To post a comment you must log in.

Unmerged revisions

809. By Yanina Aular (Vauxoo)

[ADD] update name button

808. By Yanina Aular (Vauxoo)

[MERGE] trunk

807. By Yanina Aular (Vauxoo)

[DEL] comments

806. By Yanina Aular (Vauxoo)

[DEL] cache_restart

805. By Yanina Aular (Vauxoo)

[DEL] cache_restart

804. By Yanina Aular (Vauxoo)

[IMP] Taking into account that res.users is now inherited from res.partner

803. By Yanina Aular (Vauxoo)

[IMP] Redefine field uid_country from plain char to functional char.

802. By Yanina Aular (Vauxoo)

[IMP] Changed <page string="Configuration" position="inside"> by <xpath expr = &apos;//page [@ string = "Configuration"] / group / group [@ name = "account_grp"]&apos; position = "after" >. For the name of the fields were visible.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_requirements/__openerp__.py'
2--- l10n_ve_fiscal_requirements/__openerp__.py 2012-12-05 14:45:18 +0000
3+++ l10n_ve_fiscal_requirements/__openerp__.py 2013-01-28 14:17:27 +0000
4@@ -79,6 +79,7 @@
5 'wizard/wizard_nro_ctrl_view.xml',
6 'view/res_company_view.xml',
7 'view/l10n_ut_view.xml',
8+ 'wizard/wizard_update_name_view.xml',
9 'view/partner_view.xml',
10 'view/account_inv_refund_nctrl_view.xml',
11 'view/account_tax_view.xml',
12
13=== modified file 'l10n_ve_fiscal_requirements/model/res_company.py'
14--- l10n_ve_fiscal_requirements/model/res_company.py 2012-12-09 20:02:09 +0000
15+++ l10n_ve_fiscal_requirements/model/res_company.py 2013-01-28 14:17:27 +0000
16@@ -45,7 +45,6 @@
17
18 def write(self, cr, uid, ids, values, context=None):
19 context = context or {}
20- self.cache_restart(cr)
21 context.update({'create_company':True})
22 return super(res_company, self).write(cr, uid, ids, values, context=context)
23
24
25=== modified file 'l10n_ve_fiscal_requirements/view/partner_view.xml'
26--- l10n_ve_fiscal_requirements/view/partner_view.xml 2012-12-14 15:15:40 +0000
27+++ l10n_ve_fiscal_requirements/view/partner_view.xml 2013-01-28 14:17:27 +0000
28@@ -20,6 +20,7 @@
29 <label for="vat"/>
30 <field name="vat" colspan="2" placeholder="e.g. VE123456789" class="oe_inline" attrs="{'required':[('uid_country','=','VE'),'|','&amp;','&amp;',('is_company','=',False),('parent_id','!=',False),('type','=','invoice'), ('parent_id','=',False)] }" />
31 <button name="button_check_vat" string="Check Validity" type="object" icon="gtk-execute" class="oe_inline"/>
32+ <button name="%(action_wiz_name)d" string="Update Name" type='action' icon="gtk-execute" class="oe_inline"/>
33 <field name="uid_country" colspan="2" invisible="1"/>
34 </xpath>
35
36
37=== modified file 'l10n_ve_fiscal_requirements/view/res_company_view.xml'
38--- l10n_ve_fiscal_requirements/view/res_company_view.xml 2012-12-08 20:34:59 +0000
39+++ l10n_ve_fiscal_requirements/view/res_company_view.xml 2013-01-28 14:17:27 +0000
40@@ -8,11 +8,21 @@
41 <field name="priority">24</field>
42 <field name="inherit_id" ref="base.view_company_form"/>
43 <field name="arch" type="xml">
44+
45+ <xpath expr='//page[@string="Configuration"]/group/group[@name="account_grp"]' position="after">
46+ <separator string="Data used by default for invoices damaged" colspan="4"/>
47+ </xpath>
48 <xpath expr="//group[@name='account_grp']" position="after">
49 <group name='fr1_grp' string='Damaged Invoices Info'>
50+
51 <field name="jour_id"/>
52+
53+ <field name="acc_id"/>
54+ <newline/>
55+
56 <field name="acc_id" domain="[('type','in',('other','receivable','payable'))]"/>
57 </group>
58+
59 </xpath>
60 </field>
61 </record>
62
63=== modified file 'l10n_ve_fiscal_requirements/wizard/__init__.py'
64--- l10n_ve_fiscal_requirements/wizard/__init__.py 2012-01-18 22:53:40 +0000
65+++ l10n_ve_fiscal_requirements/wizard/__init__.py 2013-01-28 14:17:27 +0000
66@@ -26,6 +26,7 @@
67 import wizard_nro_ctrl
68 import wizard_invoice_nro_ctrl
69 import wizard_url_seniat
70+import wizard_update_name
71 import update_info_partner
72 import account_invoice_refund
73 import account_invoice_debit
74
75=== added file 'l10n_ve_fiscal_requirements/wizard/wizard_update_name.py'
76--- l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 1970-01-01 00:00:00 +0000
77+++ l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2013-01-28 14:17:27 +0000
78@@ -0,0 +1,63 @@
79+#!/usr/bin/python
80+# -*- encoding: utf-8 -*-
81+###########################################################################
82+# Module Writen to OpenERP, Open Source Management Solution
83+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
84+# All Rights Reserved
85+###############Credits######################################################
86+# Coded by: Yanina Aular <yanina.aular@vauxoo.com>
87+# Planified by: Humberto Arocha
88+# Audited by: Vauxoo C.A.
89+#############################################################################
90+# This program is free software: you can redistribute it and/or modify
91+# it under the terms of the GNU Affero General Public License as published by
92+# the Free Software Foundation, either version 3 of the License, or
93+# (at your option) any later version.
94+#
95+# This program is distributed in the hope that it will be useful,
96+# but WITHOUT ANY WARRANTY; without even the implied warranty of
97+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98+# GNU Affero General Public License for more details.
99+#
100+# You should have received a copy of the GNU Affero General Public License
101+# along with this program. If not, see <http://www.gnu.org/licenses/>.
102+################################################################################
103+
104+from osv import osv
105+from osv import fields
106+from tools.translate import _
107+
108+class wiz_updatename(osv.osv_memory):
109+ _name = 'wiz.updatename'
110+ _description = "Wizard that changes the partner name"
111+
112+ def set_name(self, cr, uid, ids, context):
113+ data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]
114+ print ids
115+ if not data['sure']:
116+ raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))
117+
118+ partner_obj = self.pool.get('res.partner')
119+ name_partner = data['name']
120+
121+ partner_obj.write(cr, uid, context['active_id'], {'name': name_partner}, context=context)
122+ return {}
123+
124+ _columns = {
125+ 'name': fields.char('Name', 256, required=True),
126+ 'sure': fields.boolean('Are you sure?'),
127+ }
128+
129+ def _get_name(self, cr, uid, context=None):
130+ if context is None:
131+ context = {}
132+ partner_obj = self.pool.get('res.partner')
133+ partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])])
134+ partner_o = partner_obj.browse(cr, uid, partner[0])
135+ return partner_o and partner_o.name or False
136+
137+ _defaults = {
138+ 'name': _get_name,
139+ }
140+
141+wiz_updatename()
142
143=== added file 'l10n_ve_fiscal_requirements/wizard/wizard_update_name_view.xml'
144--- l10n_ve_fiscal_requirements/wizard/wizard_update_name_view.xml 1970-01-01 00:00:00 +0000
145+++ l10n_ve_fiscal_requirements/wizard/wizard_update_name_view.xml 2013-01-28 14:17:27 +0000
146@@ -0,0 +1,33 @@
147+<?xml version="1.0" encoding="utf-8"?>
148+<openerp>
149+ <data>
150+ <record model="ir.ui.view" id="wizard_name_form">
151+ <field name="name">wizard.updatename.form</field>
152+ <field name="model">wiz.updatename</field>
153+ <field name="type">form</field>
154+ <field name="arch" type="xml">
155+ <form string="Changing the Name" version="7.0">
156+ <field name="name" colspan="4" />
157+ <separator string="Are you sure you want to do this?" colspan="4" />
158+ <field name="sure" />
159+
160+ <footer>
161+ <button name="set_name" string="Confirm" type="object" icon="terp-check" class="oe_link"/>
162+ or
163+ <button special='cancel' string="Cancel" icon="terp-gtk-stop" class="oe_highlight"/>
164+ </footer>
165+ </form>
166+ </field>
167+ </record>
168+
169+ <record id="action_wiz_name" model="ir.actions.act_window">
170+ <field name="name">Change name</field>
171+ <field name="type">ir.actions.act_window</field>
172+ <field name="res_model">wiz.updatename</field>
173+ <field name="view_type">form</field>
174+ <field name="view_mode">form</field>
175+ <field name="target">new</field>
176+ </record>
177+
178+ </data>
179+</openerp>
180
181=== modified file 'l10n_ve_withholding/test/wh_pay_invoice.yml'
182--- l10n_ve_withholding/test/wh_pay_invoice.yml 2012-09-27 21:43:13 +0000
183+++ l10n_ve_withholding/test/wh_pay_invoice.yml 2013-01-28 14:17:27 +0000
184@@ -14,14 +14,14 @@
185 journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None)
186 res = self.onchange_partner_id(cr, uid, [], inv_brw.partner_id.id, journal_id, 0.0, 1, ttype='receipt', date=False)
187 ap_obj = self.pool.get('account.period')
188- period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})
189+ period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})[0]
190 vals = {
191 'account_id': ref('account.cash'),
192- 'amount': inv_brw.amount,
193+ 'amount': inv_brw.amount_total,
194 'company_id': ref('base.main_company'),
195 'currency_id': ref('base.EUR'),
196 'journal_id': ref('account.bank_journal'),
197- 'partner_id': ref('inv_brw.partner_id.id'),
198+ 'partner_id': inv_brw.partner_id.id,
199 'period_id': period,
200 'type': 'receipt',
201 }
202@@ -39,9 +39,10 @@
203 1.2 I check that the invoice state is "Open"
204 -
205 !python {model: account.voucher}: |
206+ import time
207 inv_obj = self.pool.get("account.invoice")
208 inv_brw = inv_obj.browse(cr, uid, ref("l10n_ve_fiscal_requirements.test_fr01"))
209 lines = inv_brw.invoice_line
210 data = self.onchange_journal(cr, uid, [ref("l10n_ve_fiscal_requirements.test_fr01")], 5, lines, False,
211- inv_brw.partner_id, time.strftime('%Y-%m-%d'),
212- inv_brw.amount, ttype, base.main_company, context=None)
213+ inv_brw.partner_id.id, time.strftime('%Y-%m-%d'),
214+ inv_brw.amount_total, 'receipt', ref('base.main_company'), context=None)
215
216=== modified file 'l10n_ve_withholding_islr/__openerp__.py'
217--- l10n_ve_withholding_islr/__openerp__.py 2012-12-26 18:00:58 +0000
218+++ l10n_ve_withholding_islr/__openerp__.py 2013-01-28 14:17:27 +0000
219@@ -53,9 +53,11 @@
220 "security/wh_islr_security.xml",
221 "security/ir.model.access.csv",
222 "data/l10n_ve_islr_withholding_data.xml",
223+ "data/retencion_islr_sequence.xml",
224 "view/wh_islr_view.xml",
225 "view/invoice_view.xml",
226 "view/partner_view.xml",
227+ "view/res_company_view.xml",
228 "report/islr_wh_report.xml",
229 "view/islr_wh_doc_view.xml",
230 "view/islr_wh_concept_view.xml",
231
232=== renamed file 'l10n_ve_withholding_islr/demo/retencion_islr_sequence.xml' => 'l10n_ve_withholding_islr/data/retencion_islr_sequence.xml'
233=== modified file 'l10n_ve_withholding_islr/model/__init__.py'
234--- l10n_ve_withholding_islr/model/__init__.py 2012-12-09 23:55:45 +0000
235+++ l10n_ve_withholding_islr/model/__init__.py 2013-01-28 14:17:27 +0000
236@@ -33,3 +33,4 @@
237 import islr_xml_wh
238 import partner
239 import product
240+import res_company
241
242=== modified file 'l10n_ve_withholding_islr/model/invoice.py'
243--- l10n_ve_withholding_islr/model/invoice.py 2012-12-26 17:54:42 +0000
244+++ l10n_ve_withholding_islr/model/invoice.py 2013-01-28 14:17:27 +0000
245@@ -154,6 +154,12 @@
246 'type': row.type,
247 'journal_id': wh_doc_obj._get_journal(cr,uid,context=context),})
248 self._create_doc_invoices(cr,uid,row.id,islr_wh_doc_id)
249+
250+ self.pool.get('islr.wh.doc').compute_amount_wh(cr, uid,
251+ [islr_wh_doc_id], context=context )
252+ if row.company_id.automatic_income_wh is True:
253+ self.pool.get('islr.wh.doc').write(cr, uid, islr_wh_doc_id,
254+ {'automatic_income_wh':True}, context=context)
255 else:
256 raise osv.except_osv(_('Invalid action !'),_("No se ha encontrado el numero de secuencia!"))
257
258
259=== modified file 'l10n_ve_withholding_islr/model/islr_wh_doc.py'
260--- l10n_ve_withholding_islr/model/islr_wh_doc.py 2012-12-26 17:58:01 +0000
261+++ l10n_ve_withholding_islr/model/islr_wh_doc.py 2013-01-28 14:17:27 +0000
262@@ -96,8 +96,6 @@
263 ('out_refund','Customer Invoice Refund'),
264 ],'Type', readonly=True, help="Voucher type"),
265 'state': fields.selection([
266- ('to_process','To Process'),
267- ('progress','Progress'),
268 ('draft','Draft'),
269 ('confirmed', 'Confirmed'),
270 ('done','Done'),
271@@ -117,6 +115,9 @@
272 'invoice_id':fields.many2one('account.invoice','Invoice',readonly=False,help="Invoice to make the accounting entry"),
273 'islr_wh_doc_id': fields.one2many('account.invoice','islr_wh_doc_id','Invoices',states={'draft':[('readonly',False)]}),
274 'user_id': fields.many2one('res.users', 'Salesman', readonly=True, states={'draft':[('readonly',False)]}),
275+ 'automatic_income_wh' : fields.boolean('Automatic Income Withhold',
276+ help='When the whole process will be check automatically, ' \
277+ 'and if everything is Ok, will be set to done'),
278 }
279
280 _defaults = {
281@@ -129,6 +130,7 @@
282 self.pool.get('res.users').browse(cr, uid, uid,
283 context=context).company_id.id,
284 'user_id': lambda s, cr, u, c: u,
285+ 'automatic_income_wh' : False,
286 }
287
288 def check_income_wh(self, cr, uid, ids, context=None):
289@@ -137,7 +139,7 @@
290 obj = self.browse(cr, uid, ids[0],context=context)
291 res = {}
292 for wh_line in obj.invoice_ids:
293- if not wh_line.islr_xml_id:
294+ if not (wh_line.islr_xml_id or wh_line.iwdl_ids):
295 res[wh_line.id] = (wh_line.invoice_id.name,
296 wh_line.invoice_id.number, wh_line.invoice_id.reference)
297 if res:
298@@ -148,6 +150,12 @@
299 raise osv.except_osv(_('Invoices with Missing Withheld Taxes!'),note)
300 return True
301
302+ def check_auto_wh(self, cr, uid, ids, context=None):
303+ context = context or {}
304+ ids = isinstance(ids, (int, long)) and [ids] or ids
305+ obj = self.browse(cr, uid, ids[0],context=context)
306+ return obj.automatic_income_wh or False
307+
308 def compute_amount_wh(self, cr, uid, ids, context=None):
309 context = context or {}
310 ids = isinstance(ids, (int, long)) and [ids] or ids
311@@ -156,6 +164,7 @@
312 for iwdi_brw in iwd_brw.invoice_ids:
313 iwdi_obj.load_taxes(cr, uid, iwdi_brw.id, context=context)
314 return True
315+
316 def validate(self, cr,uid,ids,*args):
317
318 if args[0]in ['in_invoice','in_refund'] and args[1] and args[2]:
319@@ -253,6 +262,8 @@
320 def action_cancel(self,cr,uid,ids,context={}):
321 #~ if self.browse(cr,uid,ids)[0].type=='in_invoice':
322 #~ return True
323+ self.pool.get('islr.wh.doc'). write(cr,uid,ids,{'automatic_income_wh':False})
324+
325 self.cancel_move(cr,uid,ids)
326 self.action_cancel_process(cr,uid,ids,context=context)
327 return True
328@@ -444,9 +455,14 @@
329 'amount_islr_ret': 0.0,
330 'base_ret': 0.0
331 }
332- for line in ret_line.islr_xml_id:
333- res[ret_line.id]['amount_islr_ret'] += line.wh
334- res[ret_line.id]['base_ret'] += line.base
335+ if ret_line.invoice_id.type in ('in_invoice','in_refund'):
336+ for line in ret_line.islr_xml_id:
337+ res[ret_line.id]['amount_islr_ret'] += line.wh
338+ res[ret_line.id]['base_ret'] += line.base
339+ else:
340+ for line in ret_line.iwdl_ids:
341+ res[ret_line.id]['amount_islr_ret'] += line.amount
342+ res[ret_line.id]['base_ret'] += line.base_amount
343
344 return res
345
346@@ -456,6 +472,7 @@
347 'islr_xml_id':fields.one2many('islr.xml.wh.line','islr_wh_doc_inv_id','Withholding Lines'),
348 'amount_islr_ret':fields.function(_amount_all, method=True, digits=(16,4), string='Withheld Amount', multi='all', help="Amount withheld from the base amount"),
349 'base_ret': fields.function(_amount_all, method=True, digits=(16,4), string='Base Amount', multi='all', help="Amount where a withholding is going to be compute from"),
350+ 'iwdl_ids':fields.one2many('islr.wh.doc.line','iwdi_id','Withholding Concepts'),
351 }
352 _rec_rame = 'invoice_id'
353
354@@ -475,8 +492,10 @@
355
356 def _get_wh(self, cr, uid, ids, concept_id, context=None):
357 '''
358- Returns a dictionary containing all the values ​​of the retention of an invoice line.
359+ Returns a dictionary containing all the values of the retention of an invoice line.
360 '''
361+ #TODO: Change the signature of this method
362+ # This record already has the concept_id built-in
363 context= context or {}
364 ids = isinstance(ids, (int, long)) and [ids] or ids
365 ixwl_obj= self.pool.get('islr.xml.wh.line')
366@@ -488,32 +507,50 @@
367 residence = self._get_residence(cr, uid, vendor, buyer)
368 nature = self._get_nature(cr, uid, vendor)
369
370+ concept_id =iwdl_brw.concept_id.id
371 #rate_base,rate_minimum,rate_wh_perc,rate_subtract,rate_code,rate_id,rate_name
372 rate_tuple = self._get_rate(cr, uid, concept_id, residence, nature, context=context)
373 base = 0
374- for line in iwdl_brw.xml_ids:
375- base += line.account_invoice_line_id.price_subtotal
376- apply = apply and base >= rate_tuple[0]*rate_tuple[1]/100.0
377- wh = 0.0
378- subtract = apply and rate_tuple[3] or 0.0
379- subtract_write=0.0
380- wh_concept = 0.0
381- sb_concept = subtract
382- for line in iwdl_brw.xml_ids:
383- if apply:
384- wh_calc = (rate_tuple[0]/100.0)*rate_tuple[2]*line.account_invoice_line_id.price_subtotal/100.0
385- if subtract >= wh_calc:
386- wh = 0.0
387- subtract -= wh_calc
388- else:
389- wh = wh_calc - subtract
390- subtract_write= subtract
391- subtract=0.0
392- ixwl_obj.write(cr,uid,line.id,{'wh':wh, 'sustract':subtract or subtract_write},
393- context=context)
394- wh_concept+=wh
395- iwdl_obj.write(cr, uid, ids[0],{'amount':wh_concept,
396- 'subtract':sb_concept, 'base_amount': base},context=context)
397+
398+ if iwdl_brw.invoice_id.type in ('in_invoice','in_refund'):
399+ for line in iwdl_brw.xml_ids:
400+ base += line.account_invoice_line_id.price_subtotal
401+ apply = apply and base >= rate_tuple[0]*rate_tuple[1]/100.0
402+ wh = 0.0
403+ subtract = apply and rate_tuple[3] or 0.0
404+ subtract_write=0.0
405+ wh_concept = 0.0
406+ sb_concept = subtract
407+ for line in iwdl_brw.xml_ids:
408+ if apply:
409+ wh_calc = (rate_tuple[0]/100.0)*rate_tuple[2]*line.account_invoice_line_id.price_subtotal/100.0
410+ if subtract >= wh_calc:
411+ wh = 0.0
412+ subtract -= wh_calc
413+ else:
414+ wh = wh_calc - subtract
415+ subtract_write= subtract
416+ subtract=0.0
417+ ixwl_obj.write(cr,uid,line.id,{'wh':wh, 'sustract':subtract or subtract_write},
418+ context=context)
419+ wh_concept+=wh
420+ else:
421+ for line in iwdl_brw.invoice_id.invoice_line:
422+ if line.concept_id.id == concept_id:
423+ base += line.price_subtotal
424+
425+ apply = apply and base >= rate_tuple[0]*rate_tuple[1]/100.0
426+ sb_concept = apply and rate_tuple[3] or 0.0
427+ if apply:
428+ wh_concept = (rate_tuple[0]/100.0)*rate_tuple[2]*base/100.0
429+ wh_concept -= sb_concept
430+ values = {
431+ 'amount':wh_concept,
432+ 'subtract':sb_concept,
433+ 'base_amount': base,
434+ 'retencion_islr':rate_tuple[2],
435+ }
436+ iwdl_obj.write(cr, uid, ids[0],values,context=context)
437 return True
438
439
440@@ -527,7 +564,11 @@
441 rates = {}
442 wh_perc= {}
443 xmls = {}
444- if ret_line.invoice_id:
445+
446+ if not ret_line.invoice_id:
447+ return True
448+
449+ if ret_line.invoice_id.type in ('in_invoice','in_refund'):
450 #~ Searching & Unlinking for xml lines from the current invoice
451 xml_lines = ixwl_obj.search(cr, uid, [('islr_wh_doc_inv_id', '=', ret_line.id)],context=context)
452 if xml_lines:
453@@ -568,8 +609,27 @@
454 'xml_ids': [(6,0,xmls[concept_id])],
455 }, context=context)
456 self._get_wh(cr, uid, iwdl_id, concept_id, context=context)
457+ else:
458+ #~ Searching & Unlinking for concept lines from the current invoice
459+ iwdl_ids = iwdl_obj.search(cr, uid, [('iwdi_id', '=',ret_line.id)],
460+ context=context)
461+ if iwdl_ids:
462+ iwdl_obj.unlink(cr, uid, iwdl_ids)
463+ iwdl_ids=[]
464+
465+ concept_list = self._get_concepts(cr, uid, ret_line.invoice_id.id,
466+ context=context)
467+ for concept_id in concept_list:
468+ iwdl_id=iwdl_obj.create(cr,uid,
469+ {'islr_wh_doc_id':ret_line.islr_wh_doc_id.id,
470+ 'concept_id':concept_id,
471+ 'invoice_id': ret_line.invoice_id.id,
472+ }, context=context)
473+ iwdl_ids+=[iwdl_id]
474+ self._get_wh(cr, uid, iwdl_id, concept_id, context=context)
475+ self.write(cr,uid,ids[0],{'iwdl_ids':[(6,0,iwdl_ids)]})
476 return True
477-
478+
479 def _get_partners(self, cr, uid, invoice):
480 '''
481 Se obtiene: el id del vendedor, el id del comprador de la factura y el campo booleano que determina si el comprador es agente de retencion.
482@@ -696,6 +756,7 @@
483 'move_id': fields.many2one('account.move', 'Journal Entry', readonly=True, help="Accounting voucher"),
484 'islr_rates_id': fields.many2one('islr.rates','Rates', help="Withhold rates"),
485 'xml_ids':fields.one2many('islr.xml.wh.line','islr_wh_doc_line_id','XML Lines'),
486+ 'iwdi_id': fields.many2one('islr.wh.doc.invoices','Withheld Invoice',help="Withheld Invoices"),
487 }
488
489 islr_wh_doc_line()
490
491=== added file 'l10n_ve_withholding_islr/model/res_company.py'
492--- l10n_ve_withholding_islr/model/res_company.py 1970-01-01 00:00:00 +0000
493+++ l10n_ve_withholding_islr/model/res_company.py 2013-01-28 14:17:27 +0000
494@@ -0,0 +1,47 @@
495+#!/usr/bin/python
496+# -*- encoding: utf-8 -*-
497+###########################################################################
498+# Module Writen to OpenERP, Open Source Management Solution
499+# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
500+# All Rights Reserved
501+###############Credits######################################################
502+# Coded by: Yanina Aular <yanina.aular@vauxoo.com>
503+# Planified by: Humberto Arocha
504+# Audited by: Humberto Arocha humberto@openerp.com.ve
505+#############################################################################
506+# This program is free software: you can redistribute it and/or modify
507+# it under the terms of the GNU Affero General Public License as published by
508+# the Free Software Foundation, either version 3 of the License, or
509+# (at your option) any later version.
510+#
511+# This program is distributed in the hope that it will be useful,
512+# but WITHOUT ANY WARRANTY; without even the implied warranty of
513+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
514+# GNU Affero General Public License for more details.
515+#
516+# You should have received a copy of the GNU Affero General Public License
517+# along with this program. If not, see <http://www.gnu.org/licenses/>.
518+##############################################################################
519+from osv import osv
520+from osv import fields
521+from tools.translate import _
522+from tools import config
523+import time
524+import datetime
525+
526+class res_company(osv.osv):
527+ _name = 'res.company'
528+ _inherit = 'res.company'
529+
530+ _columns = {
531+ 'automatic_income_wh':fields.boolean('Automatic Income Withhold',
532+ help='When True, Supplier Income Withholding will be check and '\
533+ 'validate automatically'),
534+ }
535+
536+ defaults = {
537+ 'automatic_income_wh': False,
538+ }
539+
540+res_company()
541+
542
543=== modified file 'l10n_ve_withholding_islr/view/islr_wh_doc_view.xml'
544--- l10n_ve_withholding_islr/view/islr_wh_doc_view.xml 2012-12-26 22:04:29 +0000
545+++ l10n_ve_withholding_islr/view/islr_wh_doc_view.xml 2013-01-28 14:17:27 +0000
546@@ -21,32 +21,6 @@
547 </field>
548 </record>
549
550- <record id="view_islr_wh_doc_invoices_form_" model="ir.ui.view">
551- <field name="name">islr.wh.doc.invoices_form</field>
552- <field name="model">islr.wh.doc.invoices</field>
553- <field name="arch" type="xml">
554- <form string="Invoices">
555- <field
556- name="invoice_id"
557- domain="[('partner_id','=',parent.partner_id),('islr_wh_doc_id', '=', False),('state', '=', 'open')]"
558- colspan='6'/>
559- <newline/>
560- <field name="islr_xml_id" nolabel="1" colspan='4'>
561- <tree string="Detail of the Concept of Income Withholding">
562- <field name="concept_code"/>
563- <field name="rate_id"/>
564- <field name="wh"/>
565- <field name="porcent_rete"/>
566- <field name="base"/>
567- </tree>
568- </field>
569- <field name="amount_islr_ret"/>
570- <field name="base_ret"/>
571- <button type='object' name='load_taxes' string='Load taxes' icon='gtk-execute'/>
572- </form>
573- </field>
574- </record>
575-
576 <!--
577 =====================================================
578 Retention ISLR DOC, DOC LINE CUSTOMERS
579@@ -132,7 +106,16 @@
580 <field name="name">islr.wh.doc_form_customers</field>
581 <field name="model">islr.wh.doc</field>
582 <field name="arch" type="xml">
583- <form string="Customer Income Withholding">
584+ <form string="Customer Income Withholding" version='7.0'>
585+ <header>
586+ <button name="compute_amount_wh" states="draft" string="Compute Income Withholding" type="object" icon="terp-stock_format-scientific"/>
587+ <button name="act_confirm" string="Confirmed" states="draft" icon="gtk-go-forward"/>
588+ <button name="act_done" string="Done" states="confirmed" icon="gtk-execute" />
589+ <button name="%(voucher_report_withholding_islr)d" string="Print Income Withholding" states="done" colspan="3" type="action" icon="gtk-execute"/>
590+ <button name="act_cancel" string="Cancel" states="draft,progress,confirmed,done" icon="gtk-cancel" />
591+ <button name="act_draft" colspan="2" string="Set to draft" states="cancel" icon="gtk-go-forward"/>
592+ <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"confirmed":"blue"}'/>
593+ </header>
594 <group colspan="4" col="6">
595 <field name="journal_id" domain="[('type','=','islr_sale')]"/>
596 <field name="type"/>
597@@ -144,33 +127,53 @@
598 <field name="name"/>
599 <field name="period_id"/>
600 <field name="date_uid"/>
601+ <field name="automatic_income_wh" readonly="1"/>
602 </group>
603 <notebook colspan="6">
604 <page string="Invoices to Be Withheld">
605- <field name='invoice_ids' nolabel='1'/>
606+ <field name='invoice_ids' nolabel='1'>
607+ <tree string="Invoices">
608+ <field name="invoice_id"/>
609+ <field name="iwdl_ids"/>
610+ <field name="amount_islr_ret"/>
611+ <field name="base_ret"/>
612+ <button type='object' name='load_taxes' string='Load taxes' icon='gtk-execute'/>
613+ </tree>
614+ <form string="Invoices">
615+ <field
616+ name="invoice_id"
617+ domain="[('islr_wh_doc_id', '=', False),('state', '=', 'open')]"
618+ colspan='6'/>
619+ <newline/>
620+ <field name="iwdl_ids" nolabel="1" colspan='4' >
621+ <tree string='Concepts' editable='top'>
622+ <field name='concept_id' readonly='1'/>
623+ <field name='retencion_islr' readonly='0'/>
624+ <field name='amount' readonly='0'/>
625+ <field name='move_id' readonly='1'/>
626+ </tree>
627+ </field>
628+ <field name="amount_islr_ret"/>
629+ <field name="base_ret"/>
630+ <button type='object' name='load_taxes' string='Load taxes' icon='gtk-execute'/>
631+ </form>
632+ </field>
633 </page>
634- <page string="Invoices">
635+ <page string="Invoices" invisible='1'>
636 <field domain="[('partner_id','=',partner_id),('status','=','no_pro'),('state','in',['open','paid']),('type','in',['out_invoice','out_refund'])]" colspan="6" name="islr_wh_doc_id" nolabel="1" widget="many2many"/>
637 </page>
638 <page string="Concept of Income Withholding">
639 <field colspan="6" name="concept_ids" nolabel="1" widget="one2many_list"/>
640- <group col="4" colspan="2">
641- <field name="amount_total_ret"/>
642- </group>
643+ <group col="4" colspan="2">
644+ <field name="amount_total_ret"/>
645+ </group>
646 </page>
647 <page string="Other Information">
648 <field name="company_id"/>
649 </page>
650 </notebook>
651- <group colspan="6" col="2">
652- <group col="1">
653- <field name="state"/>
654- <button name="act_confirm" string="Confirmed" states="draft" icon="gtk-go-forward"/>
655- <button name="act_done" string="Done" states="confirmed" icon="gtk-execute" />
656- <button name="%(voucher_report_withholding_islr)d" string="Print Income Withholding" states="done" colspan="3" type="action" icon="gtk-execute"/>
657- <button name="act_cancel" string="Cancel" states="draft,progress,confirmed,done" icon="gtk-cancel" />
658- <button name="act_draft" colspan="2" string="Set to draft" states="cancel" icon="gtk-go-forward"/>
659- </group>
660+ <group col="4" colspan="2">
661+ <field name="amount_total_ret"/>
662 </group>
663 </form>
664 </field>
665@@ -227,7 +230,16 @@
666 <field name="name">islr.wh.doc_form_suppliers</field>
667 <field name="model">islr.wh.doc</field>
668 <field name="arch" type="xml">
669- <form string="Supplier Income Withholding">
670+ <form string="Supplier Income Withholding" version='7.0'>
671+ <header>
672+ <button name="compute_amount_wh" states="draft" string="Compute Income Withholding" type="object" icon="terp-stock_format-scientific"/>
673+ <button name="act_confirm" string="Confirmed" states="draft" icon="gtk-go-forward"/>
674+ <button name="act_done" string="Done" states="confirmed" icon="gtk-execute" />
675+ <button name="%(voucher_report_withholding_islr)d" string="Print Income Withholding" states="done" colspan="3" type="action" icon="gtk-execute"/>
676+ <button name="act_cancel" string="Cancel" states="draft,progress,confirmed,done" icon="gtk-cancel" />
677+ <button name="act_draft" colspan="2" string="Set to draft" states="cancel" icon="gtk-go-forward"/>
678+ <field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done" statusbar_colors='{"confirmed":"blue"}'/>
679+ </header>
680 <group colspan="4" col="6">
681 <field name="journal_id" domain="[('type','=','islr_purchase')]"/>
682 <field name="type"/>
683@@ -240,11 +252,34 @@
684 <field name="period_id"/>
685 <field name="number"/>
686 <field name="date_uid" />
687+ <field name="automatic_income_wh" readonly="1"/>
688 <field name="invoice_id" />
689 </group>
690 <notebook colspan="6">
691 <page string="Invoices to Be Withheld">
692- <field name="invoice_ids" nolabel='1'/>
693+ <field name="invoice_ids" nolabel='1'>
694+ <form string="Invoices">
695+ <field
696+ name="invoice_id"
697+ domain="[('islr_wh_doc_id', '=', False),('state', '=', 'open')]"
698+ colspan='6'/>
699+ <newline/>
700+
701+ <field name="islr_xml_id" nolabel="1" colspan='4' >
702+ <tree string="Detail of the Concept of Income Withholding">
703+ <field name="concept_code"/>
704+ <field name="rate_id"/>
705+ <field name="wh"/>
706+ <field name="porcent_rete"/>
707+ <field name="base"/>
708+ </tree>
709+ </field>
710+
711+ <field name="amount_islr_ret"/>
712+ <field name="base_ret"/>
713+ <button type='object' name='load_taxes' string='Load taxes' icon='gtk-execute'/>
714+ </form>
715+ </field>
716 </page>
717 <page string="Invoices" invisible='1'>
718 <field domain="[('partner_id','=',partner_id),('status','=','no_pro'),('state','in',['open','paid']),('type','in',['in_invoice','in_refund'])]" colspan="6" name="islr_wh_doc_id" nolabel="1" widget="many2many"/>
719@@ -289,17 +324,6 @@
720 </notebook>
721 <group col="4" colspan="2">
722 <field name="amount_total_ret"/>
723- <button colspan="2" name="compute_amount_wh" string="Compute Income Withholding" type="object" icon="terp-stock_format-scientific"/>
724- </group>
725- <group colspan="6" col="2">
726- <group col="1">
727- <field name="state"/>
728- <button name="act_confirm" string="Confirm" states="draft" type="workflow" icon="gtk-go-forward"/>
729- <button name="act_done" string="Done" states="confirmed" type="workflow" icon="gtk-go-forward"/>
730- <button name="%(voucher_report_withholding_islr)d" string="Print Income Withholding" colspan="3" states="done" type="action" icon="gtk-execute"/>
731- <button name="act_cancel" string="Cancel" states="draft,progress,confirmed,done" type="workflow" icon="gtk-go-forward"/>
732- <button name="act_draft" colspan="2" string="Set to draft" states="cancel" type="workflow" icon="gtk-go-forward"/>
733- </group>
734 </group>
735 </form>
736 </field>
737
738=== added file 'l10n_ve_withholding_islr/view/res_company_view.xml'
739--- l10n_ve_withholding_islr/view/res_company_view.xml 1970-01-01 00:00:00 +0000
740+++ l10n_ve_withholding_islr/view/res_company_view.xml 2013-01-28 14:17:27 +0000
741@@ -0,0 +1,16 @@
742+<?xml version="1.0" encoding="utf-8"?>
743+<openerp>
744+ <data>
745+ <record id="res_company_wh_islr" model="ir.ui.view">
746+ <field name="name">res.company.wh.islr</field>
747+ <field name="model">res.company</field>
748+ <field name="type">form</field>
749+ <field name="inherit_id" ref="base_vat.company_form_vat"/>
750+ <field name="arch" type="xml">
751+ <xpath expr="//field[@name='vat_check_vies']" position="after">
752+ <field name="automatic_income_wh"/>
753+ </xpath>
754+ </field>
755+ </record>
756+ </data>
757+</openerp>
758
759=== modified file 'l10n_ve_withholding_islr/workflow/account_workflow.xml'
760--- l10n_ve_withholding_islr/workflow/account_workflow.xml 2012-12-21 03:42:48 +0000
761+++ l10n_ve_withholding_islr/workflow/account_workflow.xml 2013-01-28 14:17:27 +0000
762@@ -18,20 +18,6 @@
763 <field name="action">_create_islr_wh_doc()</field>
764 </record>
765
766- <record id="act_islr_router" model="workflow.activity">
767- <field name="wkf_id" ref="account.wkf"/>
768- <field name="name">islr_router</field>
769- <field name="kind">dummy</field>
770- <field name="split_mode">XOR</field>
771- </record>
772-
773- <record id="act_islr_xml" model="workflow.activity">
774- <field name="wkf_id" ref="account.wkf"/>
775- <field name="name">islr_xml</field>
776- <field name="kind">function</field>
777- <field name="action">action_islr_xml()</field>
778- </record>
779-
780 <!--
781 =====================================================
782 Transitions
783@@ -43,23 +29,18 @@
784 <field name="condition">check_invoice_type() and check_withholdable_concept()</field>
785 <field name="signal"></field>
786 </record>
787-
788- <record id="trans_wh_router_xml" model="workflow.transition">
789- <field name="act_from" ref="act_islr_router"/>
790- <field name="act_to" ref="act_islr_xml"/>
791- <field name="condition">check_wh_islr_xml()</field>
792- <field name="signal"></field>
793- </record>
794
795- <record id="trans_islr_router_wh_islr" model="workflow.transition">
796- <field name="act_from" ref="act_islr_router"/>
797- <field name="act_to" ref="act_withold_islr"/>
798- <field name="condition">check_wh_islr_apply()</field>
799- <field name="signal"></field>
800- </record>
801 <!-- From Withholdings to paid-->
802
803 <record id="trans_withhold_paid" model="workflow.transition">
804+ <field name="act_from" ref="l10n_ve_withholding.act_wh_router"/>
805+ <field name="act_to" ref="account.act_paid"/>
806+ <field name="trigger_model">account.move.line</field>
807+ <field name="trigger_expr_id">move_line_id_payment_get()</field>
808+ <field name="condition">test_paid()</field>
809+ </record>
810+
811+ <record id="trans_islr_xml_paid" model="workflow.transition">
812 <field name="act_from" ref="act_withold_islr"/>
813 <field name="act_to" ref="account.act_paid"/>
814 <field name="trigger_model">account.move.line</field>
815@@ -67,14 +48,6 @@
816 <field name="condition">test_paid()</field>
817 </record>
818
819- <record id="trans_islr_xml_paid" model="workflow.transition">
820- <field name="act_from" ref="act_islr_xml"/>
821- <field name="act_to" ref="account.act_paid"/>
822- <field name="trigger_model">account.move.line</field>
823- <field name="trigger_expr_id">move_line_id_payment_get()</field>
824- <field name="condition">test_paid()</field>
825- </record>
826-
827
828 </data>
829 </openerp>
830
831=== modified file 'l10n_ve_withholding_islr/workflow/islr_wh_workflow.xml'
832--- l10n_ve_withholding_islr/workflow/islr_wh_workflow.xml 2012-12-24 06:19:18 +0000
833+++ l10n_ve_withholding_islr/workflow/islr_wh_workflow.xml 2013-01-28 14:17:27 +0000
834@@ -14,14 +14,6 @@
835 <field name="name">draft</field>
836 </record>
837
838- <record id="act_progress" model="workflow.activity">
839- <field name="wkf_id" ref="wh_islr_order"/>
840- <field name="name">progress</field>
841- <field name="kind">function</field>
842- <field name="action">action_process()
843-write({'state':'progress'})</field>
844- </record>
845-
846 <record id="act_confirmed" model="workflow.activity">
847 <field name="wkf_id" ref="wh_islr_order"/>
848 <field name="action">action_confirm()</field>
849@@ -67,26 +59,18 @@
850 <field name="signal">act_confirm</field>
851 </record>
852
853- <record id="trans_draft_progress" model="workflow.transition">
854+ <record id="trans_draft_confirmed_2" model="workflow.transition">
855 <field name="act_from" ref="act_draft"/>
856- <field name="act_to" ref="act_progress"/>
857- <field name="signal">act_progress</field>
858- </record>
859-
860-
861- <record id="trans_progress_cancel" model="workflow.transition">
862- <field name="act_from" ref="act_progress"/>
863- <field name="act_to" ref="act_cancel"/>
864- <field name="signal">act_cancel</field>
865- </record>
866-
867- <record id="trans_progress_confirmed" model="workflow.transition">
868- <field name="act_from" ref="act_progress"/>
869 <field name="act_to" ref="act_confirmed"/>
870- <field name="condition">True</field>
871- <field name="signal"></field>
872+ <field name="condition">check_income_wh() and check_auto_wh()</field>
873 </record>
874
875+ <record id="trans_confirmed_done_2" model="workflow.transition">
876+ <field name="act_from" ref="act_confirmed"/>
877+ <field name="act_to" ref="act_done"/>
878+ <field name="condition">check_auto_wh()</field>
879+ </record>
880+
881 <record id="trans_confirmed_cancel" model="workflow.transition">
882 <field name="act_from" ref="act_confirmed"/>
883 <field name="act_to" ref="act_cancel"/>

Subscribers

People subscribed via source and target branches