Skip to content

Commit

Permalink
[REF] l10n_ve_fiscal_requirements: VAT Mandatory Constraint is now en…
Browse files Browse the repository at this point in the history
…abled for fields country_id and vat
  • Loading branch information
suniagajose committed Dec 17, 2015
1 parent a479e79 commit 3e14d32
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 54 deletions.
3 changes: 2 additions & 1 deletion l10n_ve_fiscal_requirements/model/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ def _validate(self, cr, uid, ids, context=None):

_constraints = [
(_check_vat_mandatory,
_("Error ! VAT is mandatory in the Accounting Partner"), []),
_("Error ! VAT is mandatory in the Accounting Partner"),
['country_id', 'vat']),
(_check_vat_uniqueness,
_("Error ! Partner's VAT must be a unique value or empty"), []),
# (_check_partner_invoice_addr,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<!--Concepts
Just adding accounts to concepts to be able to execute the withholding
-->
<!--
<record id="islr_wh_concept_hprof_no_mercantiles" model="islr.wh.concept">
<field name="property_retencion_islr_payable" ref="islr_pay"/>
<field name="property_retencion_islr_receivable" ref="islr_rec"/>
Expand Down Expand Up @@ -191,7 +192,7 @@
<field name="property_retencion_islr_payable" ref="islr_pay"/>
<field name="property_retencion_islr_receivable" ref="islr_rec"/>
</record>

-->
<!-- Sequence -->
<record id="seq_wh_islr_purchase_type" model="ir.sequence.type">
<field name="name">Retencion de ISLR Compra</field>
Expand All @@ -218,19 +219,17 @@
<field name="padding">6</field>
<field name="number_increment">1</field>
</record>
_

<!--
Product
-->

<record id="product.product_product_4" model="product.product">
<field name="concept_id" ref="islr_wh_concept_hprof_no_mercantiles"/>
</record>

<!--
Journal
-->

<record id="withholding_purchase_journal" model="account.journal">
<field name="name">DIARIO DE ISLR COMPRA</field>
<field name="code">ISLR1</field>
Expand Down
60 changes: 42 additions & 18 deletions l10n_ve_withholding_islr/test/customer_wh_islr_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,58 @@
assert len(iwc_ids) == 1, ( 'Only can be defined one non-withhodeable'
' concepts, but %s are defined.' % (len(iwc_ids), ))
-
I check that all the withholdable concepts have accounts type 'other' associtated and also have mandatory income rates.
I set accounts for concept 'Honorarios Profesionales No Mercantiles'
-
!python {model: islr.wh.concept}: |
iwc_ids = self.search(cr, uid, [( 'withholdable', '=', True )])
for iwc_brw in self.browse(cr, uid, iwc_ids):
assert iwc_brw.rate_ids, 'All the withholdable concepts need to have rates associated'
assert iwc_brw.property_retencion_islr_payable, 'All the withholdable concepts need to have an income withholding purchase acc set.'
assert iwc_brw.property_retencion_islr_payable.type == 'other', 'All the withholdable concepts need to have an income withholding purchase acc of type other.'
assert iwc_brw.property_retencion_islr_receivable, 'All the withholdable concepts need to have an income withholding sale acc set.'
assert iwc_brw.property_retencion_islr_receivable.type == 'other', 'All the withholdable concepts need to have an income withholding sale acc of type other.'

-
I check that the concept that will be use is withhodable.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not withholdable}:
concept_id = ref( 'islr_wh_concept_hprof_no_mercantiles' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I set accounts for concept 'NO APLICA RETENCION'
-
!python {model: islr.wh.concept}: |
concept_id = ref( 'islr_wh_concept_no_apply_withholding' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I check that the concept 'Honorarios Profesionales No Mercantiles' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not properly configured}:
- withholdable
- rate_ids
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
-
I check that the concept 'NO APLICA RETENCION' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_no_apply_withholding, string: The income concept is not properly configured}:
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
- withholdable == False
-
I check that the product that will be use have a concept.
-
!assert {model: product.product, id: product.product_product_4, string: Have not a concept.}:
- concept_id.id == ref( 'islr_wh_concept_hprof_no_mercantiles' )
!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
-
I check that the customer that will be use is an income withholding agent and is at Venezuela.
-
!assert {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1, string: The customer is not correctly set for this test.}:
- islr_withholding_agent
- country_id.code == 'VE'
- vat
- islr_withholding_agent
- country_id.code == 'VE'
- vat
-
I check if the account that will be use is of receivable type.
-
Expand Down
102 changes: 84 additions & 18 deletions l10n_ve_withholding_islr/test/supplier_wh_islr_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,100 @@
assert len(iwc_ids) == 1, ( 'Only can be defined one non-withhodeable'
' concepts, but %s are defined.' % (len(iwc_ids), ))
-
I check that all the withholdable concepts have accounts type 'other'
associtated and also have mandatory income rates.
I set accounts for concept 'Honorarios Profesionales No Mercantiles'
-
!python {model: islr.wh.concept}: |
iwc_ids = self.search(cr, uid, [( 'withholdable', '=', True )])
for iwc_brw in self.browse(cr, uid, iwc_ids):
assert iwc_brw.rate_ids, 'All the withholdable concepts need to have rates associated'
assert iwc_brw.property_retencion_islr_payable, 'All the withholdable concepts need to have an income withholding purchase acc set.'
assert iwc_brw.property_retencion_islr_payable.type == 'other', 'All the withholdable concepts need to have an income withholding purchase acc of type other.'
assert iwc_brw.property_retencion_islr_receivable, 'All the withholdable concepts need to have an income withholding sale acc set.'
assert iwc_brw.property_retencion_islr_receivable.type == 'other', 'All the withholdable concepts need to have an income withholding sale acc of type other.'
concept_id = ref( 'islr_wh_concept_hprof_no_mercantiles' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I check that the supplier that will be use is income withholdable.
I set accounts for concept 'Pagos a Empresas Contratistas o Subcontratistas...'
-
!assert {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1, string: The supplier is not correctly set for this test.}:
- islr_withholding_agent
- country_id.code == 'VE'
- vat
!python {model: islr.wh.concept}: |
concept_id = ref( 'islr_wh_concept_pago_contratistas' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I set accounts for concept 'NO APLICA RETENCION'
-
I check that the concept that will be use is withhodable.
!python {model: islr.wh.concept}: |
concept_id = ref( 'islr_wh_concept_no_apply_withholding' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I set accounts for concept 'Cualquier otra Comision distintas a ...'
-
!python {model: islr.wh.concept}: |
concept_id = ref( 'islr_wh_concept_cualquie_cosa_menos_sueldos' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I check that the concept 'Honorarios Profesionales No Mercantiles' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not withholdable}:
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not properly configured}:
- withholdable
- rate_ids
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
-
I check that the concept 'Pagos a Empresas Contratistas o Subcontratistas...' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_pago_contratistas, string: The income concept is not properly configured}:
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
- withholdable
- rate_ids
-
I check that the concept 'NO APLICA RETENCION' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_no_apply_withholding, string: The income concept is not properly configured}:
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
- withholdable == False
-
I check that the concept 'Cualquier otra Comision distintas a...' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_cualquie_cosa_menos_sueldos, string: The income concept is not properly configured}:
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
- withholdable
- rate_ids
-
I check that the supplier that will be use is income withholdable.
-
!assert {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1, string: The supplier is not correctly set for this test.}:
- islr_withholding_agent
- country_id.code == 'VE'
- vat
-
I check that the product that will be use have a concept.
-
!assert {model: product.product, id: product.product_product_4, string: Have not a concept.}:
- concept_id
!assert {model: product.product, id: product.product_product_4, string: The product not have a concept}:
- concept_id.id == ref( 'islr_wh_concept_hprof_no_mercantiles' )
-
2.2 I check that one invoice only creates a single one withholding line.
-
Expand Down
50 changes: 37 additions & 13 deletions l10n_ve_withholding_islr/test/supplier_wh_islr_invoice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,56 @@
assert len(iwc_ids) == 1, ( 'Only can be defined one non-withhodeable'
' concepts, but %s are defined.' % (len(iwc_ids), ))
-
I check that all the withholdable concepts have accounts type 'other' associtated and also have mandatory income rates.
I set accounts for concept 'Honorarios Profesionales No Mercantiles'
-
!python {model: islr.wh.concept}: |
iwc_ids = self.search(cr, uid, [( 'withholdable', '=', True )])
for iwc_brw in self.browse(cr, uid, iwc_ids):
assert iwc_brw.rate_ids, 'All the withholdable concepts need to have rates associated'
assert iwc_brw.property_retencion_islr_payable, 'All the withholdable concepts need to have an income withholding purchase acc set.'
assert iwc_brw.property_retencion_islr_payable.type == 'other', 'All the withholdable concepts need to have an income withholding purchase acc of type other.'
assert iwc_brw.property_retencion_islr_receivable, 'All the withholdable concepts need to have an income withholding sale acc set.'
assert iwc_brw.property_retencion_islr_receivable.type == 'other', 'All the withholdable concepts need to have an income withholding sale acc of type other.'
concept_id = ref( 'islr_wh_concept_hprof_no_mercantiles' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I set accounts for concept 'NO APLICA RETENCION'
-
!python {model: islr.wh.concept}: |
concept_id = ref( 'islr_wh_concept_no_apply_withholding' )
islr_pay_id = ref( 'islr_pay' )
islr_rec_id = ref( 'islr_rec' )
self.write(cr, uid, concept_id, {
'property_retencion_islr_payable': islr_pay_id,
'property_retencion_islr_receivable': islr_rec_id,
})
-
I check that the supplier that will be use exist and is correctly set for this test.
-
!assert {model: res.partner, id: l10n_ve_fiscal_requirements.f_req_partner_1, string: The supplier is not correctly set for this test.}:
- country_id.code == 'VE'
- vat
-
I check that the concept that will be use is withhodable.
I check that the concept 'Honorarios Profesionales No Mercantiles' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not withholdable}:
!assert {model: islr.wh.concept, id: islr_wh_concept_hprof_no_mercantiles, string: The income concept is not properly configured}:
- withholdable
- rate_ids
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
-
I check that the concept 'NO APLICA RETENCION' is properly configured.
-
!assert {model: islr.wh.concept, id: islr_wh_concept_no_apply_withholding, string: The income concept is not properly configured}:
- property_retencion_islr_payable
- property_retencion_islr_payable.type == 'other'
- property_retencion_islr_receivable
- property_retencion_islr_receivable.type == 'other'
- withholdable == False
-
I check that the product that will be use have the withholdable concept.
-
!assert {model: product.product, id: product.product_product_4, string: Have not a concept.}:
- concept_id
!assert {model: product.product, id: product.product_product_4, string: The product not have a concept}:
- concept_id.id == ref( 'islr_wh_concept_hprof_no_mercantiles' )
-
1.2 I check that a withholding document is created when the invoice have a withholdable concept (at the invoice line product).
Expand All @@ -73,7 +97,7 @@
price_unit: 30000
account_id: account.a_pay
# concept_id: islr_wh_concept_hprof_no_mercantiles # (already in product)
-
-
I check that the invoice was correctly created.
-
!assert {model: account.invoice, id: islr_withholdable_supplier_invoice, string: The invoice was not correctly created}:
Expand Down

0 comments on commit 3e14d32

Please sign in to comment.