Skip to content

Commit

Permalink
[FIX] l10n_ve_withholding_muni: Fixed some unittests issues
Browse files Browse the repository at this point in the history
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent 5c339bf commit f8cf7bc
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 26 deletions.
13 changes: 9 additions & 4 deletions l10n_ve_withholding_muni/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
"category": 'Generic Modules/Accounting',
'init_xml': [],
"depends": ["l10n_ve_withholding"],
'data': [
'test': [
'test/awm_customer.yml',
'test/awm_supplier.yml',
],
'data': [
'security/wh_muni_security.xml',
'security/ir.model.access.csv',
'data/wh_muni_sequence.xml',
Expand All @@ -42,9 +46,10 @@
'report/wh_muni_report.xml',
'workflow/l10n_ve_wh_muni_wf.xml',
],
'test': [
'test/awm_supplier.yml',
'test/awm_customer.yml'
'demo': [
'demo/demo_accounts.xml',
'demo/demo_journal.xml',
'demo/demo_partners.xml',
],
'installable': True,
}
36 changes: 18 additions & 18 deletions l10n_ve_withholding_muni/demo/demo_partners.xml
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
<?xml version='1.0' encoding='UTF-8'?>
<openerp>
<data>
<!-- Due to the need of country in main_partner to validate the WithHolding. We change the
Country of its invoice address and VAT due to the mandatory VAT number for partners
<!-- Due to the need of country in main_partner to validate the WithHolding. We change the
Country of its invoice address and VAT due to the mandatory VAT number for partners
in VE.
-->
<record id="base.main_partner" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<!--BEGIN PARTNERS -->
<record id="l10n_ve_fiscal_requirements.f_req_partner_1" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_2" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_3" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_4" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_5" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_6" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<!-- An orphan contact without parent_id this record shoudl be used to test this case
fiscally-->
<record id="l10n_ve_fiscal_requirements.f_req_partner_7" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_8" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<record id="l10n_ve_fiscal_requirements.f_req_partner_9" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>
<!-- I will add contacts to Vauxoo, due to they are from Venezuela, the vat is mandatory.

<!-- I will add contacts to Vauxoo, due to they are from Venezuela, the vat is mandatory.
-->
<record id="base.res_partner_23" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>
<!-- Test a contact in a country with one invoice address different to the main company
Forced to have a vat just to pass TODO: remove vat when the contraint s fixed.

<!-- Test a contact in a country with one invoice address different to the main company
Forced to have a vat just to pass TODO: remove vat when the contraint s fixed.
-->
<record id="l10n_ve_fiscal_requirements.f_req_partner_10" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<!-- Test a contact in a country with one contact address different to the main company -->
<record id="l10n_ve_fiscal_requirements.f_req_partner_10" model="res.partner">
<field name="property_wh_munici_receivable" ref="muni_rec"/>
<field name="property_wh_munici_payable" ref="muni_pay"/>
</record>

<!--END PARTNERS -->
</data>
</openerp>
Expand Down
6 changes: 4 additions & 2 deletions l10n_ve_withholding_muni/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,20 @@ def _get_move_lines(self, cr, uid, ids, to_wh, period_id,
cr, uid, ids, to_wh, period_id, pay_journal_id, writeoff_acc_id,
writeoff_period_id, writeoff_journal_id, date, name,
context=context)
rp_obj = self.pool.get('res.partner')
if context.get('muni_wh', False):
rp_obj = self.pool.get('res.partner')
invoice = self.browse(cr, uid, ids[0])
acc_part_brw = rp_obj._find_accounting_partner(
to_wh.invoice_id.partner_id)
invoice = self.browse(cr, uid, ids[0])
types = {
'out_invoice': -1,
'in_invoice': 1,
'out_refund': 1,
'in_refund': -1
}
direction = types[invoice.type]
print '====================== payable', acc_part_brw.property_wh_munici_payable
print ' ===================== receiva', acc_part_brw.property_wh_munici_receivable
if to_wh.retention_id.type == 'in_invoice':
acc = acc_part_brw.property_wh_munici_payable and \
acc_part_brw.property_wh_munici_payable.id or False
Expand Down
3 changes: 1 addition & 2 deletions l10n_ve_withholding_muni/model/wh_muni.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,8 @@ def action_done(self, cr, uid, ids, context=None):
def action_move_create(self, cr, uid, ids, context=None):
""" Create movements associated with retention and reconcile
"""
if context is None:
context = {}
inv_obj = self.pool.get('account.invoice')
context = dict(context or {})
context.update({'muni_wh': True})
for ret in self.browse(cr, uid, ids):
for line in ret.munici_line_ids:
Expand Down

0 comments on commit f8cf7bc

Please sign in to comment.