Merge lp:~vauxoo/openerp-venezuela-localization/hbto_bug933809 into lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk

Proposed by hbto [Vauxoo] http://www.vauxoo.com
Status: Merged
Merged at revision: 621
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/hbto_bug933809
Merge into: lp:~openerp-venezuela/openerp-venezuela-localization/6.0-trunk
Diff against target: 89 lines (+50/-2)
3 files modified
l10n_ve_withholding/account.py (+26/-1)
l10n_ve_withholding_iva/model/invoice.py (+23/-0)
l10n_ve_withholding_iva/workflow/account_workflow.xml (+1/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/hbto_bug933809
Reviewer Review Type Date Requested Status
Gabriela Quilarque Pending
Nhomar - Vauxoo Pending
Review via email: mp+93533@code.launchpad.net

Description of the change

URGENT
This merge should be immediately applied
please, refer to bug description, where you
can find the needed info to test the right
behavior to this patch.
URGENTE
Este merge se deberia aplicar de inmediato
por favor dirijase a la descripcion del bug
donde podra encontrar la informacion necesaria
para probar el comportamiento adecuado de este
parche.

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
=== modified file 'l10n_ve_withholding/account.py'
--- l10n_ve_withholding/account.py 2012-01-26 20:23:30 +0000
+++ l10n_ve_withholding/account.py 2012-02-17 05:42:26 +0000
@@ -24,7 +24,7 @@
24################################################################################24################################################################################
2525
26from osv import fields, osv26from osv import fields, osv
2727import time
2828
29class account_journal(osv.osv):29class account_journal(osv.osv):
30 _inherit = 'account.journal'30 _inherit = 'account.journal'
@@ -39,4 +39,29 @@
3939
40account_journal()40account_journal()
4141
42class account_period(osv.osv):
43 _inherit = "account.period"
44
45 def find_fortnight(self, cr, uid, dt=None, context=None):
46 '''
47 This Function returns a tuple composed of
48 *) period for the asked dt (int)
49 *) fortnight for the asked dt (boolean):
50 -) False: for the 1st. fortnight
51 -) True: for the 2nd. fortnight.
52 Example:
53 (3,True) => a period whose id is 3 in the second fortnight
54 '''
55 if context is None: context = {}
56 if not dt:
57 dt = time.strftime('%Y-%m-%d')
58 period_ids = self.find(cr,uid,dt=dt,context=context)
59 period_ids = self.search(cr,uid,[('special','=',False),('id','in',period_ids)])
60 if not period_ids:
61 raise osv.except_osv(_('Error !'), _('No period defined for this date: %s !\nPlease create a fiscal year.')%dt)
62
63 fortnight= False if int(dt.split('-')[2]) <= 15 else True
64 return (period_ids[0],fortnight)
65account_period()
66
42# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:67# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
4368
=== modified file 'l10n_ve_withholding_iva/model/invoice.py'
--- l10n_ve_withholding_iva/model/invoice.py 2012-02-06 19:05:01 +0000
+++ l10n_ve_withholding_iva/model/invoice.py 2012-02-17 05:42:26 +0000
@@ -230,6 +230,29 @@
230 context={}230 context={}
231 return any([line.tax_id.ret for line in self.browse(cr, uid, ids[0], context=context).tax_line])231 return any([line.tax_id.ret for line in self.browse(cr, uid, ids[0], context=context).tax_line])
232232
233 def check_withholdable(self, cr, uid, ids, context=None):
234 '''
235 This will test for Refund invoice trying to find out
236 if its regarding parent is in the same fortnight.
237
238 return True if invoice is type 'in_invoice'
239 return True if invoice is type 'in_refund' and parent_id invoice
240 are both in the same fortnight.
241 return False otherwise
242 '''
243 per_obj = self.pool.get('account.period')
244 if context is None:
245 context={}
246 inv_brw = self.browse(cr,uid,ids[0],context=context)
247 if inv_brw.type == 'in_invoice':
248 return True
249 if inv_brw.type == 'in_refund' and inv_brw.parent_id:
250 dt_refund = inv_brw.date_invoice or time.strftime('%Y-%m-%d')
251 dt_invoice = inv_brw.parent_id.date_invoice
252 return per_obj.find_fortnight(cr, uid, dt=dt_refund, context=context) == \
253 per_obj.find_fortnight(cr, uid, dt=dt_invoice, context=context)
254 return False
255
233 def check_wh_apply(self, cr, uid, ids, context=None):256 def check_wh_apply(self, cr, uid, ids, context=None):
234 if context is None:257 if context is None:
235 context={}258 context={}
236259
=== modified file 'l10n_ve_withholding_iva/workflow/account_workflow.xml'
--- l10n_ve_withholding_iva/workflow/account_workflow.xml 2012-01-25 16:57:07 +0000
+++ l10n_ve_withholding_iva/workflow/account_workflow.xml 2012-02-17 05:42:26 +0000
@@ -31,7 +31,7 @@
31 <record id="trans_wh_router_wh_vat" model="workflow.transition">31 <record id="trans_wh_router_wh_vat" model="workflow.transition">
32 <field name="act_from" ref="l10n_ve_withholding.act_wh_router"/>32 <field name="act_from" ref="l10n_ve_withholding.act_wh_router"/>
33 <field name="act_to" ref="act_withold_vat"/>33 <field name="act_to" ref="act_withold_vat"/>
34 <field name="condition">check_wh_apply()</field>34 <field name="condition">check_wh_apply() and check_withholdable()</field>
35 <field name="signal"></field>35 <field name="signal"></field>
36 </record>36 </record>
37<!-- From Withholdings to paid-->37<!-- From Withholdings to paid-->