Skip to content

Commit

Permalink
[FIX] l10n_withholding_islr: Fixed unittests fails
Browse files Browse the repository at this point in the history
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent e59ad31 commit ac6c809
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 38 deletions.
4 changes: 2 additions & 2 deletions l10n_ve_withholding_islr/model/invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ def _get_move_lines(self, cr, uid, ids, to_wh, period_id, pay_journal_id,
direction = types[inv_brw.type]

for iwdl_brw in to_wh:
rec = iwdl_brw.concept_id.property_retencion_islr_receivable
pay = iwdl_brw.concept_id.property_retencion_islr_payable
if inv_brw.type in ('out_invoice', 'out_refund'):
rec = iwdl_brw.concept_id.property_retencion_islr_receivable
pay = iwdl_brw.concept_id.property_retencion_islr_payable
acc = rec and rec.id or False
else:
acc = pay and pay.id or False
Expand Down
8 changes: 4 additions & 4 deletions l10n_ve_withholding_islr/test/customer_wh_islr_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
I check that the product that will be use have a concept.
-
!assert {model: product.product, id: product.product_product_4, string: The product not have a concept}:
- concept_id.id == islr_wh_concept_hprof_no_mercantiles
- concept_id.id == ref( 'islr_wh_concept_hprof_no_mercantiles' )
-
I check that the customer that will be use is an income withholding agent and is at Venezuela.
-
Expand Down Expand Up @@ -187,7 +187,7 @@
I check that the withholding document is withhout invoices.
-
!assert {model: islr.wh.doc, id: islr_no_lines_customer_wh_doc, string: The withholding document should be without invoices}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I try to confirm the withholding document. It won't be confirm.
-
Expand Down Expand Up @@ -221,7 +221,7 @@
I check that the withholding document is withhout invoices.
-
!assert {model: islr.wh.doc, id: islr_open_state_customer_wh_doc, string: The withholding document should be without invoices}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I create a customer invoice.
-
Expand Down Expand Up @@ -255,7 +255,7 @@
I check that the invoice was not added.
-
!assert {model: islr.wh.doc, id: islr_open_state_customer_wh_doc, string: The draft invoice was added and it should not.}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I confirm the invoice.
-
Expand Down
69 changes: 37 additions & 32 deletions l10n_ve_withholding_islr/test/supplier_wh_islr_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -347,13 +347,10 @@
I confirm the withholding document.
-
!python {model: islr.wh.doc}: |
inv_id = ref( 'islr_acctg_parnter_supplier_invoice' )
iwd_id = self.pool.get( 'account.invoice' ).browse(
cr, uid, inv_id).islr_wh_doc_id.id
from openerp import workflow
from openerp.osv import osv
wf_service = workflow
wf_service.trg_validate(uid, 'islr.wh.doc', iwd_id, 'act_confirm', cr)
invoice_id = ref( 'islr_acctg_parnter_supplier_invoice' )
islr_wh_doc = self.pool.get( 'account.invoice' ).browse(
cr, uid, invoice_id).islr_wh_doc_id
islr_wh_doc.signal_workflow('act_confirm')
-
I check that the withholding document was confirmed and have no moves.
-
Expand Down Expand Up @@ -487,13 +484,14 @@
-
I set company to process the withholding automaticly.
-
!record {model: res.company, id: base.main_company}:
automatic_income_wh: True
!python {model: res.company}: |
company_id = ref( 'base.main_company' )
self.write(cr, uid, company_id, {'automatic_income_wh': True})
-
I check that the company is correctly update.
-
!assert {model: res.partner, id: base.main_partner, string: The company is not correctly set.}:
- company_id.automatic_income_wh
!assert {model: res.company, id: base.main_company, string: The company is not correctly set.}:
- automatic_income_wh
-
I create an supplier invoice.
-
Expand Down Expand Up @@ -521,20 +519,22 @@
-
I revert the changes in the company.
-
!record {model: res.company, id: base.main_company}:
automatic_income_wh: False
!python {model: res.company}: |
company_id = ref( 'base.main_company' )
self.write(cr, uid, company_id, {'automatic_income_wh': False})
-
i check that the company is correctly update.
I check that the company is correctly update.
-
!assert {model: res.partner, id: base.main_partner, string: the company is not correctly set.}:
- not company_id.automatic_income_wh
!assert {model: res.company, id: base.main_company, string: The company is not correctly set.}:
- not automatic_income_wh
-
2.12 I check that when a not natural supplier is a society of natural persons it will be treat as a natural person.
-
I set the supplier as a society of natural persons.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
spn: True
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'spn': True})
-
I check that the supplier was correctly updated.
-
Expand Down Expand Up @@ -575,8 +575,9 @@
-
I revert the changes on the supplier.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
spn: false
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'spn': False})
-
I check that the supplier was correctly updated.
-
Expand All @@ -587,8 +588,9 @@
-
I set the supplier as an income exempt.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
islr_exempt: True
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'islr_exempt': True})
-
I check that the supplier was correctly updated.
-
Expand Down Expand Up @@ -622,8 +624,9 @@
-
I revert the changes on the supplier.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
islr_exempt: False
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'islr_exempt': False})
-
I check that the supplier was correctly updated.
-
Expand All @@ -634,8 +637,9 @@
-
I set the supplier as an income exempt.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
islr_exempt: True
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'islr_exempt': True})
-
I check that the supplier was correctly updated.
-
Expand Down Expand Up @@ -688,8 +692,9 @@
-
I revert the changes on the supplier.
-
!record {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1}:
islr_exempt: False
!python {model: res.partner}: |
partner_id = ref( 'l10n_ve_fiscal_requirements.f_req_partner_1' )
self.write(cr, uid, partner_id, {'islr_exempt': False})
-
I check that the supplier was correctly updated.
-
Expand Down Expand Up @@ -797,7 +802,7 @@
I check that the withholding document is withhout invoices.
-
!assert {model: islr.wh.doc, id: islr_open_state_supplier_wh_doc, string: The withholding document should be without invoices.}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I create a supplier invoice.
-
Expand Down Expand Up @@ -832,7 +837,7 @@
I check that the invoice was not added.
-
!assert {model: islr.wh.doc, id: islr_open_state_supplier_wh_doc, string: The draft invoice was added and it should not.}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I confirm the invoice.
-
Expand Down Expand Up @@ -875,7 +880,7 @@
I check that the withholding document is withhout invoices.
-
!assert {model: islr.wh.doc, id: islr_no_lines_supplier_wh_doc, string: The withholding document should be without invoices}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I try to confirm the withholding document. It won't be confirm.
-
Expand Down Expand Up @@ -947,7 +952,7 @@
I check that the withholding document is withhout invoices.
-
!assert {model: islr.wh.doc, id: islr_manual_supplier_wh_doc, string: The withholding document should be without invoices}:
- invoice_ids == []
- len(invoice_ids) == 0
-
I add the invoice to the withholding document.
-
Expand Down

0 comments on commit ac6c809

Please sign in to comment.