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
1=== modified file 'l10n_ve_fiscal_reports_V3/invoice.py'
2--- l10n_ve_fiscal_reports_V3/invoice.py 2012-09-25 15:35:35 +0000
3+++ l10n_ve_fiscal_reports_V3/invoice.py 2012-10-22 21:07:24 +0000
4@@ -99,7 +99,7 @@
5 ret.update({r.id: r.partner_id.name})
6 return ret
7
8- def _get_number(self,cr,uid,ids,name,args,context=None):
9+ def _get_inv_number(self,cr,uid,ids,name,args,context=None):
10 '''
11 Get Invoice Number
12 '''
13@@ -267,7 +267,7 @@
14 ret.update({r.id : amount})
15 return ret
16
17- def _get_tax_line(self, s):
18+ def _get_inv_tax_line(self, s):
19 '''
20 Get Tax Line
21 '''
22@@ -499,7 +499,7 @@
23 help=""),
24 'get_partner_vat': fields.function(_get_vat, method=True, string='Partner vat', type='char',
25 help=""),
26- 'get_reference': fields.function(_get_number, method=True, string='Invoice number', type='char',
27+ 'get_reference': fields.function(_get_inv_number, method=True, string='Invoice number', type='char',
28 help=""),
29 'get_number': fields.function(_get_control_number, method=True, string='Control number', type='char',
30 help=""),
31@@ -517,7 +517,7 @@
32 help=""),
33 'get_v_exent': fields.function(_get_v_exent, method=True, string='Amount excempt', type='float',
34 help=""),
35- 'get_tax_line': fields.function(_get_tax_line, method=True, string='Tax line', type='char',
36+ 'get_tax_line': fields.function(_get_inv_tax_line, method=True, string='Tax line', type='char',
37 help=""),
38 # 'get_parent': fields.function(_get_parent, method=True, string='kind of document', type='char',
39 # help=""),
40
41=== modified file 'l10n_ve_withholding_islr/__openerp__.py'
42--- l10n_ve_withholding_islr/__openerp__.py 2012-10-02 22:39:00 +0000
43+++ l10n_ve_withholding_islr/__openerp__.py 2012-10-22 21:07:24 +0000
44@@ -68,6 +68,8 @@
45 'test': [
46 'test/test.yml',
47 'test/test_sale.yml',
48+ 'test/test_notax.yml',
49+ 'test/test_duplicate.yml',
50 ],
51 "active": False,
52 "installable": True
53
54=== modified file 'l10n_ve_withholding_islr/invoice.py'
55--- l10n_ve_withholding_islr/invoice.py 2012-10-02 19:06:23 +0000
56+++ l10n_ve_withholding_islr/invoice.py 2012-10-22 21:07:24 +0000
57@@ -238,15 +238,15 @@
58 '''
59 Returns a dictionary with the rate of each withholding concept.
60 '''
61- dict = {}
62+ dictd = {}
63 cont = 0
64 for concept_id in concept_list:
65- dict[concept_id] = self._get_rate(cr, uid, concept_id, residence, nature,context)
66- if dict[concept_id]:
67+ dictd[concept_id] = self._get_rate(cr, uid, concept_id, residence, nature,context)
68+ if dictd[concept_id]:
69 cont += 1
70 if not cont:
71- raise osv.except_osv(_('Invalid action !'),_("Impossible withholding income, because the Concept of Withholding associated with type line is not withheld!"))
72- return dict
73+ 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!"))
74+ return dictd
75
76
77 def _pop_dict(self,cr,uid,concept_list,dict_rate,wh_dict):
78
79=== modified file 'l10n_ve_withholding_islr/test/test.yml'
80--- l10n_ve_withholding_islr/test/test.yml 2012-09-28 23:03:37 +0000
81+++ l10n_ve_withholding_islr/test/test.yml 2012-10-22 21:07:24 +0000
82@@ -43,27 +43,27 @@
83 date_invoice: !eval time.strftime('%Y-%m-%d')
84 address_contact_id: base.res_partner_address_3
85 address_invoice_id: base.res_partner_address_3
86- account_id: account.a_recv
87+ account_id: account.a_expense
88 invoice_line:
89 - product_id: product.product_product_pc3
90 quantity: 5
91 uos_id: product.product_uom_unit
92 price_unit: 1000
93 name: islrprod01
94- account_id: account.a_sale
95+ account_id: account.a_expense
96 concept_id: islr_wh_concept_demo2
97 invoice_line_tax_id:
98- - account.tax10
99+ - l10n_ve_fiscal_requirements.iva_purchase1
100 - product_id: product.product_product_pc4
101 quantity: 5
102 uos_id: product.product_uom_unit
103 price_unit: 2000
104 name: islrprod02
105 concept_id: islr_wh_concept_demo2
106- account_id: account.a_sale
107+ account_id: account.a_expense
108 invoice_line_tax_id:
109- - account.tax10
110- journal_id: account.sales_journal
111+ - l10n_ve_fiscal_requirements.iva_purchase1
112+ journal_id: account.expenses_journal
113 partner_id: base.res_partner_notsotinysarl0
114 nro_ctrl: islr123
115 reference: isrlref123
116
117=== added file 'l10n_ve_withholding_islr/test/test_duplicate.yml'
118--- l10n_ve_withholding_islr/test/test_duplicate.yml 1970-01-01 00:00:00 +0000
119+++ l10n_ve_withholding_islr/test/test_duplicate.yml 2012-10-22 21:07:24 +0000
120@@ -0,0 +1,70 @@
121+-
122+ 3 . Test duplacate invoice with withholding
123+-
124+ 3.1 Check if invoice was created in previous tests and has a wh document
125+-
126+ !assert {model: account.invoice, id: islr_inv01}:
127+ - id
128+ - islr_wh_doc_id.id
129+-
130+ 3.2 Duplicate the invoice from an open invoice
131+-
132+ !python {model: account.invoice}: |
133+ import netsvc
134+ default = {'islr_wh_doc_id': 0}
135+ context = {'lang': 'en_US',
136+ 'tz': False,
137+ 'uid': uid,
138+ 'journal_type': 'sale',
139+ 'default_type': 'out_invoice',
140+ 'type': 'out_invoice'}
141+ invoice_id = self.copy(cr, uid, ref("islr_inv01"), default=None, context=None)
142+ assert invoice_id, "Invoice was not duplicated (should)"
143+ self.write(cr, uid, [invoice_id],
144+ {'journal_id': ref("account.expenses_journal"),
145+ 'nro_ctrl':'DUPLINV00',
146+ 'reference':'110011'})
147+ acc_brw=self.browse(cr, uid, invoice_id)
148+ self.button_reset_taxes(cr, uid, [invoice_id])
149+ # update check total
150+ self.write(cr, uid, [invoice_id],
151+ {'check_total': 16800.0})
152+ wf = netsvc.LocalService("workflow")
153+ wf.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
154+-
155+ 3 . Test duplacate invoice w/o taxes asociated
156+-
157+ 3.1 Check if invoice was created in previous tests and has a wh document
158+-
159+ !assert {model: account.invoice, id: islr_inv03}:
160+ - id
161+ - islr_wh_doc_id.id
162+-
163+ 3.2 Duplicate the invoice from an open invoice
164+-
165+ !python {model: account.invoice}: |
166+ import netsvc
167+ default = {'islr_wh_doc_id': 0}
168+ context = {'lang': 'en_US',
169+ 'tz': False,
170+ 'uid': uid,
171+ 'journal_type': 'purchase',
172+ 'default_type': 'out_invoice',
173+ 'type': 'out_invoice'}
174+ invoice_id = self.copy(cr, uid, ref("islr_inv03"), default=None, context=None)
175+ assert invoice_id, "Invoice was not duplicated (should)"
176+ self.write(cr, uid, [invoice_id],
177+ {'journal_id': ref("account.expenses_journal"),
178+ 'nro_ctrl':'DUPLINV00NOTAX',
179+ 'reference':'110011NOTAX'})
180+ acc_brw=self.browse(cr, uid, invoice_id)
181+ self.button_reset_taxes(cr, uid, [invoice_id])
182+ # update check total
183+ self.write(cr, uid, [invoice_id],
184+ {'check_total': 16800.0})
185+ wf = netsvc.LocalService("workflow")
186+ wf.trg_validate(uid, 'account.invoice', invoice_id, 'invoice_open', cr)
187+
188+
189+
190+
191
192=== added file 'l10n_ve_withholding_islr/test/test_notax.yml'
193--- l10n_ve_withholding_islr/test/test_notax.yml 1970-01-01 00:00:00 +0000
194+++ l10n_ve_withholding_islr/test/test_notax.yml 2012-10-22 21:07:24 +0000
195@@ -0,0 +1,64 @@
196+-
197+ 4. Test a purchase invoice w/o taxes in invoice lines
198+-
199+ 4.1 I create a purchase invoice
200+-
201+ !record {model: account.invoice, id: islr_inv03}:
202+ company_id: base.main_company
203+ currency_id: base.EUR
204+ date_invoice: !eval time.strftime('%Y-%m-%d')
205+ address_contact_id: base.res_partner_address_3
206+ address_invoice_id: base.res_partner_address_3
207+ account_id: account.a_expense
208+ invoice_line:
209+ - product_id: product.product_product_pc3
210+ quantity: 5
211+ uos_id: product.product_uom_unit
212+ price_unit: 1000
213+ name: islrprod01_notax
214+ account_id: account.a_expense
215+ concept_id: islr_wh_concept_demo2
216+ - product_id: product.product_product_pc4
217+ quantity: 5
218+ uos_id: product.product_uom_unit
219+ price_unit: 2000
220+ name: islrprod02_notax
221+ concept_id: islr_wh_concept_demo2
222+ account_id: account.a_expense
223+ journal_id: account.expenses_journal
224+ partner_id: l10n_ve_fiscal_requirements.f_req_partner_10
225+ nro_ctrl: islr123NOTAX
226+ reference: isrlref123NOTAX
227+ type: in_invoice
228+-
229+ 4.2 I click on Calculate taxes button
230+-
231+ !python {model: account.invoice}: |
232+ acc_brw=self.browse(cr, uid, ref("islr_inv03"))
233+ self.button_reset_taxes(cr, uid, [ref("islr_inv03")])
234+-
235+ 4.3 I update check total before validating the invoice
236+-
237+ !record {model: account.invoice, id: islr_inv03}:
238+ check_total: 16800.0
239+-
240+ 4.4 I change the state of invoice to "Proforma2" by clicking PRO-FORMA button
241+-
242+ !workflow {model: account.invoice, action: invoice_proforma2, ref: islr_inv03}
243+-
244+ 4.5 I create invoice by clicking on Create button
245+-
246+ !workflow {model: account.invoice, action: invoice_open, ref: islr_inv03}
247+-
248+ 4.6 I check that the invoice has any wh doc (must have)
249+-
250+ !assert {model: account.invoice, id: islr_inv03}:
251+ - islr_wh_doc_id.id
252+-
253+ 4.7 Search for the wh lines
254+-
255+ !python {model: account.invoice}: |
256+ import netsvc
257+ import time
258+ ai_brw = self.browse(cr, uid, ref("islr_inv03"))
259+ assert ai_brw.islr_wh_doc_id.amount_total_ret == 222.3, "Bad value for retention amount"
260
261=== modified file 'l10n_ve_withholding_islr/test/test_sale.yml'
262--- l10n_ve_withholding_islr/test/test_sale.yml 2012-09-28 23:12:21 +0000
263+++ l10n_ve_withholding_islr/test/test_sale.yml 2012-10-22 21:07:24 +0000
264@@ -19,7 +19,7 @@
265 account_id: account.a_sale
266 concept_id: islr_wh_concept_demo2
267 invoice_line_tax_id:
268- - account.tax10
269+ - l10n_ve_fiscal_requirements.iva_sale1
270 - product_id: product.product_product_pc4
271 quantity: 5
272 uos_id: product.product_uom_unit
273@@ -28,7 +28,7 @@
274 concept_id: islr_wh_concept_demo2
275 account_id: account.a_sale
276 invoice_line_tax_id:
277- - account.tax10
278+ - l10n_ve_fiscal_requirements.iva_sale1
279 journal_id: account.sales_journal
280 partner_id: base.res_partner_notsotinysarl0
281 nro_ctrl: islr456
282
283=== modified file 'l10n_ve_withholding_iva/test/iva_sale_wh.yml'
284--- l10n_ve_withholding_iva/test/iva_sale_wh.yml 2012-09-27 16:23:18 +0000
285+++ l10n_ve_withholding_iva/test/iva_sale_wh.yml 2012-10-22 21:07:24 +0000
286@@ -111,6 +111,12 @@
287 ap_obj=self.pool.get('account.period')
288 period = ap_obj.find(cr, uid, time.strftime('%Y/%m/%d'), context={'company_id':ref("base.main_company")})
289 assert period, 'There aren\'t periods for this date'
290+ ap_brw = ap.browse(cr, uid, period[0])
291+ if ap_brw.state == 'done':
292+ ap.action_draft(cr, uid, period)
293+ ap_brw = ap.browse(cr, uid, period[0])
294+ assert ap_brw.state == 'draft', 'Period is not open as it should be'
295+
296 self.write(cr, uid, ref("wh_iva_sale01"), {'period_id':period[0]})
297 -
298 7.14 I check period was modificated

Subscribers

People subscribed via source and target branches