Skip to content

Commit

Permalink
[FIX] l10n_ve_withholding_islr: Solved logic issues when create whith…
Browse files Browse the repository at this point in the history
…holding doc
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent 3e14d32 commit d64f2d0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 1 addition & 3 deletions l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ def fields_view_get(self, cr, uid, view_id=None, view_type=False,
context=None, toolbar=False, submenu=False):
""" Depending on context, options are displayed in the selection field
"""
if context is None:
context = {}

context = dict(context or {})
journal_obj = self.pool.get('account.journal')
res = super(AccountInvoiceRefund, self).fields_view_get(
cr, uid, view_id=view_id, view_type=view_type, context=context,
Expand Down
26 changes: 13 additions & 13 deletions l10n_ve_withholding_islr/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ class AccountInvoice(osv.osv):
minimun rate.'''),
}

# BEGIN OF REWRITING ISLR

# BEGIN OF REWRITING ISLR
def check_invoice_type(self, cr, uid, ids, context=None):
""" This method check if the given invoice record is from a supplier
"""
Expand Down Expand Up @@ -168,7 +167,7 @@ def _create_doc_invoices(self, cr, uid, ids, islr_wh_doc_id,
def _create_islr_wh_doc(self, cr, uid, ids, context=None):
""" Function to create in the model islr_wh_doc
"""
context = context or {}
context = dict(context or {})
ids = isinstance(ids, (int, long)) and [ids] or ids

wh_doc_obj = self.pool.get('islr.wh.doc')
Expand Down Expand Up @@ -199,7 +198,8 @@ def _create_islr_wh_doc(self, cr, uid, ids, context=None):
'period_id': row.period_id.id,
'account_id': row.account_id.id,
'type': row.type,
'journal_id': journal
'journal_id': journal,
'date_uid': row.date_invoice,
}
if row.company_id.propagate_invoice_date_to_income_withholding:
values['date_uid'] = row.date_invoice
Expand Down Expand Up @@ -242,15 +242,15 @@ def _refund_cleanup_lines(self, cr, uid, lines, context=None):
data = super(AccountInvoice, self)._refund_cleanup_lines(
cr, uid, lines, context=context)
res = []
for xres, yres, res in data:
if 'concept_id' in res:
res['concept_id'] = res.get(
'concept_id', False) and res['concept_id']
if 'apply_wh' in res:
res['apply_wh'] = False
if 'wh_xml_id' in res:
res['wh_xml_id'] = 0
res.append((xres, yres, res))
for xres, yres, zres in data:
if 'concept_id' in zres:
zres['concept_id'] = zres.get(
'concept_id', False) and zres['concept_id']
if 'apply_wh' in zres:
zres['apply_wh'] = False
if 'wh_xml_id' in zres:
zres['wh_xml_id'] = 0
res.append((xres, yres, zres))
return res

def validate_wh_income_done(self, cr, uid, ids, context=None):
Expand Down
4 changes: 3 additions & 1 deletion l10n_ve_withholding_islr/model/islr_wh_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,7 @@ def load_taxes(self, cr, uid, ids, context=None):
ids = isinstance(ids, (int, long)) and [ids] or ids
ixwl_obj = self.pool.get('islr.xml.wh.line')
iwdl_obj = self.pool.get('islr.wh.doc.line')
ail_obj = self.pool.get('account.invoice.line')
ret_line = self.browse(cr, uid, ids[0], context=context)
lines = []
xmls = {}
Expand Down Expand Up @@ -1143,7 +1144,8 @@ def load_taxes(self, cr, uid, ids, context=None):
# Vuelve a crear las lineas
xml_id = ixwl_obj.create(cr, uid, values, context=context)
# Write back the new xml_id into the account_invoice_line
i.write({'wh_xml_id': xml_id}, context=context)
ail_vals = {'wh_xml_id': xml_id}
ail_obj.write(cr, uid, i.id, ail_vals, context=context)
lines.append(xml_id)
# Keeps a log of the rate & percentage for a concept
if xmls.get(i.concept_id.id):
Expand Down

0 comments on commit d64f2d0

Please sign in to comment.