Merge lp:~vauxoo/openerp-venezuela-localization/truiz-yml-1068950 into lp:openerp-venezuela-localization/6.1

Proposed by Tulio Ruiz (Vauxoo)
Status: Merged
Approved by: Nhomar - Vauxoo
Approved revision: 767
Merged at revision: 760
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/truiz-yml-1068950
Merge into: lp:openerp-venezuela-localization/6.1
Diff against target: 298 lines (+159/-17)
8 files modified
l10n_ve_fiscal_reports_V3/invoice.py (+4/-4)
l10n_ve_withholding_islr/__openerp__.py (+2/-0)
l10n_ve_withholding_islr/invoice.py (+5/-5)
l10n_ve_withholding_islr/test/test.yml (+6/-6)
l10n_ve_withholding_islr/test/test_duplicate.yml (+70/-0)
l10n_ve_withholding_islr/test/test_notax.yml (+64/-0)
l10n_ve_withholding_islr/test/test_sale.yml (+2/-2)
l10n_ve_withholding_iva/test/iva_sale_wh.yml (+6/-0)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/truiz-yml-1068950
Reviewer Review Type Date Requested Status
Nhomar - Vauxoo Approve
Gabriela Quilarque Pending
OpenERP para localizaciĆ³n Venezolana. Pending
Review via email: mp+130904@code.launchpad.net

Description of the change

Fix bug 1068950
Added some additionals tests: duplicates customer invoices and calculates wh again

To post a comment you must log in.
Revision history for this message
Nhomar - Vauxoo (nhomar) wrote :

@tulio puedes ejecutar el merge por favor.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_ve_fiscal_reports_V3/invoice.py'
--- l10n_ve_fiscal_reports_V3/invoice.py 2012-09-25 15:35:35 +0000
+++ l10n_ve_fiscal_reports_V3/invoice.py 2012-10-22 21:07:24 +0000
@@ -99,7 +99,7 @@
99 ret.update({r.id: r.partner_id.name})99 ret.update({r.id: r.partner_id.name})
100 return ret100 return ret
101101
102 def _get_number(self,cr,uid,ids,name,args,context=None):102 def _get_inv_number(self,cr,uid,ids,name,args,context=None):
103 '''103 '''
104 Get Invoice Number104 Get Invoice Number
105 '''105 '''
@@ -267,7 +267,7 @@
267 ret.update({r.id : amount})267 ret.update({r.id : amount})
268 return ret268 return ret
269 269
270 def _get_tax_line(self, s):270 def _get_inv_tax_line(self, s):
271 '''271 '''
272 Get Tax Line272 Get Tax Line
273 '''273 '''
@@ -499,7 +499,7 @@
499 help=""), 499 help=""),
500 'get_partner_vat': fields.function(_get_vat, method=True, string='Partner vat', type='char',500 'get_partner_vat': fields.function(_get_vat, method=True, string='Partner vat', type='char',
501 help=""),501 help=""),
502 'get_reference': fields.function(_get_number, method=True, string='Invoice number', type='char',502 'get_reference': fields.function(_get_inv_number, method=True, string='Invoice number', type='char',
503 help=""),503 help=""),
504 'get_number': fields.function(_get_control_number, method=True, string='Control number', type='char',504 'get_number': fields.function(_get_control_number, method=True, string='Control number', type='char',
505 help=""),505 help=""),
@@ -517,7 +517,7 @@
517 help=""),517 help=""),
518 'get_v_exent': fields.function(_get_v_exent, method=True, string='Amount excempt', type='float',518 'get_v_exent': fields.function(_get_v_exent, method=True, string='Amount excempt', type='float',
519 help=""),519 help=""),
520 'get_tax_line': fields.function(_get_tax_line, method=True, string='Tax line', type='char',520 'get_tax_line': fields.function(_get_inv_tax_line, method=True, string='Tax line', type='char',
521 help=""),521 help=""),
522# 'get_parent': fields.function(_get_parent, method=True, string='kind of document', type='char',522# 'get_parent': fields.function(_get_parent, method=True, string='kind of document', type='char',
523# help=""),523# help=""),
524524
=== modified file 'l10n_ve_withholding_islr/__openerp__.py'
--- l10n_ve_withholding_islr/__openerp__.py 2012-10-02 22:39:00 +0000
+++ l10n_ve_withholding_islr/__openerp__.py 2012-10-22 21:07:24 +0000
@@ -68,6 +68,8 @@
68 'test': [68 'test': [
69 'test/test.yml',69 'test/test.yml',
70 'test/test_sale.yml',70 'test/test_sale.yml',
71 'test/test_notax.yml',
72 'test/test_duplicate.yml',
71 ],73 ],
72 "active": False,74 "active": False,
73 "installable": True75 "installable": True
7476
=== modified file 'l10n_ve_withholding_islr/invoice.py'
--- l10n_ve_withholding_islr/invoice.py 2012-10-02 19:06:23 +0000
+++ l10n_ve_withholding_islr/invoice.py 2012-10-22 21:07:24 +0000
@@ -238,15 +238,15 @@
238 '''238 '''
239 Returns a dictionary with the rate of each withholding concept.239 Returns a dictionary with the rate of each withholding concept.
240 '''240 '''
241 dict = {}241 dictd = {}
242 cont = 0242 cont = 0
243 for concept_id in concept_list:243 for concept_id in concept_list:
244 dict[concept_id] = self._get_rate(cr, uid, concept_id, residence, nature,context)244 dictd[concept_id] = self._get_rate(cr, uid, concept_id, residence, nature,context)
245 if dict[concept_id]:245 if dictd[concept_id]:
246 cont += 1246 cont += 1
247 if not cont:247 if not cont:
248 raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the Concept of Withholding associated with type line is not withheld!"))248 raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the Concept of Withholding associated with the line has not rate for the type of customer!"))
249 return dict249 return dictd
250250
251251
252 def _pop_dict(self,cr,uid,concept_list,dict_rate,wh_dict):252 def _pop_dict(self,cr,uid,concept_list,dict_rate,wh_dict):
253253
=== modified file 'l10n_ve_withholding_islr/test/test.yml'
--- l10n_ve_withholding_islr/test/test.yml 2012-09-28 23:03:37 +0000
+++ l10n_ve_withholding_islr/test/test.yml 2012-10-22 21:07:24 +0000
@@ -43,27 +43,27 @@
43 date_invoice: !eval time.strftime('%Y-%m-%d')43 date_invoice: !eval time.strftime('%Y-%m-%d')
44 address_contact_id: base.res_partner_address_344 address_contact_id: base.res_partner_address_3
45 address_invoice_id: base.res_partner_address_345 address_invoice_id: base.res_partner_address_3
46 account_id: account.a_recv46 account_id: account.a_expense
47 invoice_line:47 invoice_line:
48 - product_id: product.product_product_pc348 - product_id: product.product_product_pc3
49 quantity: 549 quantity: 5
50 uos_id: product.product_uom_unit50 uos_id: product.product_uom_unit
51 price_unit: 100051 price_unit: 1000
52 name: islrprod0152 name: islrprod01
53 account_id: account.a_sale53 account_id: account.a_expense
54 concept_id: islr_wh_concept_demo254 concept_id: islr_wh_concept_demo2
55 invoice_line_tax_id:55 invoice_line_tax_id:
56 - account.tax1056 - l10n_ve_fiscal_requirements.iva_purchase1
57 - product_id: product.product_product_pc457 - product_id: product.product_product_pc4
58 quantity: 558 quantity: 5
59 uos_id: product.product_uom_unit59 uos_id: product.product_uom_unit
60 price_unit: 200060 price_unit: 2000
61 name: islrprod0261 name: islrprod02
62 concept_id: islr_wh_concept_demo262 concept_id: islr_wh_concept_demo2
63 account_id: account.a_sale63 account_id: account.a_expense
64 invoice_line_tax_id:64 invoice_line_tax_id:
65 - account.tax1065 - l10n_ve_fiscal_requirements.iva_purchase1
66 journal_id: account.sales_journal66 journal_id: account.expenses_journal
67 partner_id: base.res_partner_notsotinysarl067 partner_id: base.res_partner_notsotinysarl0
68 nro_ctrl: islr12368 nro_ctrl: islr123
69 reference: isrlref12369 reference: isrlref123
7070
=== added file 'l10n_ve_withholding_islr/test/test_duplicate.yml'
--- l10n_ve_withholding_islr/test/test_duplicate.yml 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_islr/test/test_duplicate.yml 2012-10-22 21:07:24 +0000
@@ -0,0 +1,70 @@
1-
2 3 . Test duplacate invoice with withholding
3-
4 3.1 Check if invoice was created in previous tests and has a wh document
5-
6 !assert {model: account.invoice, id: islr_inv01}:
7 - id
8 - islr_wh_doc_id.id
9-
10 3.2 Duplicate the invoice from an open invoice
11-
12 !python {model: account.invoice}: |
13 import netsvc
14 default = {'islr_wh_doc_id': 0}
15 context = {'lang': 'en_US',
16 'tz': False,
17 'uid': uid,
18 'journal_type': 'sale',
19 'default_type': 'out_invoice',
20 'type': 'out_invoice'}
21 invoice_id = self.copy(cr, uid, ref("islr_inv01"), default=None, context=None)
22 assert invoice_id, "Invoice was not duplicated (should)"
23 self.write(cr, uid, [invoice_id],
24 {'journal_id': ref("account.expenses_journal"),
25 'nro_ctrl':'DUPLINV00',
26 'reference':'110011'})
27 acc_brw=self.browse(cr, uid, invoice_id)
28 self.button_reset_taxes(cr, uid, [invoice_id])
29 # update check total
30 self.write(cr, uid, [invoice_id],
31 {'check_total': 16800.0})
32 wf = netsvc.LocalService("workflow")
33 wf.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
34-
35 3 . Test duplacate invoice w/o taxes asociated
36-
37 3.1 Check if invoice was created in previous tests and has a wh document
38-
39 !assert {model: account.invoice, id: islr_inv03}:
40 - id
41 - islr_wh_doc_id.id
42-
43 3.2 Duplicate the invoice from an open invoice
44-
45 !python {model: account.invoice}: |
46 import netsvc
47 default = {'islr_wh_doc_id': 0}
48 context = {'lang': 'en_US',
49 'tz': False,
50 'uid': uid,
51 'journal_type': 'purchase',
52 'default_type': 'out_invoice',
53 'type': 'out_invoice'}
54 invoice_id = self.copy(cr, uid, ref("islr_inv03"), default=None, context=None)
55 assert invoice_id, "Invoice was not duplicated (should)"
56 self.write(cr, uid, [invoice_id],
57 {'journal_id': ref("account.expenses_journal"),
58 'nro_ctrl':'DUPLINV00NOTAX',
59 'reference':'110011NOTAX'})
60 acc_brw=self.browse(cr, uid, invoice_id)
61 self.button_reset_taxes(cr, uid, [invoice_id])
62 # update check total
63 self.write(cr, uid, [invoice_id],
64 {'check_total': 16800.0})
65 wf = netsvc.LocalService("workflow")
66 wf.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
67
68
69
70
071
=== added file 'l10n_ve_withholding_islr/test/test_notax.yml'
--- l10n_ve_withholding_islr/test/test_notax.yml 1970-01-01 00:00:00 +0000
+++ l10n_ve_withholding_islr/test/test_notax.yml 2012-10-22 21:07:24 +0000
@@ -0,0 +1,64 @@
1-
2 4. Test a purchase invoice w/o taxes in invoice lines
3-
4 4.1 I create a purchase invoice
5-
6 !record {model: account.invoice, id: islr_inv03}:
7 company_id: base.main_company
8 currency_id: base.EUR
9 date_invoice: !eval time.strftime('%Y-%m-%d')
10 address_contact_id: base.res_partner_address_3
11 address_invoice_id: base.res_partner_address_3
12 account_id: account.a_expense
13 invoice_line:
14 - product_id: product.product_product_pc3
15 quantity: 5
16 uos_id: product.product_uom_unit
17 price_unit: 1000
18 name: islrprod01_notax
19 account_id: account.a_expense
20 concept_id: islr_wh_concept_demo2
21 - product_id: product.product_product_pc4
22 quantity: 5
23 uos_id: product.product_uom_unit
24 price_unit: 2000
25 name: islrprod02_notax
26 concept_id: islr_wh_concept_demo2
27 account_id: account.a_expense
28 journal_id: account.expenses_journal
29 partner_id: l10n_ve_fiscal_requirements.f_req_partner_10
30 nro_ctrl: islr123NOTAX
31 reference: isrlref123NOTAX
32 type: in_invoice
33-
34 4.2 I click on Calculate taxes button
35-
36 !python {model: account.invoice}: |
37 acc_brw=self.browse(cr, uid, ref("islr_inv03"))
38 self.button_reset_taxes(cr, uid, [ref("islr_inv03")])
39-
40 4.3 I update check total before validating the invoice
41-
42 !record {model: account.invoice, id: islr_inv03}:
43 check_total: 16800.0
44-
45 4.4 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
46-
47 !workflow {model: account.invoice, action: invoice_proforma2, ref: islr_inv03}
48-
49 4.5 I create invoice by clicking on Create button
50-
51 !workflow {model: account.invoice, action: invoice_open, ref: islr_inv03}
52-
53 4.6 I check that the invoice has any wh doc (must have)
54-
55 !assert {model: account.invoice, id: islr_inv03}:
56 - islr_wh_doc_id.id
57-
58 4.7 Search for the wh lines
59-
60 !python {model: account.invoice}: |
61 import netsvc
62 import time
63 ai_brw = self.browse(cr, uid, ref("islr_inv03"))
64 assert ai_brw.islr_wh_doc_id.amount_total_ret == 222.3, "Bad value for retention amount"
065
=== modified file 'l10n_ve_withholding_islr/test/test_sale.yml'
--- l10n_ve_withholding_islr/test/test_sale.yml 2012-09-28 23:12:21 +0000
+++ l10n_ve_withholding_islr/test/test_sale.yml 2012-10-22 21:07:24 +0000
@@ -19,7 +19,7 @@
19 account_id: account.a_sale19 account_id: account.a_sale
20 concept_id: islr_wh_concept_demo220 concept_id: islr_wh_concept_demo2
21 invoice_line_tax_id:21 invoice_line_tax_id:
22 - account.tax1022 - l10n_ve_fiscal_requirements.iva_sale1
23 - product_id: product.product_product_pc423 - product_id: product.product_product_pc4
24 quantity: 524 quantity: 5
25 uos_id: product.product_uom_unit25 uos_id: product.product_uom_unit
@@ -28,7 +28,7 @@
28 concept_id: islr_wh_concept_demo228 concept_id: islr_wh_concept_demo2
29 account_id: account.a_sale29 account_id: account.a_sale
30 invoice_line_tax_id:30 invoice_line_tax_id:
31 - account.tax1031 - l10n_ve_fiscal_requirements.iva_sale1
32 journal_id: account.sales_journal32 journal_id: account.sales_journal
33 partner_id: base.res_partner_notsotinysarl033 partner_id: base.res_partner_notsotinysarl0
34 nro_ctrl: islr45634 nro_ctrl: islr456
3535
=== modified file 'l10n_ve_withholding_iva/test/iva_sale_wh.yml'
--- l10n_ve_withholding_iva/test/iva_sale_wh.yml 2012-09-27 16:23:18 +0000
+++ l10n_ve_withholding_iva/test/iva_sale_wh.yml 2012-10-22 21:07:24 +0000
@@ -111,6 +111,12 @@
111 ap_obj=self.pool.get('account.period')111 ap_obj=self.pool.get('account.period')
112 period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})112 period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})
113 assert period, 'There aren\'t periods for this date'113 assert period, 'There aren\'t periods for this date'
114 ap_brw = ap.browse(cr, uid, period[0])
115 if ap_brw.state == 'done':
116 ap.action_draft(cr, uid, period)
117 ap_brw = ap.browse(cr, uid, period[0])
118 assert ap_brw.state == 'draft', 'Period is not open as it should be'
119
114 self.write(cr, uid, ref("wh_iva_sale01"), {'period_id':period[0]})120 self.write(cr, uid, ref("wh_iva_sale01"), {'period_id':period[0]})
115-121-
116 7.14 I check period was modificated122 7.14 I check period was modificated

Subscribers

People subscribed via source and target branches