Merge lp:~vauxoo/openerp-venezuela-localization/ovl70-rev-modulesdoc-yani into lp:openerp-venezuela-localization
- ovl70-rev-modulesdoc-yani
- Merge into trunk
Proposed by
Yanina Aular (Vauxoo)
Status: | Merged |
---|---|
Merged at revision: | 827 |
Proposed branch: | lp:~vauxoo/openerp-venezuela-localization/ovl70-rev-modulesdoc-yani |
Merge into: | lp:openerp-venezuela-localization |
Diff against target: |
3408 lines (+747/-408) 50 files modified
l10n_ve_fiscal_requirements/model/invoice.py (+6/-9) l10n_ve_fiscal_requirements/model/l10n_ut.py (+6/-10) l10n_ve_fiscal_requirements/model/partner.py (+27/-52) l10n_ve_fiscal_requirements/model/res_company.py (+4/-6) l10n_ve_fiscal_requirements/model/res_users.py (+4/-6) l10n_ve_fiscal_requirements/model/seniat_url.py (+22/-42) l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py (+11/-7) l10n_ve_fiscal_requirements/wizard/account_invoice_parent.py (+32/-3) l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py (+15/-12) l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py (+2/-0) l10n_ve_fiscal_requirements/wizard/update_info_partner.py (+2/-3) l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py (+8/-4) l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py (+2/-0) l10n_ve_fiscal_requirements/wizard/wizard_update_name.py (+4/-0) l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py (+2/-0) l10n_ve_sale_purchase/product.py (+3/-4) l10n_ve_sale_purchase/purchase.py (+4/-3) l10n_ve_sale_purchase/sale.py (+2/-0) l10n_ve_sale_purchase/stock.py (+3/-3) l10n_ve_split_invoice/installer.py (+5/-5) l10n_ve_split_invoice/invoice.py (+4/-3) l10n_ve_withholding/model/account.py (+2/-3) l10n_ve_withholding/model/account_move_line.py (+4/-6) l10n_ve_withholding/model/invoice.py (+10/-15) l10n_ve_withholding_islr/model/installer.py (+12/-0) l10n_ve_withholding_islr/model/invoice.py (+38/-29) l10n_ve_withholding_islr/model/islr_wh_concept.py (+2/-3) l10n_ve_withholding_islr/model/islr_wh_doc.py (+95/-101) l10n_ve_withholding_islr/model/islr_xml_wh.py (+32/-3) l10n_ve_withholding_islr/model/partner.py (+0/-5) l10n_ve_withholding_islr/model/product.py (+8/-6) l10n_ve_withholding_islr/model/rates.py (+4/-9) l10n_ve_withholding_islr/report/list_wh_islr.py (+1/-0) l10n_ve_withholding_islr/report/wh_islr.py (+3/-0) l10n_ve_withholding_islr/wizard/account_invoice_refund.py (+2/-3) l10n_ve_withholding_iva/model/generate_txt.py (+48/-5) l10n_ve_withholding_iva/model/installer.py (+13/-9) l10n_ve_withholding_iva/model/invoice.py (+52/-7) l10n_ve_withholding_iva/model/partner.py (+5/-0) l10n_ve_withholding_iva/model/wh_iva.py (+65/-12) l10n_ve_withholding_iva/report/list_wh_iva.py (+20/-0) l10n_ve_withholding_iva/report/withholding_vat.py (+29/-8) l10n_ve_withholding_iva/wizard/account_invoice_refund.py (+1/-3) l10n_ve_withholding_muni/model/invoice.py (+19/-0) l10n_ve_withholding_muni/model/wh_muni.py (+33/-2) l10n_ve_withholding_muni/report/wh_muni_report.py (+4/-0) l10n_ve_withholding_src/model/invoice.py (+26/-3) l10n_ve_withholding_src/model/wh_src.py (+47/-4) l10n_ve_withholding_src/report/wh_src_report.py (+2/-0) l10n_ve_withholding_src/wizard/wizard_retention.py (+2/-0) |
To merge this branch: | bzr merge lp:~vauxoo/openerp-venezuela-localization/ovl70-rev-modulesdoc-yani |
Related bugs: | |
Related blueprints: |
Documentación Openerp Localización Venezolana
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
hbto [Vauxoo] http://www.vauxoo.com | Approve | ||
Review via email: mp+161268@code.launchpad.net |
Commit message
Description of the change
documentation and fixing conflicts with current ovl
To post a comment you must log in.
- 828. By Yanina Aular (Vauxoo)
-
[REM] needless files
Revision history for this message
Yanina Aular (Vauxoo) (yanina-aular) wrote : | # |
Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) : | # |
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_requirements/model/invoice.py' |
2 | --- l10n_ve_fiscal_requirements/model/invoice.py 2013-04-24 20:27:17 +0000 |
3 | +++ l10n_ve_fiscal_requirements/model/invoice.py 2013-04-27 02:25:32 +0000 |
4 | @@ -28,11 +28,10 @@ |
5 | class account_invoice(osv.osv): |
6 | |
7 | def _get_journal(self, cr, uid, context=None): |
8 | - ''' |
9 | - returns the journal which is |
10 | + """ Return the journal which is |
11 | used in the current user's company, otherwise |
12 | it does not exist, return false |
13 | - ''' |
14 | + """ |
15 | |
16 | if context is None: |
17 | context = {} |
18 | @@ -50,11 +49,10 @@ |
19 | return super(account_invoice, self)._get_journal(cr, uid, context=context) |
20 | |
21 | def _unique_invoice_per_partner(self, cr, uid, ids, context=None): |
22 | - ''' |
23 | - return false when it is found |
24 | + """ Return false when it is found |
25 | that the bill is not out_invoice or out_refund, |
26 | and it is not unique to the partner. |
27 | - ''' |
28 | + """ |
29 | |
30 | if context is None: context={} |
31 | inv_brw = self.browse(cr, uid, ids, context=context) |
32 | @@ -109,11 +107,10 @@ |
33 | ] |
34 | |
35 | def copy(self, cr, uid, id, default={}, context=None): |
36 | - ''' |
37 | - allows you to duplicate a record, |
38 | + """ Allows you to duplicate a record, |
39 | child_ids, nro_ctrl and reference fields are |
40 | cleaned, because they must be unique |
41 | - ''' |
42 | + """ |
43 | if context is None: |
44 | context = {} |
45 | default.update({ |
46 | |
47 | === modified file 'l10n_ve_fiscal_requirements/model/l10n_ut.py' |
48 | --- l10n_ve_fiscal_requirements/model/l10n_ut.py 2013-03-27 02:39:52 +0000 |
49 | +++ l10n_ve_fiscal_requirements/model/l10n_ut.py 2013-04-27 02:25:32 +0000 |
50 | @@ -54,12 +54,11 @@ |
51 | } |
52 | |
53 | def get_amount_ut(self, cr, uid, date=False, *args): |
54 | - ''' |
55 | - returns the value of |
56 | + """ Return the value of |
57 | the tributary unit of the specified date or |
58 | if it's empty return the value to current |
59 | date. |
60 | - ''' |
61 | + """ |
62 | rate = 0 |
63 | date = date or time.strftime('%Y-%m-%d') |
64 | cr.execute("""SELECT amount FROM l10n_ut WHERE date <= '%s' |
65 | @@ -69,10 +68,9 @@ |
66 | return rate |
67 | |
68 | def compute(self, cr, uid, from_amount, date=False, context=None): |
69 | - ''' |
70 | - returns the number of tributary |
71 | + """ Return the number of tributary |
72 | units depending on an amount of money. |
73 | - ''' |
74 | + """ |
75 | if context is None: |
76 | context = {} |
77 | result = 0.0 |
78 | @@ -83,10 +81,8 @@ |
79 | |
80 | def compute_ut_to_money(self, cr, uid, amount_ut, date=False, |
81 | context=None): |
82 | - ''' |
83 | - transforms from money to |
84 | - tributary units |
85 | - ''' |
86 | + """ Transforms from money to tributary units |
87 | + """ |
88 | if context is None: |
89 | context = {} |
90 | money = 0.0 |
91 | |
92 | === modified file 'l10n_ve_fiscal_requirements/model/partner.py' |
93 | --- l10n_ve_fiscal_requirements/model/partner.py 2013-03-26 23:19:12 +0000 |
94 | +++ l10n_ve_fiscal_requirements/model/partner.py 2013-04-27 02:25:32 +0000 |
95 | @@ -41,33 +41,25 @@ |
96 | _inherit = 'res.partner' |
97 | |
98 | def _get_country_code(self, cr, uid, context=None): |
99 | - ''' |
100 | - return the country code |
101 | - of the user company. If not exists, |
102 | - return XX. |
103 | - ''' |
104 | + """ Return the country code of the user company. If not exists, return XX. |
105 | + """ |
106 | context = context or {} |
107 | user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id |
108 | return user_company.partner_id and user_company.partner_id.country_id \ |
109 | and user_company.partner_id.country_id.code or 'XX' |
110 | |
111 | def default_get(self, cr, uid, fields, context=None): |
112 | - ''' |
113 | - load the country code |
114 | - of the user company to form to be |
115 | - created. |
116 | - ''' |
117 | + """ Load the country code of the user company to form to be created. |
118 | + """ |
119 | context = context or {} |
120 | res = super(res_partner, self).default_get(cr, uid, fields, context=context) |
121 | res.update({'uid_country': self._get_country_code(cr,uid,context=context)}) |
122 | return res |
123 | |
124 | def _get_uid_country(self, cr, uid, ids, field_name, args, context=None): |
125 | - ''' |
126 | - returns a dictionary of key |
127 | - ids as invoices, and value the country code |
128 | + """ Return a dictionary of key ids as invoices, and value the country code |
129 | of the user company. |
130 | - ''' |
131 | + """ |
132 | context = context or {} |
133 | res= {}.fromkeys(ids,self._get_country_code(cr,uid,context=context)) |
134 | return res |
135 | @@ -82,11 +74,8 @@ |
136 | } |
137 | |
138 | def name_search(self,cr,uid,name='',args=[],operator='ilike',context=None,limit=80): |
139 | - ''' |
140 | - gets el id of the partner |
141 | - with the vat or the name and return the |
142 | - name |
143 | - ''' |
144 | + """ Gets el id of the partner with the vat or the name and return the name |
145 | + """ |
146 | if context is None: |
147 | context={} |
148 | ids= [] |
149 | @@ -100,11 +89,9 @@ |
150 | Required Invoice Address |
151 | ''' |
152 | def _check_partner_invoice_addr(self,cr,uid,ids,context={}): |
153 | - ''' |
154 | - returns true if the partner |
155 | - is a company of Venezuela and if the |
156 | + """ Return true if the partner is a company of Venezuela and if the |
157 | address is for billing. |
158 | - ''' |
159 | + """ |
160 | partner_obj = self.browse(cr,uid,ids[0]) |
161 | if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id: |
162 | res = partner_obj.type == 'invoice' |
163 | @@ -117,13 +104,10 @@ |
164 | return True |
165 | |
166 | def _check_vat_uniqueness_def(self, cr, uid, ids, current_vat,list_node_tree, context=None): |
167 | - ''' |
168 | - receiving nodes in the tree |
169 | - that are not members of the current partner |
170 | - level, and the remainder of the assembly |
171 | - to ensure that the partner at the same |
172 | + """ Receiving nodes in the tree that are not members of the current partner |
173 | + level, and the remainder of the assembly to ensure that the partner at the same |
174 | level as the current vat has different. |
175 | - ''' |
176 | + """ |
177 | |
178 | if context is None: context = {} |
179 | nodes = self.search(cr, uid, [] ) |
180 | @@ -132,10 +116,8 @@ |
181 | return not nodes |
182 | |
183 | def _check_vat_uniqueness(self, cr, uid, ids, context=None): |
184 | - ''' |
185 | - check that the vat is unique |
186 | - in the level where the partner in the tree |
187 | - ''' |
188 | + """ Check that the vat is unique in the level where the partner in the tree |
189 | + """ |
190 | if context is None: context = {} |
191 | |
192 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
193 | @@ -168,7 +150,7 @@ |
194 | return True |
195 | |
196 | def _check_vat_mandatory(self, cr, uid, ids, context=None): |
197 | - '''This method will check the vat mandatoriness in partners |
198 | + """ This method will check the vat mandatoriness in partners |
199 | for those user logged on with a Venezuelan Company |
200 | |
201 | The method will return True when: |
202 | @@ -180,7 +162,7 @@ |
203 | +) partner is_company=True AND parent_id is not NULL |
204 | +) partner with parent_id is NULL |
205 | +) partner with parent_id is NOT NULL AND type of address is invoice |
206 | - ''' |
207 | + """ |
208 | if context is None: context = {} |
209 | # Avoiding Egg-Chicken Syndrome |
210 | # TODO: Refine this approach this is big exception |
211 | @@ -214,9 +196,8 @@ |
212 | return True |
213 | |
214 | def _validate(self, cr, uid, ids, context=None): |
215 | - ''' |
216 | - validates the fields |
217 | - ''' |
218 | + """ Validates the fields |
219 | + """ |
220 | |
221 | #In the original orm.py openerp does not allow using |
222 | #context within the constraint because we have to yield |
223 | @@ -259,9 +240,8 @@ |
224 | ] |
225 | |
226 | def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None): |
227 | - ''' |
228 | - checks the syntax of the vat |
229 | - ''' |
230 | + """ Checks the syntax of the vat |
231 | + """ |
232 | if context is None: |
233 | context={} |
234 | if not value: |
235 | @@ -280,10 +260,9 @@ |
236 | return super(res_partner,self).vat_change(cr, uid, ids, value, context=context) |
237 | |
238 | def check_vat_ve(self, vat, context = None): |
239 | - ''' |
240 | - Check Venezuelan VAT number, locally called RIF. |
241 | + """ Check Venezuelan VAT number, locally called RIF. |
242 | RIF: JXXXXXXXXX RIF VENEZOLAN IDENTIFICATION CARD: VXXXXXXXXX FOREIGN IDENTIFICATION CARD: EXXXXXXXXX |
243 | - ''' |
244 | + """ |
245 | |
246 | if context is None: |
247 | context={} |
248 | @@ -294,21 +273,17 @@ |
249 | return False |
250 | |
251 | def update_rif(self, cr, uid, ids, context=None): |
252 | - ''' |
253 | - load the rif and name of the partner |
254 | - from the database seniat |
255 | - ''' |
256 | + """ Load the rif and name of the partner from the database seniat |
257 | + """ |
258 | if context is None: |
259 | context = {} |
260 | su_obj = self.pool.get('seniat.url') |
261 | return su_obj.update_rif(cr, uid, ids, context=context) |
262 | |
263 | def button_check_vat(self, cr, uid, ids, context=None): |
264 | - ''' |
265 | - is called by the button that load |
266 | - information of the partner from database |
267 | + """ Is called by the button that load information of the partner from database |
268 | SENIAT |
269 | - ''' |
270 | + """ |
271 | if context is None: context = {} |
272 | context.update({'update_fiscal_information':True}) |
273 | super(res_partner, self).button_check_vat(cr, uid, ids, context=context) |
274 | |
275 | === modified file 'l10n_ve_fiscal_requirements/model/res_company.py' |
276 | --- l10n_ve_fiscal_requirements/model/res_company.py 2013-04-24 20:27:17 +0000 |
277 | +++ l10n_ve_fiscal_requirements/model/res_company.py 2013-04-27 02:25:32 +0000 |
278 | @@ -40,22 +40,20 @@ |
279 | } |
280 | |
281 | def create(self, cr, uid, vals, context=None): |
282 | - ''' |
283 | - to create a new record, |
284 | + """ To create a new record, |
285 | adds a Boolean field to true |
286 | indicates that the partner is a company |
287 | - ''' |
288 | + """ |
289 | if context is None: |
290 | context = {} |
291 | context.update({'create_company': True}) |
292 | return super(res_company, self).create(cr, uid, vals, context=context) |
293 | |
294 | def write(self, cr, uid, ids, values, context=None): |
295 | - ''' |
296 | - to write a new record, |
297 | + """ To write a new record, |
298 | adds a Boolean field to true |
299 | indicates that the partner is a company |
300 | - ''' |
301 | + """ |
302 | context = context or {} |
303 | context.update({'create_company': True}) |
304 | return super(res_company, self).write(cr, uid, ids, values, context=context) |
305 | |
306 | === modified file 'l10n_ve_fiscal_requirements/model/res_users.py' |
307 | --- l10n_ve_fiscal_requirements/model/res_users.py 2013-03-26 23:20:54 +0000 |
308 | +++ l10n_ve_fiscal_requirements/model/res_users.py 2013-04-27 02:25:32 +0000 |
309 | @@ -35,21 +35,19 @@ |
310 | _inherit = 'res.users' |
311 | |
312 | def create(self, cr, uid, vals, context=None): |
313 | - ''' |
314 | - to create a new record, |
315 | + """ To create a new record, |
316 | adds a Boolean field to true |
317 | indicates that the partner is a company |
318 | - ''' |
319 | + """ |
320 | if context is None: context = {} |
321 | context.update({'create_company':True}) |
322 | return super(res_users, self).create(cr, uid, vals, context=context) |
323 | |
324 | def write(self, cr, uid, ids, values, context=None): |
325 | - ''' |
326 | - to write a new record, |
327 | + """ To write a new record, |
328 | adds a Boolean field to true |
329 | indicates that the partner is a company |
330 | - ''' |
331 | + """ |
332 | context = context or {} |
333 | context.update({'create_company':True}) |
334 | return super(res_users, self).write(cr, uid, ids, values, context=context) |
335 | |
336 | === modified file 'l10n_ve_fiscal_requirements/model/seniat_url.py' |
337 | --- l10n_ve_fiscal_requirements/model/seniat_url.py 2013-04-25 20:11:20 +0000 |
338 | +++ l10n_ve_fiscal_requirements/model/seniat_url.py 2013-04-27 02:25:32 +0000 |
339 | @@ -33,8 +33,7 @@ |
340 | |
341 | |
342 | class seniat_url(osv.osv): |
343 | - """ |
344 | - OpenERP Model : seniat_url |
345 | + """ OpenERP Model : seniat_url |
346 | """ |
347 | _name = 'seniat.url' |
348 | _description = "Seniat config needed to run auto-config partner" |
349 | @@ -107,10 +106,8 @@ |
350 | return False |
351 | |
352 | def _load_url(self, retries, url): |
353 | - ''' |
354 | - check that the seniat url is loaded |
355 | - correctly |
356 | - ''' |
357 | + """ Check that the seniat url is loaded correctly |
358 | + """ |
359 | str_error = '404 Not Found' |
360 | while retries > 0: |
361 | try: |
362 | @@ -127,10 +124,8 @@ |
363 | return str_error |
364 | |
365 | def _buscar_porcentaje(self, cr, uid, rif): |
366 | - ''' |
367 | - finds the percentage |
368 | - to withhold the withholding agent. |
369 | - ''' |
370 | + """ Finds the percentage to withhold the withholding agent. |
371 | + """ |
372 | url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0] |
373 | url = url_obj.url_seniat + '%s' |
374 | context = {} |
375 | @@ -146,10 +141,8 @@ |
376 | return 0.0 |
377 | |
378 | def _parse_dom(self, cr, uid, dom, rif, url_seniat, context={}): |
379 | - ''' |
380 | - this function extracts the information |
381 | - partner of the string and returns |
382 | - ''' |
383 | + """ This function extracts the information partner of the string and returns |
384 | + """ |
385 | rif_aux = dom.childNodes[0].getAttribute('rif:numeroRif') |
386 | name = dom.childNodes[0].childNodes[0].firstChild.data |
387 | wh_agent = dom.childNodes[0].childNodes[ |
388 | @@ -165,18 +158,14 @@ |
389 | 'wh_iva_agent': wh_agent} |
390 | |
391 | def _print_error(self, error, msg): |
392 | - ''' |
393 | - shows an error on the screen |
394 | - ''' |
395 | + """ Shows an error on the screen |
396 | + """ |
397 | raise osv.except_osv(error, msg) |
398 | |
399 | def _eval_seniat_data(self, xml_data, vat, context={}): |
400 | - ''' |
401 | - returns false when there was |
402 | - no error in the query in url SENIAT and |
403 | - return true when there was error in the |
404 | - query. |
405 | - ''' |
406 | + """ Returns false when there was no error in the query in url SENIAT and |
407 | + return true when there was error in the query. |
408 | + """ |
409 | if context is None: |
410 | context = {} |
411 | if not context.get('all_rif'): |
412 | @@ -196,10 +185,8 @@ |
413 | return False |
414 | |
415 | def _get_rif(self, cr, uid, vat, url1, url2, context=None): |
416 | - ''' |
417 | - partner information transforms |
418 | - XML to string and returns. |
419 | - ''' |
420 | + """ Partner information transforms XML to string and returns. |
421 | + """ |
422 | if context is None: |
423 | context = {} |
424 | |
425 | @@ -209,11 +196,10 @@ |
426 | return self._parse_dom(cr, uid, dom, vat, url2, context=context) |
427 | |
428 | def _dom_giver(self, cr, uid, vat, context=None): |
429 | - ''' |
430 | - check and validates that the vat is a passport, |
431 | + """ Check and validates that the vat is a passport, |
432 | id or rif, to send information to SENIAT and returns the |
433 | partner info that provides. |
434 | - ''' |
435 | + """ |
436 | if context is None: |
437 | context = {} |
438 | |
439 | @@ -243,18 +229,14 @@ |
440 | return self._get_rif(cr, uid, vat, url1, url2, context=context) |
441 | |
442 | def _update_partner(self, cr, uid, id, context=None): |
443 | - ''' |
444 | - indicates that the partner was |
445 | - updated with information provided by seniat |
446 | - ''' |
447 | + """ Indicates that the partner was updated with information provided by seniat |
448 | + """ |
449 | rp_obj = self.pool.get('res.partner') |
450 | rp_obj.write(cr, uid, id, {'seniat_updated': True}) |
451 | |
452 | def update_rif(self, cr, uid, ids, context={}): |
453 | - ''' |
454 | - updates the partner info if it have a vat, |
455 | - |
456 | - ''' |
457 | + """ Updates the partner info if it have a vat |
458 | + """ |
459 | aux = [] |
460 | rp_obj = self.pool.get('res.partner') |
461 | if context.get('exec_wizard'): |
462 | @@ -278,11 +260,9 @@ |
463 | return True |
464 | |
465 | def connect_seniat(self, cr, uid, ids, context={}, all_rif=False): |
466 | - ''' |
467 | - adds true value to the field |
468 | - all_rif to denote that rif was charged with |
469 | + """ Adds true value to the field all_rif to denote that rif was charged with |
470 | SENIAT database |
471 | - ''' |
472 | + """ |
473 | ctx = context.copy() |
474 | if all_rif: |
475 | ctx.update({'all_rif': True}) |
476 | |
477 | === modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py' |
478 | --- l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2013-03-01 17:48:52 +0000 |
479 | +++ l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2013-04-27 02:25:32 +0000 |
480 | @@ -40,6 +40,8 @@ |
481 | } |
482 | |
483 | def _get_journal(self, cr, uid, context=None): |
484 | + """ Return partner journal depending of the invoice type |
485 | + """ |
486 | obj_journal = self.pool.get('account.journal') |
487 | if context is None: |
488 | context = {} |
489 | @@ -61,6 +63,8 @@ |
490 | } |
491 | |
492 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): |
493 | + """ Change fields position in the view |
494 | + """ |
495 | if context is None: |
496 | context = {} |
497 | |
498 | @@ -82,8 +86,7 @@ |
499 | return res |
500 | |
501 | def _get_orig(self, cr, uid, inv, ref, context=None): |
502 | - """ |
503 | - Return default origin value |
504 | + """ Return default origin value |
505 | """ |
506 | if context is None: |
507 | context = {} |
508 | @@ -94,11 +97,10 @@ |
509 | return orig |
510 | |
511 | def compute_debit(self, cr, uid, ids, context=None): |
512 | - """ |
513 | - @param cr: the current row, from the database cursor, |
514 | - @param uid: the current user’s ID for security checks, |
515 | - @param ids: the account invoice refund’s ID or list of IDs |
516 | - |
517 | + """ Create a debit note |
518 | + @param cr: The current row, from the database cursor, |
519 | + @param uid: The current user’s ID for security checks, |
520 | + @param ids: The account invoice refund’s ID or list of IDs |
521 | """ |
522 | inv_obj = self.pool.get('account.invoice') |
523 | reconcile_obj = self.pool.get('account.move.reconcile') |
524 | @@ -216,6 +218,8 @@ |
525 | return result |
526 | |
527 | def invoice_debit(self, cr, uid, ids, context=None): |
528 | + """ Call method compute_debit |
529 | + """ |
530 | if context is None: |
531 | context = {} |
532 | return self.compute_debit(cr, uid, ids, context=context) |
533 | |
534 | === modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_parent.py' |
535 | --- l10n_ve_fiscal_requirements/wizard/account_invoice_parent.py 2013-04-18 15:22:33 +0000 |
536 | +++ l10n_ve_fiscal_requirements/wizard/account_invoice_parent.py 2013-04-27 02:25:32 +0000 |
537 | @@ -43,6 +43,8 @@ |
538 | } |
539 | |
540 | def _get_partner(self, cr, uid, context=None): |
541 | + """ Return invoice partner |
542 | + """ |
543 | inv_obj = self.pool.get('account.invoice') |
544 | if context is None: |
545 | context = {} |
546 | @@ -57,11 +59,10 @@ |
547 | } |
548 | |
549 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): |
550 | - |
551 | + """ Change fields position in the view |
552 | + """ |
553 | if context is None: |
554 | context = {} |
555 | - |
556 | - |
557 | journal_obj = self.pool.get('account.journal') |
558 | res = super(account_invoice_parent,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) |
559 | if view_type == 'form': |
560 | @@ -105,12 +106,20 @@ |
561 | return res |
562 | |
563 | def default_get(self, cr, uid, fields, context=None): |
564 | + """ Change value for default of the type field |
565 | + """ |
566 | res = super(account_invoice_parent, self).default_get(cr, uid, fields, context=context) |
567 | if context.get('op_type', False): |
568 | res.update({'type': context.get('op_type', 'modify')}) |
569 | return res |
570 | |
571 | def get_window(self, cr, uid, ids, xml_id, module, op_type, partner_id, parent_id=False, context=None): |
572 | + """ Update values (op_type, partner_id and parent_id) in the window |
573 | + @param xml_id: |
574 | + @param op_type: |
575 | + @param partner_id: |
576 | + @param parent_id: |
577 | + """ |
578 | mod_obj = self.pool.get('ir.model.data') |
579 | act_obj = self.pool.get('ir.actions.act_window') |
580 | #we get the model |
581 | @@ -125,16 +134,25 @@ |
582 | return result |
583 | |
584 | def check_sure(self, cr, uid, ids, ok, context=None): |
585 | + """ Checks if the user is sure |
586 | + """ |
587 | if not ok: |
588 | raise osv.except_osv(_('User Error'), _('Assign parent invoice, Please check the box to confirm that you agree!')) |
589 | return True |
590 | |
591 | def check_recursion(self, cr, uid, ids, child_id,parent_id, context=None): |
592 | + """ Checks that have not recursion between parent and children |
593 | + @param child_id: child id |
594 | + @param parent_id: parent id |
595 | + """ |
596 | if child_id == parent_id: |
597 | raise osv.except_osv(_('User Error'), _('Current invoice is the same father invoice, Credit or debit note have to be diferent of parent invoice, Please choise another one!')) |
598 | return True |
599 | |
600 | def check_grandfather(self, cr, uid, ids, parent_id, context=None): |
601 | + """ Check that parent_id having parent |
602 | + @param parent_id: |
603 | + """ |
604 | inv_obj = self.pool.get('account.invoice') |
605 | inv_parent_brw = inv_obj.browse(cr, uid, parent_id, context=context) |
606 | if inv_parent_brw.parent_id: |
607 | @@ -142,6 +160,9 @@ |
608 | return True |
609 | |
610 | def action_assigned(self, cr, uid, ids, form, context=None): |
611 | + """ Check that credit or debit note having assigned invoice |
612 | + @param form: fields values |
613 | + """ |
614 | self.check_sure(cr, uid, ids, form['sure'], context) |
615 | active_id = context.get('active_id', False) |
616 | parent_id = form.get('parent_id', False) |
617 | @@ -163,6 +184,9 @@ |
618 | |
619 | |
620 | def action_unlink(self, cr, uid, ids, form, context=None): |
621 | + """ Remove the parent of the partner |
622 | + @param form: fields values parent_id and partner_id |
623 | + """ |
624 | self.check_sure(cr, uid, ids, form['sure'], context) |
625 | active_id = context.get('active_id', False) |
626 | parent_id = form.get('parent_id', False) |
627 | @@ -178,6 +202,9 @@ |
628 | return result |
629 | |
630 | def action_modify(self, cr, uid, ids, form, context=None): |
631 | + """ Modify parent of the partner |
632 | + @param form: fields values parent_id and partner_id |
633 | + """ |
634 | self.check_sure(cr, uid, ids, form['sure'], context) |
635 | active_id = context.get('active_id', False) |
636 | parent_id = form.get('parent_id', False) |
637 | @@ -196,6 +223,8 @@ |
638 | |
639 | |
640 | def invoice_operation(self, cr, uid, ids, context=None): |
641 | + """ General method that calls a function depending of the data['type'] |
642 | + """ |
643 | if context is None: |
644 | context = {} |
645 | data = self.read(cr, uid, ids)[0] |
646 | |
647 | === modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py' |
648 | --- l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2013-04-17 03:11:25 +0000 |
649 | +++ l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2013-04-27 02:25:32 +0000 |
650 | @@ -26,8 +26,8 @@ |
651 | from openerp import netsvc |
652 | |
653 | class account_invoice_refund(osv.osv_memory): |
654 | - |
655 | """Refunds invoice""" |
656 | + |
657 | _inherit = 'account.invoice.refund' |
658 | |
659 | def default_get(self, cr, uid, fields, context=None): |
660 | @@ -69,6 +69,8 @@ |
661 | } |
662 | |
663 | def _get_journal(self, cr, uid, context=None): |
664 | + """ Return journal depending of the invoice type |
665 | + """ |
666 | obj_journal = self.pool.get('account.journal') |
667 | if context is None: |
668 | context = {} |
669 | @@ -79,7 +81,8 @@ |
670 | return journal and journal[0] or False |
671 | |
672 | def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): |
673 | - |
674 | + """ Depending on context, options are displayed in the selection field |
675 | + """ |
676 | if context is None: |
677 | context = {} |
678 | |
679 | @@ -97,8 +100,7 @@ |
680 | return res |
681 | |
682 | def _get_orig(self, cr, uid, inv, ref, context={}): |
683 | - """ |
684 | - Return default origin value |
685 | + """ Return default origin value |
686 | """ |
687 | nro_ref = ref |
688 | if inv.type == 'out_invoice': |
689 | @@ -108,6 +110,8 @@ |
690 | |
691 | |
692 | def cn_iva_validate(self, cr, uid,invoice,context=None): |
693 | + """ Validates if retentions have been changes to move the state confirmed and done |
694 | + """ |
695 | if context is None: |
696 | context={} |
697 | ret_iva_id=False |
698 | @@ -138,11 +142,11 @@ |
699 | return True |
700 | |
701 | def compute_refund(self, cr, uid, ids, mode='refund', context=None): |
702 | - """ |
703 | + """ |
704 | @param ids: the account invoice refund’s ID or list of IDs |
705 | - |
706 | """ |
707 | wzd_brw = self.browse(cr,uid,ids[0],context=context) |
708 | + brw = self.browse(cr,uid,ids[0],context=context) |
709 | inv_obj = self.pool.get('account.invoice') |
710 | reconcile_obj = self.pool.get('account.move.reconcile') |
711 | account_m_line_obj = self.pool.get('account.move.line') |
712 | @@ -318,8 +322,7 @@ |
713 | return result |
714 | |
715 | def validate_total_payment_inv(self, cr, uid, ids, context=None): |
716 | - """ |
717 | - Method that validate if invoice is totally paid. |
718 | + """ Method that validate if invoice is totally paid. |
719 | @param ids: list of invoices. |
720 | return: True: if invoice is paid. |
721 | False: if invoice is not paid. |
722 | @@ -331,8 +334,7 @@ |
723 | return res |
724 | |
725 | def validate_wh(self, cr, uid, ids, context=None): |
726 | - """ |
727 | - Method that validate if invoice has non-yet processed withholds. |
728 | + """ Method that validate if invoice has non-yet processed withholds. |
729 | |
730 | return: True: if invoice is does not have wh's or it does have and those ones are validated. |
731 | False: if invoice is does have and those wh's are not yet validated. |
732 | @@ -343,8 +345,7 @@ |
733 | return True |
734 | |
735 | def unreconcile_paid_invoices(self, cr, uid, invoiceids, context=None): |
736 | - """ |
737 | - Method that unreconcile the payments of invoice. |
738 | + """ Method that unreconcile the payments of invoice. |
739 | @param invoiceids: list of invoices. |
740 | return: True: unreconcile successfully. |
741 | False: unreconcile unsuccessfully. |
742 | @@ -374,6 +375,8 @@ |
743 | return res |
744 | |
745 | def invoice_refund(self, cr, uid, ids, context=None): |
746 | + """ Create a invoice refund |
747 | + """ |
748 | if context is None: |
749 | context = {} |
750 | inv_obj = self.pool.get('account.invoice') |
751 | |
752 | === modified file 'l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py' |
753 | --- l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2013-02-13 19:39:18 +0000 |
754 | +++ l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2013-04-27 02:25:32 +0000 |
755 | @@ -35,6 +35,8 @@ |
756 | } |
757 | |
758 | def search_partner_seniat(self, cr, uid, ids, context=None): |
759 | + """ Check vat of the partner and update iva rate |
760 | + """ |
761 | if context is None: |
762 | context={} |
763 | this = self.browse(cr, uid, ids)[0] |
764 | |
765 | === modified file 'l10n_ve_fiscal_requirements/wizard/update_info_partner.py' |
766 | --- l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2013-02-13 19:39:18 +0000 |
767 | +++ l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2013-04-27 02:25:32 +0000 |
768 | @@ -24,12 +24,11 @@ |
769 | from openerp.tools.translate import _ |
770 | |
771 | class update_info_partner(osv.osv_memory): |
772 | - """ |
773 | - OpenERP osv memory wizard : update_info_partner |
774 | - """ |
775 | _name = 'update.info.partner' |
776 | |
777 | def update_info(self, cr, uid, ids, context={}): |
778 | + """ OpenERP osv memory wizard : update_info_partner |
779 | + """ |
780 | aux=[] |
781 | seniat_url_obj = self.pool.get('seniat.url') |
782 | cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''') |
783 | |
784 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py' |
785 | --- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2013-02-13 19:39:18 +0000 |
786 | +++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2013-04-27 02:25:32 +0000 |
787 | @@ -39,7 +39,10 @@ |
788 | } |
789 | |
790 | def action_invoice_create(self, cr, uid, ids, wizard_brw,inv_brw,context=None): |
791 | - |
792 | + """ If the invoice has control number, this function is responsible for passing the bill to damaged paper |
793 | + @param wizard_brw: nothing for now |
794 | + @param inv_brw: damaged paper |
795 | + """ |
796 | invoice_line_obj = self.pool.get('account.invoice.line') |
797 | invoice_obj = self.pool.get('account.invoice') |
798 | acc_mv_obj = self.pool.get('account.move') |
799 | @@ -78,9 +81,8 @@ |
800 | return inv_brw.id |
801 | |
802 | def new_open_window(self,cr,uid,ids,list_ids,xml_id,module,context=None): |
803 | - ''' |
804 | - Generate new window at view form or tree |
805 | - ''' |
806 | + """ Generate new window at view form or tree |
807 | + """ |
808 | mod_obj = self.pool.get('ir.model.data') |
809 | act_obj = self.pool.get('ir.actions.act_window') |
810 | result = mod_obj._get_id(cr, uid, module, xml_id) |
811 | @@ -90,6 +92,8 @@ |
812 | return result |
813 | |
814 | def create_invoice(self, cr, uid, ids, context=None): |
815 | + """ Create a invoice refund |
816 | + """ |
817 | if context==None: |
818 | context={} |
819 | wizard_brw = self.browse(cr, uid, ids, context=None) |
820 | |
821 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py' |
822 | --- l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2013-02-13 19:39:18 +0000 |
823 | +++ l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2013-04-27 02:25:32 +0000 |
824 | @@ -31,6 +31,8 @@ |
825 | _description = "Wizard that changes the invoice control number" |
826 | |
827 | def set_noctrl(self, cr, uid, ids, context=None): |
828 | + """ Change control number of the invoice |
829 | + """ |
830 | if context is None: |
831 | context={} |
832 | data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0] |
833 | |
834 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_update_name.py' |
835 | --- l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2013-02-13 19:39:18 +0000 |
836 | +++ l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2013-04-27 02:25:32 +0000 |
837 | @@ -31,6 +31,8 @@ |
838 | _description = "Wizard that changes the partner name" |
839 | |
840 | def set_name(self, cr, uid, ids, context): |
841 | + """ Change value of the name field |
842 | + """ |
843 | data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0] |
844 | print ids |
845 | if not data['sure']: |
846 | @@ -48,6 +50,8 @@ |
847 | } |
848 | |
849 | def _get_name(self, cr, uid, context=None): |
850 | + """ Get name field value |
851 | + """ |
852 | if context is None: |
853 | context = {} |
854 | partner_obj = self.pool.get('res.partner') |
855 | |
856 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py' |
857 | --- l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2013-02-13 19:39:18 +0000 |
858 | +++ l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2013-04-27 02:25:32 +0000 |
859 | @@ -28,6 +28,8 @@ |
860 | |
861 | |
862 | def _get_url(self,cr,uid,ids,context=None): |
863 | + """ Get seniat web page |
864 | + """ |
865 | url= self.pool.get('seniat.url') |
866 | url_ids = url.search(cr, uid,[]) |
867 | if len(url_ids)>1: |
868 | |
869 | === modified file 'l10n_ve_sale_purchase/product.py' |
870 | --- l10n_ve_sale_purchase/product.py 2013-02-13 19:39:18 +0000 |
871 | +++ l10n_ve_sale_purchase/product.py 2013-04-27 02:25:32 +0000 |
872 | @@ -44,12 +44,11 @@ |
873 | |
874 | |
875 | class product_product(osv.osv): |
876 | - |
877 | _inherit = "product.product" |
878 | - ''' |
879 | - Function that adds a default concept for products that are not service |
880 | - ''' |
881 | + |
882 | def onchange_product_type(self, cr, uid, ids, prd_type, context=None): |
883 | + """ Function that adds a default concept for products that are not service |
884 | + """ |
885 | domain = {} |
886 | if prd_type != 'service': |
887 | concept_obj = self.pool.get('islr.wh.concept') |
888 | |
889 | === modified file 'l10n_ve_sale_purchase/purchase.py' |
890 | --- l10n_ve_sale_purchase/purchase.py 2013-02-13 19:39:18 +0000 |
891 | +++ l10n_ve_sale_purchase/purchase.py 2013-04-27 02:25:32 +0000 |
892 | @@ -42,9 +42,8 @@ |
893 | } |
894 | |
895 | def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False): |
896 | - ''' |
897 | - This method loads the withholding concept to a product automatically |
898 | - ''' |
899 | + """ This method loads the withholding concept to a product automatically |
900 | + """ |
901 | def get_concept(): |
902 | concept_obj = self.pool.get('islr.wh.concept') |
903 | concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)]) |
904 | @@ -65,6 +64,8 @@ |
905 | _inherit = 'purchase.order' |
906 | |
907 | def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None): |
908 | + """ Update concept_id field to the prepare line |
909 | + """ |
910 | data = super(purchase_order, self)._prepare_inv_line( cr, uid, account_id, order_line, context=context) |
911 | data.update({'concept_id':order_line and order_line.concept_id and order_line.concept_id.id }) |
912 | return data |
913 | |
914 | === modified file 'l10n_ve_sale_purchase/sale.py' |
915 | --- l10n_ve_sale_purchase/sale.py 2013-04-24 19:47:03 +0000 |
916 | +++ l10n_ve_sale_purchase/sale.py 2013-04-27 02:25:32 +0000 |
917 | @@ -56,6 +56,8 @@ |
918 | |
919 | #~method that adds to the original in concept retention lines for sale, is called by action_invoice_create() in sale.order |
920 | def invoice_line_create(self, cr, uid, ids, context={}): |
921 | + """ Assing concept_id to the invoice lines |
922 | + """ |
923 | create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context) |
924 | invoice_line_brws = self.pool.get('account.invoice.line').browse(cr, uid, create_ids) |
925 | order_line_sale_brws = self.pool.get('sale.order.line').browse(cr, uid, ids) |
926 | |
927 | === modified file 'l10n_ve_sale_purchase/stock.py' |
928 | --- l10n_ve_sale_purchase/stock.py 2013-02-13 19:39:18 +0000 |
929 | +++ l10n_ve_sale_purchase/stock.py 2013-04-27 02:25:32 +0000 |
930 | @@ -33,10 +33,10 @@ |
931 | |
932 | class stock_picking(osv.osv): |
933 | _inherit = 'stock.picking' |
934 | - ''' |
935 | - Function that adds the concept of retention to the invoice_lines from a purchase order or sales order with billing method from picking list |
936 | - ''' |
937 | def action_invoice_create(self, cursor, user, ids, journal_id=False,group=False, type='out_invoice', context=None): |
938 | + """ Function that adds the concept of retention to the invoice_lines from |
939 | + a purchase order or sales order with billing method from picking list |
940 | + """ |
941 | if context is None: |
942 | context = {} |
943 | data = super(stock_picking, self).action_invoice_create(cursor, user, ids, journal_id, group, type, context) |
944 | |
945 | === modified file 'l10n_ve_split_invoice/installer.py' |
946 | --- l10n_ve_split_invoice/installer.py 2013-02-13 19:39:18 +0000 |
947 | +++ l10n_ve_split_invoice/installer.py 2013-04-27 02:25:32 +0000 |
948 | @@ -29,23 +29,23 @@ |
949 | import openerp.addons |
950 | |
951 | class split_invoice_config(osv.osv_memory): |
952 | - """ |
953 | - Fiscal Requirements installer wizard |
954 | + """ Fiscal Requirements installer wizard |
955 | """ |
956 | _name = 'split.invoice.config' |
957 | _inherit = 'res.config' |
958 | _description= __doc__ |
959 | |
960 | def default_get(self, cr, uid, fields_list=None, context=None): |
961 | + """ Default value to the config_logo field |
962 | + """ |
963 | defaults = super(split_invoice_config, self).default_get(cr, uid, fields_list=fields_list, context=context) |
964 | logo = open(addons.get_module_resource('l10n_ve_split_invoice', 'images', 'puente-maracaibo.jpg'), 'rb') |
965 | defaults['config_logo'] = base64.encodestring(logo.read()) |
966 | return defaults |
967 | |
968 | def execute(self, cr, uid, ids, context=None): |
969 | - ''' |
970 | - In this method I will configure the maximum number of lines in your invoices. |
971 | - ''' |
972 | + """ In this method I will configure the maximum number of lines in your invoices. |
973 | + """ |
974 | wiz_data = self.browse(cr, uid, ids[0]) |
975 | if wiz_data.name < 1 : |
976 | raise osv.except_osv(_('Error !'), _('The number of customer invoice lines must be at least one')) |
977 | |
978 | === modified file 'l10n_ve_split_invoice/invoice.py' |
979 | --- l10n_ve_split_invoice/invoice.py 2013-03-01 17:48:52 +0000 |
980 | +++ l10n_ve_split_invoice/invoice.py 2013-04-27 02:25:32 +0000 |
981 | @@ -31,9 +31,8 @@ |
982 | _inherit = 'account.invoice' |
983 | |
984 | def split_invoice(self, cr, uid, ids): |
985 | - ''' |
986 | - Split the invoice when the lines exceed the maximum set for the company |
987 | - ''' |
988 | + """ Split the invoice when the lines exceed the maximum set for the company |
989 | + """ |
990 | for inv in self.browse(cr, uid, ids): |
991 | inv_id =False |
992 | if inv.company_id.lines_invoice < 1: |
993 | @@ -75,6 +74,8 @@ |
994 | return True |
995 | |
996 | def action_date_assign(self, cr, uid, ids, *args): |
997 | + """ Return assigned dat |
998 | + """ |
999 | data = super(account_invoice, self).action_date_assign(cr, uid, ids, *args) |
1000 | self.split_invoice(cr,uid,ids) |
1001 | return True |
1002 | |
1003 | === modified file 'l10n_ve_withholding/model/account.py' |
1004 | --- l10n_ve_withholding/model/account.py 2013-02-13 19:39:18 +0000 |
1005 | +++ l10n_ve_withholding/model/account.py 2013-04-27 02:25:32 +0000 |
1006 | @@ -73,15 +73,14 @@ |
1007 | _inherit = "account.period" |
1008 | |
1009 | def find_fortnight(self, cr, uid, dt=None, context=None): |
1010 | - ''' |
1011 | - This Function returns a tuple composed of |
1012 | + """ This Function returns a tuple composed of |
1013 | *) period for the asked dt (int) |
1014 | *) fortnight for the asked dt (boolean): |
1015 | -) False: for the 1st. fortnight |
1016 | -) True: for the 2nd. fortnight. |
1017 | Example: |
1018 | (3,True) => a period whose id is 3 in the second fortnight |
1019 | - ''' |
1020 | + """ |
1021 | if context is None: context = {} |
1022 | if not dt: |
1023 | dt = time.strftime('%Y-%m-%d') |
1024 | |
1025 | === modified file 'l10n_ve_withholding/model/account_move_line.py' |
1026 | --- l10n_ve_withholding/model/account_move_line.py 2013-04-17 17:47:36 +0000 |
1027 | +++ l10n_ve_withholding/model/account_move_line.py 2013-04-27 02:25:32 +0000 |
1028 | @@ -31,9 +31,8 @@ |
1029 | _inherit = 'account.move.line' |
1030 | |
1031 | def _models_retencion_get(self, cr, uid, context={}): |
1032 | - ''' |
1033 | - List document for link with account entry |
1034 | - ''' |
1035 | + """ List document for link with account entry |
1036 | + """ |
1037 | obj = self.pool.get('ir.model.fields') |
1038 | wh_doc_obj = self.pool.get('account.wh.doc') |
1039 | wh_doc_ids = wh_doc_obj.search(cr, uid, []) |
1040 | @@ -49,9 +48,8 @@ |
1041 | return res |
1042 | |
1043 | def _document_get(self, cr, uid, ids, field_name, arg, context=None): |
1044 | - ''' |
1045 | - Link document with account entry |
1046 | - ''' |
1047 | + """ Link document with account entry |
1048 | + """ |
1049 | res = {} |
1050 | obj = self.pool.get('ir.model.fields') |
1051 | |
1052 | |
1053 | === modified file 'l10n_ve_withholding/model/invoice.py' |
1054 | --- l10n_ve_withholding/model/invoice.py 2013-03-26 03:26:02 +0000 |
1055 | +++ l10n_ve_withholding/model/invoice.py 2013-04-27 02:25:32 +0000 |
1056 | @@ -37,10 +37,9 @@ |
1057 | pay_journal_id, writeoff_acc_id, |
1058 | writeoff_period_id, writeoff_journal_id, date, |
1059 | name, context=None): |
1060 | - ''' |
1061 | - Function openerp is rewritten for adaptation in |
1062 | + """ Function openerp is rewritten for adaptation in |
1063 | the ovl |
1064 | - ''' |
1065 | + """ |
1066 | if context is None: context = {} |
1067 | return [] |
1068 | |
1069 | @@ -48,9 +47,8 @@ |
1070 | period_id, pay_journal_id, writeoff_acc_id, |
1071 | writeoff_period_id, writeoff_journal_id, date, |
1072 | name, to_wh, context=None): |
1073 | - ''' |
1074 | - make the payment of the invoice |
1075 | - ''' |
1076 | + """ Make the payment of the invoice |
1077 | + """ |
1078 | if context is None: |
1079 | context = {} |
1080 | |
1081 | @@ -109,9 +107,8 @@ |
1082 | |
1083 | |
1084 | def ret_payment_get(self, cr, uid, ids, *args): |
1085 | - ''' |
1086 | - returns payments associated with this bill |
1087 | - ''' |
1088 | + """ Return payments associated with this bill |
1089 | + """ |
1090 | for invoice in self.browse(cr, uid, ids): |
1091 | moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) |
1092 | src = [] |
1093 | @@ -135,11 +132,10 @@ |
1094 | |
1095 | |
1096 | def check_tax_lines(self, cr, uid, inv, compute_taxes, ait_obj): |
1097 | - ''' |
1098 | - check if no tax lines are created. If |
1099 | + """ Check if no tax lines are created. If |
1100 | existing tax lines, there are checks on the invoice |
1101 | and match the tax base. |
1102 | - ''' |
1103 | + """ |
1104 | if not inv.tax_line: |
1105 | for tax in compute_taxes.values(): |
1106 | ait_obj.create(cr, uid, tax) |
1107 | @@ -174,10 +170,9 @@ |
1108 | } |
1109 | |
1110 | def compute(self, cr, uid, invoice_id, context=None): |
1111 | - ''' |
1112 | - calculates the amount, base, tax amount, |
1113 | + """ Calculate the amount, base, tax amount, |
1114 | base amount of the invoice |
1115 | - ''' |
1116 | + """ |
1117 | |
1118 | tax_grouped = {} |
1119 | tax_obj = self.pool.get('account.tax') |
1120 | |
1121 | === modified file 'l10n_ve_withholding_islr/model/installer.py' |
1122 | --- l10n_ve_withholding_islr/model/installer.py 2013-02-13 19:39:18 +0000 |
1123 | +++ l10n_ve_withholding_islr/model/installer.py 2013-04-27 02:25:32 +0000 |
1124 | @@ -37,12 +37,16 @@ |
1125 | _description = __doc__ |
1126 | |
1127 | def default_get(self, cr, uid, fields_list=None, context=None): |
1128 | + """ Default value config_logo field |
1129 | + """ |
1130 | defaults = super(wh_islr_config, self).default_get(cr, uid, fields_list=fields_list, context=context) |
1131 | logo = open(addons.get_module_resource('l10n_ve_withholding_islr', 'images', 'playa-medina.jpg'), 'rb') |
1132 | defaults['config_logo'] = base64.encodestring(logo.read()) |
1133 | return defaults |
1134 | |
1135 | def _create_journal(self, cr, uid, name, type, code): |
1136 | + """ Create journal account |
1137 | + """ |
1138 | self.pool.get("account.journal").create(cr, uid, { |
1139 | 'name': name, |
1140 | 'type': type, |
1141 | @@ -51,6 +55,10 @@ |
1142 | ) |
1143 | |
1144 | def _update_concepts(self, cr, uid, sale, purchase,context={}): |
1145 | + """ Update sale and purchase concepts |
1146 | + @param sale: sale concept |
1147 | + @param purchase: purchase concept |
1148 | + """ |
1149 | concept_pool = self.pool.get("islr.wh.concept") |
1150 | concept_pool.write(cr, uid, concept_pool.search(cr, uid, [],context=context), { |
1151 | 'property_retencion_islr_payable': purchase, |
1152 | @@ -59,10 +67,14 @@ |
1153 | return True |
1154 | |
1155 | def _set_wh_agent(self, cr, uid): |
1156 | + """ Set if is withholding agent or not |
1157 | + """ |
1158 | company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
1159 | self.pool.get('res.partner').write(cr, uid, [company.partner_id.id], {'islr_withholding_agent': True}) |
1160 | |
1161 | def execute(self, cr, uid, ids, context=None): |
1162 | + """ Create journals and determinate if is withholding agent or not |
1163 | + """ |
1164 | wiz_data = self.read(cr, uid, ids[0],context=context) |
1165 | if wiz_data['journal_purchase']: |
1166 | self._create_journal(cr, uid, wiz_data["journal_purchase"], 'islr_purchase', 'ISLRP') |
1167 | |
1168 | === modified file 'l10n_ve_withholding_islr/model/invoice.py' |
1169 | --- l10n_ve_withholding_islr/model/invoice.py 2013-04-23 21:06:58 +0000 |
1170 | +++ l10n_ve_withholding_islr/model/invoice.py 2013-04-27 02:25:32 +0000 |
1171 | @@ -33,9 +33,8 @@ |
1172 | |
1173 | |
1174 | class account_invoice_line(osv.osv): |
1175 | - ''' |
1176 | - It adds a field that determines if a line has been retained or not |
1177 | - ''' |
1178 | + """ It adds a field that determines if a line has been retained or not |
1179 | + """ |
1180 | _inherit = "account.invoice.line" |
1181 | _columns = { |
1182 | 'apply_wh': fields.boolean('Withheld', |
1183 | @@ -55,10 +54,18 @@ |
1184 | type='out_invoice', partner_id=False, |
1185 | fposition_id=False, price_unit=False, |
1186 | currency_id=False, context=None, company_id=None): |
1187 | - ''' |
1188 | - Onchange to show the concept of retention associated with the product |
1189 | + """ Onchange information of the product invoice line |
1190 | at once in the line of the bill |
1191 | - ''' |
1192 | + @param product: new product for the invoice line |
1193 | + @param uom: new measuring unit of product |
1194 | + @param qty: new quantity for the invoice line |
1195 | + @param name: new description for the invoice line |
1196 | + @param type: invoice type |
1197 | + @param partner_id: partner of the invoice |
1198 | + @param fposition_id: fiscal position of the invoice |
1199 | + @param price_unit: new Unit Price for the invoice line |
1200 | + @param currency_id: |
1201 | + """ |
1202 | if context is None: |
1203 | context = {} |
1204 | data = super( |
1205 | @@ -78,10 +85,9 @@ |
1206 | return data |
1207 | |
1208 | def create(self, cr, uid, vals, context=None): |
1209 | - ''' |
1210 | - initialilizes the fields wh_xml_id and apply_wh, |
1211 | + """ Initialilizes the fields wh_xml_id and apply_wh, |
1212 | when it comes to a new line |
1213 | - ''' |
1214 | + """ |
1215 | if context is None: |
1216 | context = {} |
1217 | |
1218 | @@ -122,18 +128,16 @@ |
1219 | ## BEGIN OF REWRITING ISLR |
1220 | |
1221 | def check_invoice_type(self, cr, uid, ids, context=None): |
1222 | - ''' |
1223 | - This method check if the given invoice record is from a supplier |
1224 | - ''' |
1225 | + """ This method check if the given invoice record is from a supplier |
1226 | + """ |
1227 | context = context or {} |
1228 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1229 | inv_brw = self.browse(cr, uid, ids[0], context=context) |
1230 | return inv_brw.type in ('in_invoice', 'in_refund') |
1231 | |
1232 | def check_withholdable_concept(self, cr, uid, ids, context=None): |
1233 | - ''' |
1234 | - Check if the given invoice record is ISLR Withholdable |
1235 | - ''' |
1236 | + """ Check if the given invoice record is ISLR Withholdable |
1237 | + """ |
1238 | context = context or {} |
1239 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1240 | iwdi_obj = self.pool.get('islr.wh.doc.invoices') |
1241 | @@ -141,10 +145,9 @@ |
1242 | |
1243 | def _create_doc_invoices(self, cr, uid, ids, islr_wh_doc_id, |
1244 | context=None): |
1245 | - ''' |
1246 | - This method link the invoices to be withheld |
1247 | + """ This method link the invoices to be withheld |
1248 | with the withholding document. |
1249 | - ''' |
1250 | + """ |
1251 | # TODO: CHECK IF THIS METHOD SHOULD BE HERE OR IN THE ISLR WH DOC |
1252 | context = context or {} |
1253 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1254 | @@ -156,9 +159,8 @@ |
1255 | return iwhdi_ids |
1256 | |
1257 | def _create_islr_wh_doc(self, cr, uid, ids, context=None): |
1258 | - ''' |
1259 | - Function to create in the model islr_wh_doc |
1260 | - ''' |
1261 | + """ Function to create in the model islr_wh_doc |
1262 | + """ |
1263 | context = context or {} |
1264 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1265 | |
1266 | @@ -201,10 +203,9 @@ |
1267 | return islr_wh_doc_id |
1268 | |
1269 | def copy(self, cr, uid, id, default=None, context=None): |
1270 | - ''' |
1271 | - inicializes the fields islr_wh_doc and status |
1272 | + """ Inicializes the fields islr_wh_doc and status |
1273 | when the line is duplicated |
1274 | - ''' |
1275 | + """ |
1276 | if default is None: |
1277 | default = {} |
1278 | |
1279 | @@ -222,9 +223,8 @@ |
1280 | context) |
1281 | |
1282 | def _refund_cleanup_lines(self, cr, uid, lines, context=None): |
1283 | - ''' |
1284 | - initializes the fields of the lines of a refund invoice |
1285 | - ''' |
1286 | + """ Initializes the fields of the lines of a refund invoice |
1287 | + """ |
1288 | data = super(account_invoice, self)._refund_cleanup_lines( |
1289 | cr, uid, lines, context=context) |
1290 | list = [] |
1291 | @@ -240,8 +240,7 @@ |
1292 | return list |
1293 | |
1294 | def validate_wh_income_done(self, cr, uid, ids, context=None): |
1295 | - """ |
1296 | - Method that check if wh income is validated in invoice refund. |
1297 | + """ Method that check if wh income is validated in invoice refund. |
1298 | @params: ids: list of invoices. |
1299 | return: True: the wh income is validated. |
1300 | False: the wh income is not validated. |
1301 | @@ -265,6 +264,16 @@ |
1302 | def _get_move_lines(self, cr, uid, ids, to_wh, period_id, pay_journal_id, |
1303 | writeoff_acc_id, writeoff_period_id, writeoff_journal_id, date, |
1304 | name, context=None): |
1305 | + """ Generate move lines in corresponding account |
1306 | + @param to_wh: whether or not withheld |
1307 | + @param period_id: Period |
1308 | + @param pay_journal_id: pay journal of the invoice |
1309 | + @param writeoff_acc_id: account where canceled |
1310 | + @param writeoff_period_id: period where canceled |
1311 | + @param writeoff_journal_id: journal where canceled |
1312 | + @param date: current date |
1313 | + @param name: description |
1314 | + """ |
1315 | context = context or {} |
1316 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1317 | res = super(account_invoice, self)._get_move_lines(cr, uid, ids, to_wh, |
1318 | |
1319 | === modified file 'l10n_ve_withholding_islr/model/islr_wh_concept.py' |
1320 | --- l10n_ve_withholding_islr/model/islr_wh_concept.py 2013-03-20 21:35:20 +0000 |
1321 | +++ l10n_ve_withholding_islr/model/islr_wh_concept.py 2013-04-27 02:25:32 +0000 |
1322 | @@ -34,9 +34,8 @@ |
1323 | |
1324 | |
1325 | class islr_wh_concept(osv.osv): |
1326 | - ''' |
1327 | - Model to create the withholding concepts |
1328 | - ''' |
1329 | + """ Model to create the withholding concepts |
1330 | + """ |
1331 | _name='islr.wh.concept' |
1332 | _description = 'Income Withholding Concept' |
1333 | |
1334 | |
1335 | === modified file 'l10n_ve_withholding_islr/model/islr_wh_doc.py' |
1336 | --- l10n_ve_withholding_islr/model/islr_wh_doc.py 2013-04-19 20:10:44 +0000 |
1337 | +++ l10n_ve_withholding_islr/model/islr_wh_doc.py 2013-04-27 02:25:32 +0000 |
1338 | @@ -37,18 +37,16 @@ |
1339 | class islr_wh_doc(osv.osv): |
1340 | |
1341 | def _get_type(self, cr, uid, context=None): |
1342 | - ''' |
1343 | - returns type of invoice or returns in_invoice |
1344 | - ''' |
1345 | + """ Return type of invoice or returns in_invoice |
1346 | + """ |
1347 | if context is None: |
1348 | context = {} |
1349 | type = context.get('type', 'in_invoice') |
1350 | return type |
1351 | |
1352 | def _get_journal(self, cr, uid, context=None): |
1353 | - ''' |
1354 | - returns a islr journal depending on the type of bill |
1355 | - ''' |
1356 | + """ Return a islr journal depending on the type of bill |
1357 | + """ |
1358 | if context is None: |
1359 | context = {} |
1360 | journal_obj = self.pool.get('account.journal') |
1361 | @@ -64,9 +62,8 @@ |
1362 | return False |
1363 | |
1364 | def _get_currency(self, cr, uid, context): |
1365 | - ''' |
1366 | - returns the currency of the current company |
1367 | - ''' |
1368 | + """ Return the currency of the current company |
1369 | + """ |
1370 | user = self.pool.get('res.users').browse(cr, uid, [uid])[0] |
1371 | if user.company_id: |
1372 | return user.company_id.currency_id.id |
1373 | @@ -74,9 +71,8 @@ |
1374 | return self.pool.get('res.currency').search(cr, uid, [('rate', '=', 1.0)])[0] |
1375 | |
1376 | def _get_amount_total(self, cr, uid, ids, name, args, context=None): |
1377 | - ''' |
1378 | - returns the cumulative amount of each line |
1379 | - ''' |
1380 | + """ Return the cumulative amount of each line |
1381 | + """ |
1382 | res = {} |
1383 | for rete in self.browse(cr, uid, ids, context): |
1384 | res[rete.id] = 0.0 |
1385 | @@ -138,10 +134,9 @@ |
1386 | } |
1387 | |
1388 | def check_income_wh(self, cr, uid, ids, context=None): |
1389 | - ''' |
1390 | - checks invoices to be retained and have |
1391 | + """ Check invoices to be retained and have |
1392 | their fair share of taxes. |
1393 | - ''' |
1394 | + """ |
1395 | context = context or {} |
1396 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1397 | obj = self.browse(cr, uid, ids[0], context=context) |
1398 | @@ -167,21 +162,17 @@ |
1399 | return True |
1400 | |
1401 | def check_auto_wh(self, cr, uid, ids, context=None): |
1402 | - ''' |
1403 | - tells us if the process already |
1404 | - checked and everything was fine. |
1405 | - ''' |
1406 | + """ Tell us if the process already checked and everything was fine. |
1407 | + """ |
1408 | context = context or {} |
1409 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1410 | obj = self.browse(cr, uid, ids[0], context=context) |
1411 | return obj.automatic_income_wh or False |
1412 | |
1413 | def check_auto_wh_by_type(self, cr, uid, ids, context=None): |
1414 | - ''' |
1415 | - tells us if the process already |
1416 | - checked and everything was fine in case of a |
1417 | - in_invoice or in_refund |
1418 | - ''' |
1419 | + """ Tell us if the process already checked and everything was |
1420 | + fine in case of a in_invoice or in_refund |
1421 | + """ |
1422 | context = context or {} |
1423 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1424 | brw = self.browse(cr, uid, ids[0], context=context) |
1425 | @@ -190,10 +181,9 @@ |
1426 | return brw.automatic_income_wh or False |
1427 | |
1428 | def compute_amount_wh(self, cr, uid, ids, context=None): |
1429 | - ''' |
1430 | - calculates the total withholding each invoice |
1431 | + """ Calculate the total withholding each invoice |
1432 | associated with this document |
1433 | - ''' |
1434 | + """ |
1435 | context = context or {} |
1436 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1437 | iwdi_obj = self.pool.get('islr.wh.doc.invoices') |
1438 | @@ -217,10 +207,9 @@ |
1439 | return False |
1440 | |
1441 | def action_done(self, cr, uid, ids, context=None): |
1442 | - ''' |
1443 | - calls the functions in charge of |
1444 | - preparing the document to pass the state done |
1445 | - ''' |
1446 | + """ Call the functions in charge of preparing the document |
1447 | + to pass the state done |
1448 | + """ |
1449 | context = context or {} |
1450 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1451 | self.action_number(cr, uid, ids, context=context) |
1452 | @@ -234,10 +223,8 @@ |
1453 | return True |
1454 | |
1455 | def action_cancel_process(self, cr, uid, ids, context=None): |
1456 | - ''' |
1457 | - deletes all withholding lines and reverses |
1458 | - the process of islr |
1459 | - ''' |
1460 | + """ Delete all withholding lines and reverses the process of islr |
1461 | + """ |
1462 | if not context: |
1463 | context = {} |
1464 | line_obj = self.pool.get('islr.wh.doc.line') |
1465 | @@ -274,10 +261,8 @@ |
1466 | return True |
1467 | |
1468 | def retencion_seq_get(self, cr, uid, context=None): |
1469 | - ''' |
1470 | - determinates the next sequence for |
1471 | - islr withhold and returns. |
1472 | - ''' |
1473 | + """ Determinate the next sequence for islr withhold and returns. |
1474 | + """ |
1475 | pool_seq = self.pool.get('ir.sequence') |
1476 | cr.execute( |
1477 | "select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='islr.wh.doc' and active=True") |
1478 | @@ -290,10 +275,10 @@ |
1479 | return False |
1480 | |
1481 | def onchange_partner_id(self, cr, uid, ids, type, partner_id, context=None): |
1482 | - ''' |
1483 | - unlink all taxes whean change the partner in the |
1484 | - document |
1485 | - ''' |
1486 | + """ Unlink all taxes whean change the partner in the document. |
1487 | + @param type: invoice type |
1488 | + @param partner_id: partner id was changed |
1489 | + """ |
1490 | context = context or {} |
1491 | acc_id = False |
1492 | inv_ids = [] |
1493 | @@ -350,11 +335,9 @@ |
1494 | 'invoice_ids': res_wh_lines}} |
1495 | |
1496 | def create(self, cr, uid, vals, context=None, check=True): |
1497 | - ''' |
1498 | - When you create a new document, this function |
1499 | - is responsible for generating the sequence |
1500 | - code for the field |
1501 | - ''' |
1502 | + """ When you create a new document, this function is responsible |
1503 | + for generating the sequence code for the field |
1504 | + """ |
1505 | if not context: |
1506 | context = {} |
1507 | code = self.pool.get('ir.sequence').get(cr, uid, 'islr.wh.doc') |
1508 | @@ -362,10 +345,9 @@ |
1509 | return super(islr_wh_doc, self).create(cr, uid, vals, context) |
1510 | |
1511 | def action_confirm(self, cr, uid, ids, context=None): |
1512 | - ''' |
1513 | - is responsible for checking if the provider |
1514 | - allows retention is automatically verified and checked |
1515 | - ''' |
1516 | + """ This checking if the provider allows retention is |
1517 | + automatically verified and checked |
1518 | + """ |
1519 | context = context or {} |
1520 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1521 | check_auto_wh = self.browse(cr, uid, ids[0], |
1522 | @@ -374,10 +356,9 @@ |
1523 | 'automatic_income_wh': check_auto_wh}, context=context) |
1524 | |
1525 | def action_number(self, cr, uid, ids, context=None): |
1526 | - ''' |
1527 | - Is responsible for generating a number for |
1528 | - the document if it does not have one |
1529 | - ''' |
1530 | + """ Is responsible for generating a number for the document |
1531 | + if it does not have one |
1532 | + """ |
1533 | context = context or {} |
1534 | obj_ret = self.browse(cr, uid, ids)[0] |
1535 | cr.execute('SELECT id, number ' |
1536 | @@ -393,9 +374,8 @@ |
1537 | return True |
1538 | |
1539 | def action_cancel(self, cr, uid, ids, context={}): |
1540 | - ''' |
1541 | - The operation is canceled and not allows automatic retention |
1542 | - ''' |
1543 | + """ The operation is canceled and not allows automatic retention |
1544 | + """ |
1545 | #~ if self.browse(cr,uid,ids)[0].type=='in_invoice': |
1546 | #~ return True |
1547 | self.pool.get('islr.wh.doc').write( |
1548 | @@ -406,9 +386,8 @@ |
1549 | return True |
1550 | |
1551 | def cancel_move(self, cr, uid, ids, *args): |
1552 | - ''' |
1553 | - Retention cancel documents |
1554 | - ''' |
1555 | + """ Retention cancel documents |
1556 | + """ |
1557 | context = {} |
1558 | ret_brw = self.browse(cr, uid, ids) |
1559 | account_move_obj = self.pool.get('account.move') |
1560 | @@ -426,16 +405,14 @@ |
1561 | return True |
1562 | |
1563 | def action_cancel_draft(self, cr, uid, ids, *args): |
1564 | - ''' |
1565 | - Back to draft status |
1566 | - ''' |
1567 | + """ Back to draft status |
1568 | + """ |
1569 | self.write(cr, uid, ids, {'state': 'draft'}) |
1570 | return True |
1571 | |
1572 | def action_move_create(self, cr, uid, ids, context=None): |
1573 | - ''' |
1574 | - build account moves related to withholding invoice |
1575 | - ''' |
1576 | + """ Build account moves related to withholding invoice |
1577 | + """ |
1578 | wh_doc_obj = self.pool.get('islr.wh.doc.line') |
1579 | context = context or {} |
1580 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1581 | @@ -503,7 +480,17 @@ |
1582 | return True |
1583 | |
1584 | def wh_and_reconcile(self, cr, uid, ids, invoice_id, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''): |
1585 | - |
1586 | + """ retain, reconcile and create corresponding journal items |
1587 | + @param invoice_id: invoice to retain and reconcile |
1588 | + @param pay_amount: amount payable on the invoice |
1589 | + @param pay_account_id: payment account |
1590 | + @param period_id: period for the journal items |
1591 | + @param pay_journal_id: payment journal |
1592 | + @param writeoff_acc_id: account for reconciliation |
1593 | + @param writeoff_period_id: period for reconciliation |
1594 | + @param writeoff_journal_id: journal for reconciliation |
1595 | + @param name: withholding voucher name |
1596 | + """ |
1597 | inv_obj = self.pool.get('account.invoice') |
1598 | ret = self.browse(cr, uid, ids)[0] |
1599 | if context is None: |
1600 | @@ -592,6 +579,8 @@ |
1601 | } |
1602 | |
1603 | def copy(self, cr, uid, id, default=None, context=None): |
1604 | + """ Initialized id by duplicating |
1605 | + """ |
1606 | if default is None: |
1607 | default = {} |
1608 | default = default.copy() |
1609 | @@ -607,9 +596,8 @@ |
1610 | _description = 'Document and Invoice Withheld Income' |
1611 | |
1612 | def _amount_all(self, cr, uid, ids, fieldname, args, context=None): |
1613 | - ''' |
1614 | - |
1615 | - ''' |
1616 | + """ Return all amount relating to the invoices lines |
1617 | + """ |
1618 | res = {} |
1619 | for ret_line in self.browse(cr, uid, ids, context): |
1620 | res[ret_line.id] = { |
1621 | @@ -640,9 +628,8 @@ |
1622 | _rec_rame = 'invoice_id' |
1623 | |
1624 | def _get_concepts(self, cr, uid, ids, context=None): |
1625 | - ''' |
1626 | - Gets a list of withholdable concepts (concept_id) from the invoice lines |
1627 | - ''' |
1628 | + """ Get a list of withholdable concepts (concept_id) from the invoice lines |
1629 | + """ |
1630 | context = context or {} |
1631 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1632 | inv_obj = self.pool.get('account.invoice') |
1633 | @@ -654,8 +641,9 @@ |
1634 | return list(concept_set) |
1635 | |
1636 | def _withholdable_invoices(self, cr, uid, ids, context=None): |
1637 | - '''Given a list of invoices return only those |
1638 | - where there are withholdable concepts''' |
1639 | + """ Given a list of invoices return only those |
1640 | + where there are withholdable concepts |
1641 | + """ |
1642 | context = context or {} |
1643 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1644 | res_ids = [] |
1645 | @@ -666,9 +654,9 @@ |
1646 | return res_ids |
1647 | |
1648 | def _get_wh(self, cr, uid, ids, concept_id, context=None): |
1649 | - ''' |
1650 | - Returns a dictionary containing all the values of the retention of an invoice line. |
1651 | - ''' |
1652 | + """ Return a dictionary containing all the values of the retention of an invoice line. |
1653 | + @param concept_id: Withholding reason |
1654 | + """ |
1655 | # TODO: Change the signature of this method |
1656 | # This record already has the concept_id built-in |
1657 | context = context or {} |
1658 | @@ -735,10 +723,9 @@ |
1659 | return True |
1660 | |
1661 | def load_taxes(self, cr, uid, ids, context=None): |
1662 | - ''' |
1663 | - load taxes to the current invoice, |
1664 | + """ Load taxes to the current invoice, |
1665 | and if already loaded, it recalculates and load. |
1666 | - ''' |
1667 | + """ |
1668 | context = context or {} |
1669 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1670 | ixwl_obj = self.pool.get('islr.xml.wh.line') |
1671 | @@ -824,9 +811,10 @@ |
1672 | return True |
1673 | |
1674 | def _get_partners(self, cr, uid, invoice): |
1675 | - ''' |
1676 | - Se obtiene: el id del vendedor, el id del comprador de la factura y el campo booleano que determina si el comprador es agente de retencion. |
1677 | - ''' |
1678 | + """ Se obtiene: el id del vendedor, el id del comprador de la |
1679 | + factura y el campo booleano que determina si el comprador es |
1680 | + agente de retencion. |
1681 | + """ |
1682 | if invoice.type == 'in_invoice' or invoice.type == 'in_refund': |
1683 | vendor = invoice.partner_id |
1684 | buyer = invoice.company_id.partner_id |
1685 | @@ -837,10 +825,11 @@ |
1686 | return (vendor, buyer, buyer.islr_withholding_agent) |
1687 | |
1688 | def _get_residence(self, cr, uid, vendor, buyer): |
1689 | - ''' |
1690 | - Se determina si la direccion fiscal del comprador es la misma que la del vendedor, con el fin de luego obtener la tasa asociada. |
1691 | - Retorna True si es una persona domiciliada o residente. Retorna False si es, no Residente o No Domicialiado. |
1692 | - ''' |
1693 | + """ Se determina si la direccion fiscal del comprador es la misma |
1694 | + que la del vendedor, con el fin de luego obtener la tasa asociada. |
1695 | + Retorna True si es una persona domiciliada o residente. Retorna |
1696 | + False si es, no Residente o No Domicialiado. |
1697 | + """ |
1698 | vendor_address = self._get_country_fiscal(cr, uid, vendor) |
1699 | buyer_address = self._get_country_fiscal(cr, uid, buyer) |
1700 | if vendor_address and buyer_address: |
1701 | @@ -851,9 +840,9 @@ |
1702 | return False |
1703 | |
1704 | def _get_nature(self, cr, uid, partner_id): |
1705 | - ''' |
1706 | - Se obtiene la naturaleza del vendedor a partir del RIF, retorna True si es persona de tipo natural, y False si es juridica. |
1707 | - ''' |
1708 | + """ Se obtiene la naturaleza del vendedor a partir del RIF, retorna |
1709 | + True si es persona de tipo natural, y False si es juridica. |
1710 | + """ |
1711 | if not partner_id.vat: |
1712 | raise osv.except_osv(_('Invalid action !'), _( |
1713 | "Impossible income withholding, because the partner '%s' has not vat associated!") % (partner_id.name)) |
1714 | @@ -865,11 +854,11 @@ |
1715 | return False |
1716 | |
1717 | def _get_rate(self, cr, uid, concept_id, residence, nature, context): |
1718 | - ''' |
1719 | - Se obtiene la tasa del concepto de retencion, siempre y cuando exista uno asociado a las especificaciones: |
1720 | - La naturaleza del vendedor coincida con una tasa. |
1721 | - La residencia del vendedor coindica con una tasa. |
1722 | - ''' |
1723 | + """ Se obtiene la tasa del concepto de retencion, siempre y |
1724 | + cuando exista uno asociado a las especificaciones: |
1725 | + La naturaleza del vendedor coincida con una tasa. |
1726 | + La residencia del vendedor coindica con una tasa. |
1727 | + """ |
1728 | ut_obj = self.pool.get('l10n.ut') |
1729 | rate_brw_lst = self.pool.get( |
1730 | 'islr.wh.concept').browse(cr, uid, concept_id).rate_ids |
1731 | @@ -884,9 +873,9 @@ |
1732 | return () |
1733 | |
1734 | def _get_country_fiscal(self, cr, uid, partner_id, context=None): |
1735 | - ''' |
1736 | - Get the country of the partner |
1737 | - ''' |
1738 | + """ Get the country of the partner |
1739 | + @param partner_id: partner id whom consult your country |
1740 | + """ |
1741 | # TODO: THIS METHOD SHOULD BE IMPROVED |
1742 | # DUE TO OPENER HAS CHANGED THE WAY PARTNER |
1743 | # ARE USED FOR ACCOUNT_MOVE |
1744 | @@ -898,6 +887,9 @@ |
1745 | return partner_id.country_id.id |
1746 | |
1747 | def _get_xml_lines(self, cr, uid, ail_brw, context=None): |
1748 | + """ Extract information from the document to generate xml lines |
1749 | + @param ail_brw: invoice of the document |
1750 | + """ |
1751 | context = context or {} |
1752 | vendor, buyer, wh_agent = self._get_partners( |
1753 | cr, uid, ail_brw.invoice_id) |
1754 | @@ -958,6 +950,8 @@ |
1755 | _description = 'Lines of Document Income Withholding' |
1756 | |
1757 | def _retention_rate(self, cr, uid, ids, name, args, context=None): |
1758 | + """ Return the retention rate of each line |
1759 | + """ |
1760 | res = {} |
1761 | for ret_line in self.browse(cr, uid, ids, context=context): |
1762 | if ret_line.invoice_id: |
1763 | |
1764 | === modified file 'l10n_ve_withholding_islr/model/islr_xml_wh.py' |
1765 | --- l10n_ve_withholding_islr/model/islr_xml_wh.py 2013-04-19 19:16:47 +0000 |
1766 | +++ l10n_ve_withholding_islr/model/islr_xml_wh.py 2013-04-27 02:25:32 +0000 |
1767 | @@ -41,6 +41,8 @@ |
1768 | _description = 'Generate XML' |
1769 | |
1770 | def _get_amount_total(self,cr,uid,ids,name,args,context=None): |
1771 | + """ Return withhold total amount |
1772 | + """ |
1773 | res = {} |
1774 | for xml in self.browse(cr,uid,ids,context): |
1775 | res[xml.id]= 0.0 |
1776 | @@ -49,6 +51,8 @@ |
1777 | return res |
1778 | |
1779 | def _get_amount_total_base(self,cr,uid,ids,name,args,context=None): |
1780 | + """ Return base total amount |
1781 | + """ |
1782 | res = {} |
1783 | for xml in self.browse(cr,uid,ids,context): |
1784 | res[xml.id]= 0.0 |
1785 | @@ -83,6 +87,8 @@ |
1786 | } |
1787 | |
1788 | def period_return(self,cr,uid,context=None): |
1789 | + """ Return current period |
1790 | + """ |
1791 | period_obj = self.pool.get('account.period') |
1792 | fecha = time.strftime('%m/%Y') |
1793 | period_id = period_obj.search(cr,uid,[('code','=',fecha)]) |
1794 | @@ -92,6 +98,9 @@ |
1795 | return False |
1796 | |
1797 | def search_period(self,cr,uid,ids,period_id,context=None): |
1798 | + """ Return islr lines associated with the period_id |
1799 | + @param period_id: period associated with returned islr lines |
1800 | + """ |
1801 | if context is None: |
1802 | context = {} |
1803 | res ={'value':{}} |
1804 | @@ -103,6 +112,8 @@ |
1805 | return res |
1806 | |
1807 | def name_get(self, cr, uid, ids, context={}): |
1808 | + """ Return id and name of all records |
1809 | + """ |
1810 | if not len(ids): |
1811 | return [] |
1812 | |
1813 | @@ -110,21 +121,28 @@ |
1814 | return res |
1815 | |
1816 | def action_anular1(self, cr, uid, ids, context={}): |
1817 | + """ Return the document to draft status |
1818 | + """ |
1819 | return self.write(cr, uid, ids, {'state':'draft'}) |
1820 | |
1821 | def action_confirm1(self, cr, uid, ids, context={}): |
1822 | + """ Passes the document to state confirmed |
1823 | + """ |
1824 | return self.write(cr, uid, ids, {'state':'confirmed'}) |
1825 | |
1826 | def action_done1(self, cr, uid, ids, context={}): |
1827 | + """ Passes the document to state done |
1828 | + """ |
1829 | root = self._xml(cr,uid,ids) |
1830 | self._write_attachment(cr,uid,ids,root,context) |
1831 | self.write(cr, uid, ids, {'state':'done'}) |
1832 | return True |
1833 | |
1834 | def _write_attachment(self, cr,uid,ids,root,context): |
1835 | - ''' |
1836 | - Codify the xml, to save it in the database and be able to see it in the client as an attachment |
1837 | - ''' |
1838 | + """ Codify the xml, to save it in the database and be able to |
1839 | + see it in the client as an attachment |
1840 | + @param root: data of the document in xml |
1841 | + """ |
1842 | fecha = time.strftime('%Y_%m_%d_%H%M%S') |
1843 | name = 'ISLR_' + fecha +'.'+ 'xml' |
1844 | self.pool.get('ir.attachment').create(cr, uid, { |
1845 | @@ -139,6 +157,10 @@ |
1846 | self.log(cr, uid, ids[0], _("File XML %s generated.") % name) |
1847 | |
1848 | def indent(self,elem, level=0): |
1849 | + """ Return indented text |
1850 | + @param level: number of spaces for indentation |
1851 | + @param elem: text to indentig |
1852 | + """ |
1853 | i = "\n" + level*" " |
1854 | if len(elem): |
1855 | if not elem.text or not elem.text.strip(): |
1856 | @@ -155,6 +177,8 @@ |
1857 | |
1858 | |
1859 | def _xml(self, cr,uid,ids): |
1860 | + """ Transform this document to XML format |
1861 | + """ |
1862 | root = '' |
1863 | for id in ids: |
1864 | wh_brw = self.browse(cr,uid,id) |
1865 | @@ -221,11 +245,16 @@ |
1866 | } |
1867 | |
1868 | def onchange_partner_vat(self, cr, uid, ids, partner_id, context={}): |
1869 | + """ Changing the partner, the partner_vat field is updated. |
1870 | + """ |
1871 | partner_brw = self.pool.get('res.partner').browse(cr,uid,partner_id) |
1872 | return {'value' : {'partner_vat':partner_brw.vat[2:]}} |
1873 | |
1874 | |
1875 | def onchange_code_perc(self, cr, uid, ids, rate_id, context={}): |
1876 | + """ Changing the rate of the islr, the porcent_rete and concept_code fields |
1877 | + is updated. |
1878 | + """ |
1879 | rate_brw = self.pool.get('islr.rates').browse(cr,uid,rate_id) |
1880 | return {'value' : {'porcent_rete':rate_brw.wh_perc,'concept_code':rate_brw.code}} |
1881 | |
1882 | |
1883 | === modified file 'l10n_ve_withholding_islr/model/partner.py' |
1884 | --- l10n_ve_withholding_islr/model/partner.py 2013-03-21 15:32:55 +0000 |
1885 | +++ l10n_ve_withholding_islr/model/partner.py 2013-04-27 02:25:32 +0000 |
1886 | @@ -46,8 +46,3 @@ |
1887 | 'islr_withholding_agent': lambda *a: True, |
1888 | } |
1889 | res_partner() |
1890 | - |
1891 | - |
1892 | - |
1893 | - |
1894 | - |
1895 | |
1896 | === modified file 'l10n_ve_withholding_islr/model/product.py' |
1897 | --- l10n_ve_withholding_islr/model/product.py 2013-04-24 19:47:03 +0000 |
1898 | +++ l10n_ve_withholding_islr/model/product.py 2013-04-27 02:25:32 +0000 |
1899 | @@ -46,10 +46,15 @@ |
1900 | class product_product(osv.osv): |
1901 | |
1902 | _inherit = "product.product" |
1903 | - ''' |
1904 | - Add a default concept for products that are not service type |
1905 | - ''' |
1906 | + |
1907 | + |
1908 | def onchange_product_type(self, cr, uid, ids, prd_type, context=None): |
1909 | + """ Add a default concept for products that are not service type, |
1910 | + Returns false if the product type is not a service, and if the |
1911 | + product is service, returns the first concept except 'No apply |
1912 | + withholding' |
1913 | + @param prd_type: product type new |
1914 | + """ |
1915 | concept_id = False |
1916 | if prd_type != 'service': |
1917 | concept_obj = self.pool.get('islr.wh.concept') |
1918 | @@ -62,6 +67,3 @@ |
1919 | return {'value' : {'concept_id':concept_id or False}} |
1920 | |
1921 | product_product() |
1922 | - |
1923 | - |
1924 | - |
1925 | |
1926 | === modified file 'l10n_ve_withholding_islr/model/rates.py' |
1927 | --- l10n_ve_withholding_islr/model/rates.py 2013-04-25 20:11:20 +0000 |
1928 | +++ l10n_ve_withholding_islr/model/rates.py 2013-04-27 02:25:32 +0000 |
1929 | @@ -34,17 +34,15 @@ |
1930 | from openerp.addons import decimal_precision as dp |
1931 | |
1932 | class islr_rates(osv.osv): |
1933 | - ''' |
1934 | - The module to create the rates of the withholding concepts |
1935 | - ''' |
1936 | + """ The module to create the rates of the withholding concepts |
1937 | + """ |
1938 | _name='islr.rates' |
1939 | _description = 'Rates' |
1940 | |
1941 | |
1942 | def _get_name(self,cr,uid,ids, field_name, arg, context): |
1943 | - ''' |
1944 | - Get the name of the withholding concept rate |
1945 | - ''' |
1946 | + """ Get the name of the withholding concept rate |
1947 | + """ |
1948 | res={} |
1949 | for rate in self.browse(cr,uid,ids): |
1950 | if rate.nature: |
1951 | @@ -72,6 +70,3 @@ |
1952 | 'concept_id': fields.many2one('islr.wh.concept','Withhold Concept',help="Withhold concept associated with this rate",required=False, ondelete='cascade'), |
1953 | } |
1954 | islr_rates() |
1955 | - |
1956 | - |
1957 | - |
1958 | |
1959 | === modified file 'l10n_ve_withholding_islr/report/list_wh_islr.py' |
1960 | --- l10n_ve_withholding_islr/report/list_wh_islr.py 2013-02-13 19:39:18 +0000 |
1961 | +++ l10n_ve_withholding_islr/report/list_wh_islr.py 2013-04-27 02:25:32 +0000 |
1962 | @@ -28,6 +28,7 @@ |
1963 | from openerp.osv import osv |
1964 | |
1965 | class list_wh_islr(report_sxw.rml_parse): |
1966 | + |
1967 | def __init__(self, cr, uid, name, context): |
1968 | super(list_wh_islr, self).__init__(cr, uid, name, context=context) |
1969 | |
1970 | |
1971 | === modified file 'l10n_ve_withholding_islr/report/wh_islr.py' |
1972 | --- l10n_ve_withholding_islr/report/wh_islr.py 2013-04-25 20:11:20 +0000 |
1973 | +++ l10n_ve_withholding_islr/report/wh_islr.py 2013-04-27 02:25:32 +0000 |
1974 | @@ -29,6 +29,7 @@ |
1975 | from openerp.tools.translate import _ |
1976 | |
1977 | class rep_comprobante_islr(report_sxw.rml_parse): |
1978 | + |
1979 | def __init__(self, cr, uid, name, context): |
1980 | super(rep_comprobante_islr, self).__init__(cr, uid, name, context=context) |
1981 | self.localcontext.update({ |
1982 | @@ -36,6 +37,8 @@ |
1983 | }) |
1984 | |
1985 | def _get_partner_addr(self, idp=False): |
1986 | + """ Return address of the partner |
1987 | + """ |
1988 | if not idp: |
1989 | return [] |
1990 | |
1991 | |
1992 | === modified file 'l10n_ve_withholding_islr/wizard/account_invoice_refund.py' |
1993 | --- l10n_ve_withholding_islr/wizard/account_invoice_refund.py 2013-03-01 17:48:52 +0000 |
1994 | +++ l10n_ve_withholding_islr/wizard/account_invoice_refund.py 2013-04-27 02:25:32 +0000 |
1995 | @@ -28,12 +28,11 @@ |
1996 | class account_invoice_refund(osv.osv_memory): |
1997 | |
1998 | """Refunds invoice""" |
1999 | + |
2000 | _inherit = 'account.invoice.refund' |
2001 | |
2002 | def validate_wh(self, cr, uid, ids, context=None): |
2003 | - """ |
2004 | - Method that validate if invoice has non-yet processed INCOME withholds. |
2005 | - |
2006 | + """ Method that validate if invoice has non-yet processed INCOME withholds. |
2007 | return: True: if invoice is does not have wh's or it does have and those ones are validated. |
2008 | False: if invoice is does have and those wh's are not yet validated. |
2009 | """ |
2010 | |
2011 | === modified file 'l10n_ve_withholding_iva/model/generate_txt.py' |
2012 | --- l10n_ve_withholding_iva/model/generate_txt.py 2013-04-22 17:19:13 +0000 |
2013 | +++ l10n_ve_withholding_iva/model/generate_txt.py 2013-04-27 02:25:32 +0000 |
2014 | @@ -39,6 +39,8 @@ |
2015 | _name = "txt.iva" |
2016 | |
2017 | def _get_amount_total(self,cr,uid,ids,name,args,context=None): |
2018 | + """ Return total amount withheld of each selected bill |
2019 | + """ |
2020 | context = context or {} |
2021 | res = {} |
2022 | for txt in self.browse(cr,uid,ids,context): |
2023 | @@ -51,6 +53,8 @@ |
2024 | return res |
2025 | |
2026 | def _get_amount_total_base(self,cr,uid,ids,name,args,context=None): |
2027 | + """ Return total amount base of each selected bill |
2028 | + """ |
2029 | context = context or {} |
2030 | res = {} |
2031 | for txt in self.browse(cr,uid,ids,context): |
2032 | @@ -76,8 +80,8 @@ |
2033 | 'date_start': fields.date('Begin Date',required=True,states={'draft':[('readonly',False)]}, help="Begin date of period"), |
2034 | 'date_end': fields.date('End date', required=True,states={'draft':[('readonly',False)]}, help="End date of period"), |
2035 | 'txt_ids':fields.one2many('txt.iva.line','txt_id', readonly=True,states={'draft':[('readonly',False)]}, help='Txt field lines of ar required by SENIAT for VAT withholding'), |
2036 | - 'amount_total_ret':fields.function(_get_amount_total,method=True, digits=(16, 2), readonly=True, string=' Total Monto de Retencion', help="Monto Total Retenido"), |
2037 | - 'amount_total_base':fields.function(_get_amount_total_base,method=True, digits=(16, 2), readonly=True, string='Total Base Imponible', help="Total de la Base Imponible"), |
2038 | + 'amount_total_ret':fields.function(_get_amount_total,method=True, digits=(16, 2), readonly=True, string='Withholding total amount', help="Monto Total Retenido"), |
2039 | + 'amount_total_base':fields.function(_get_amount_total_base,method=True, digits=(16, 2), readonly=True, string='Taxable total amount', help="Total de la Base Imponible"), |
2040 | } |
2041 | _defaults = { |
2042 | 'state': lambda *a: 'draft', |
2043 | @@ -90,6 +94,8 @@ |
2044 | } |
2045 | |
2046 | def period_return(self,cr,uid,context=None): |
2047 | + """ Return current period |
2048 | + """ |
2049 | context = context or {} |
2050 | period_obj = self.pool.get('account.period') |
2051 | fecha = time.strftime('%m/%Y') |
2052 | @@ -100,6 +106,8 @@ |
2053 | return False |
2054 | |
2055 | def name_get(self, cr, uid, ids, context=None): |
2056 | + """ Return a list with id and name of the current register |
2057 | + """ |
2058 | context = context or {} |
2059 | if not len(ids): |
2060 | return [] |
2061 | @@ -107,14 +115,20 @@ |
2062 | return res |
2063 | |
2064 | def action_anular(self, cr, uid, ids, context=None): |
2065 | + """ Return document state to draft |
2066 | + """ |
2067 | context = context or {} |
2068 | return self.write(cr, uid, ids, {'state':'draft'}) |
2069 | |
2070 | def action_confirm(self, cr, uid, ids, context=None): |
2071 | + """ Transfers the document status to confirmed |
2072 | + """ |
2073 | context = context or {} |
2074 | return self.write(cr, uid, ids, {'state':'confirmed'}) |
2075 | |
2076 | def action_generate_lines_txt(self,cr,uid,ids,context=None): |
2077 | + """ Current lines are cleaned and rebuilt |
2078 | + """ |
2079 | context = context or {} |
2080 | voucher_obj = self.pool.get('account.wh.iva') |
2081 | txt_iva_obj = self.pool.get('txt.iva.line') |
2082 | @@ -146,6 +160,8 @@ |
2083 | return True |
2084 | |
2085 | def action_done(self, cr, uid, ids, context=None): |
2086 | + """ Transfer the document status to done |
2087 | + """ |
2088 | context = context or {} |
2089 | root = self.generate_txt(cr,uid,ids) |
2090 | self._write_attachment(cr,uid,ids,root,context) |
2091 | @@ -154,6 +170,9 @@ |
2092 | return True |
2093 | |
2094 | def get_type_document(self,cr,uid,txt_line): |
2095 | + """ Return the document type |
2096 | + @param txt_line: line of the current document |
2097 | + """ |
2098 | type= '03' |
2099 | if txt_line.invoice_id.type in ['out_invoice','in_invoice']: |
2100 | type= '01' |
2101 | @@ -162,6 +181,9 @@ |
2102 | return type |
2103 | |
2104 | def get_document_affected(self,cr,uid,txt_line,context=None): |
2105 | + """ Return the reference or number depending of the case |
2106 | + @param txt_line: line of the current document |
2107 | + """ |
2108 | context = context or {} |
2109 | number='0' |
2110 | if txt_line.invoice_id.type in ['in_invoice','in_refund'] and txt_line.invoice_id.parent_id: |
2111 | @@ -171,6 +193,11 @@ |
2112 | return number |
2113 | |
2114 | def get_number(self,cr,uid,number,inv_type,long): |
2115 | + """ Return a list of number for document number |
2116 | + @param number: list of characters from number or reference of the bill |
2117 | + @param inv_type: invoice type |
2118 | + @param long: max size oh the number |
2119 | + """ |
2120 | if not number: |
2121 | return '0' |
2122 | result= '' |
2123 | @@ -184,6 +211,10 @@ |
2124 | return result[::-1].strip() |
2125 | |
2126 | def get_document_number(self,cr,uid,ids,txt_line,inv_type,context=None): |
2127 | + """ Return the number o reference of the invoice into txt line |
2128 | + @param txt_line: One line of the current txt document |
2129 | + @param inv_type: invoice type into txt line |
2130 | + """ |
2131 | context = context or {} |
2132 | number=0 |
2133 | if txt_line.invoice_id.type in ['in_invoice','in_refund']: |
2134 | @@ -196,6 +227,9 @@ |
2135 | return number |
2136 | |
2137 | def get_amount_exempt_document(self,cr,uid,txt_line): |
2138 | + """ Return total amount not entitled to tax credit and the remaining amounts |
2139 | + @param txt_line: One line of the current txt document |
2140 | + """ |
2141 | tax = 0 |
2142 | amount_doc = 0 |
2143 | for tax_line in txt_line.invoice_id.tax_line: |
2144 | @@ -206,6 +240,10 @@ |
2145 | return (tax,amount_doc) |
2146 | |
2147 | def get_buyer_vendor(self,cr,uid,txt,txt_line): |
2148 | + """ Return the buyer and vendor of the sale or purchase invoice |
2149 | + @param txt: current txt document |
2150 | + @param txt_line: One line of the current txt document |
2151 | + """ |
2152 | if txt_line.invoice_id.type in ['out_invoice','out_refund']: |
2153 | vendor = txt.company_id.partner_id.vat[2:] |
2154 | buyer = txt_line.partner_id.vat[2:] |
2155 | @@ -215,6 +253,9 @@ |
2156 | return (vendor,buyer) |
2157 | |
2158 | def get_alicuota(self,cr,uid,txt_line): |
2159 | + """ Return aliquot of the withholding into line |
2160 | + @param txt_line: One line of the current txt document |
2161 | + """ |
2162 | list = [] |
2163 | for tax_line in txt_line.invoice_id.tax_line: |
2164 | if '12' in tax_line.name: |
2165 | @@ -228,6 +269,8 @@ |
2166 | return max(list) |
2167 | |
2168 | def generate_txt(self,cr,uid,ids,context=None): |
2169 | + """ Return string with data of the current document |
2170 | + """ |
2171 | context = context or {} |
2172 | txt_string = '' |
2173 | for txt in self.browse(cr,uid,ids,context): |
2174 | @@ -257,10 +300,10 @@ |
2175 | return txt_string |
2176 | |
2177 | def _write_attachment(self, cr,uid,ids,root,context=None): |
2178 | + """ Encrypt txt, save it to the db and view it on the client as an attachment |
2179 | + @param root: location to save document |
2180 | + """ |
2181 | context = context or {} |
2182 | - ''' |
2183 | - Encrypt txt, save it to the db and view it on the client as an attachment |
2184 | - ''' |
2185 | fecha = time.strftime('%Y_%m_%d_%H%M%S') |
2186 | name = 'IVA_' + fecha +'.'+ 'txt' |
2187 | self.pool.get('ir.attachment').create(cr, uid, { |
2188 | |
2189 | === modified file 'l10n_ve_withholding_iva/model/installer.py' |
2190 | --- l10n_ve_withholding_iva/model/installer.py 2013-03-21 15:58:01 +0000 |
2191 | +++ l10n_ve_withholding_iva/model/installer.py 2013-04-27 02:25:32 +0000 |
2192 | @@ -29,14 +29,15 @@ |
2193 | import base64 |
2194 | |
2195 | class wh_vat_installer(osv.osv_memory): |
2196 | - """ |
2197 | - wh_vat_installer |
2198 | + """ wh_vat_installer |
2199 | """ |
2200 | _name='l10n_ve_withholding_iva.installer' |
2201 | _inherit = 'res.config.installer' |
2202 | _description = __doc__ |
2203 | |
2204 | def default_get(self, cr, uid, fields, context=None): |
2205 | + """ Return information relating to the withholding regime |
2206 | + """ |
2207 | data = super(wh_vat_installer, self).default_get(cr, uid, fields, context=context) |
2208 | gaceta = open(addons.get_module_resource('l10n_ve_withholding_iva','files', 'RegimendeRetencionesdelIVA.odt'),'rb') |
2209 | data['gaceta'] = base64.encodestring(gaceta.read()) |
2210 | @@ -78,16 +79,15 @@ |
2211 | } |
2212 | |
2213 | def _show_company_data(self, cr, uid, context=None): |
2214 | - ''' |
2215 | - We only want to show the default company data in demo mode, otherwise users tend to forget |
2216 | + """ We only want to show the default company data in demo mode, otherwise users tend to forget |
2217 | to fill in the real company data in their production databases |
2218 | - ''' |
2219 | + """ |
2220 | return self.pool.get('ir.model.data').get_object(cr, uid, |
2221 | 'base', |
2222 | 'module_meta_information').demo |
2223 | |
2224 | def default_get(self, cr, uid, fields_list=None, context=None): |
2225 | - """ get default company if any, and the various other fields |
2226 | + """ Get default company if any, and the various other fields |
2227 | from the company's fields |
2228 | """ |
2229 | defaults = super(wh_iva_config, self)\ |
2230 | @@ -104,6 +104,11 @@ |
2231 | return defaults |
2232 | |
2233 | def _create_journal(self, cr, uid, name, type, code): |
2234 | + """ Create a journal |
2235 | + @param name: journal name |
2236 | + @param type: journal type |
2237 | + @param code: code for journal |
2238 | + """ |
2239 | self.pool.get("account.journal").create(cr, uid, { |
2240 | 'name': name, |
2241 | 'type': type, |
2242 | @@ -112,8 +117,7 @@ |
2243 | ) |
2244 | |
2245 | def execute(self, cr, uid, ids, context=None): |
2246 | - ''' |
2247 | - In this method I will configure all needs for work out of the box with |
2248 | + """ In this method I will configure all needs for work out of the box with |
2249 | This module, |
2250 | First: Setting if The company will be agent of retention. |
2251 | Second: Create Minimal Journals. |
2252 | @@ -121,7 +125,7 @@ |
2253 | Fourth: Ask if you have internet conexion and you want to connect to |
2254 | SENIAT |
2255 | and update all your partners information. |
2256 | - ''' |
2257 | + """ |
2258 | user=self.pool.get('res.users').browse(cr,uid,[uid],context) |
2259 | wiz_data=self.read(cr,uid,ids[0],context) |
2260 | p_obj=self.pool.get('res.partner') |
2261 | |
2262 | === modified file 'l10n_ve_withholding_iva/model/invoice.py' |
2263 | --- l10n_ve_withholding_iva/model/invoice.py 2013-04-22 04:01:24 +0000 |
2264 | +++ l10n_ve_withholding_iva/model/invoice.py 2013-04-27 02:25:32 +0000 |
2265 | @@ -32,6 +32,8 @@ |
2266 | class account_invoice(osv.osv): |
2267 | _inherit = 'account.invoice' |
2268 | def _retenida(self, cr, uid, ids, name, args, context): |
2269 | + """ Verify whether withholding was applied to the invoice |
2270 | + """ |
2271 | res = {} |
2272 | if context is None: |
2273 | context = {} |
2274 | @@ -41,6 +43,8 @@ |
2275 | |
2276 | |
2277 | def _get_inv_from_line(self, cr, uid, ids, context={}): |
2278 | + """ Return invoice from journal items |
2279 | + """ |
2280 | context = context or {} |
2281 | move = {} |
2282 | for line in self.pool.get('account.move.line').browse(cr, uid, ids): |
2283 | @@ -56,6 +60,8 @@ |
2284 | return invoice_ids |
2285 | |
2286 | def _get_inv_from_reconcile(self, cr, uid, ids, context={}): |
2287 | + """ Return invoice from reconciled lines |
2288 | + """ |
2289 | context = context or {} |
2290 | move = {} |
2291 | for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids): |
2292 | @@ -85,7 +91,14 @@ |
2293 | |
2294 | def onchange_partner_id(self, cr, uid, ids, type, partner_id, |
2295 | date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): |
2296 | - |
2297 | + """ Return withholding iva rate of the partner and other data |
2298 | + @param type: Invoice type |
2299 | + @param partner_id: Partner id of the invoice |
2300 | + @param date_invoice: Date invoice |
2301 | + @param payment_term: Payment terms |
2302 | + @param partner_bank_id: Partner bank id of the invoice |
2303 | + @param company_id: Company id |
2304 | + """ |
2305 | data = super(account_invoice, self).onchange_partner_id(cr, uid, ids, type, partner_id, |
2306 | date_invoice, payment_term, partner_bank_id, company_id) |
2307 | if partner_id: |
2308 | @@ -95,6 +108,8 @@ |
2309 | |
2310 | |
2311 | def create(self, cr, uid, vals, context={}): |
2312 | + """ To the create an invoice is saved the withholding iva rate of the partner |
2313 | + """ |
2314 | context = context or {} |
2315 | partner_id = vals.get('partner_id',False) |
2316 | if partner_id: |
2317 | @@ -103,6 +118,8 @@ |
2318 | return super(account_invoice, self).create(cr, uid, vals, context) |
2319 | |
2320 | def copy(self, cr, uid, id, default=None, context=None): |
2321 | + """ Initialized fields to the copy a register |
2322 | + """ |
2323 | context = context or {} |
2324 | if default is None: |
2325 | default = {} |
2326 | @@ -112,6 +129,8 @@ |
2327 | return super(account_invoice, self).copy(cr, uid, id, default, context) |
2328 | |
2329 | def test_retenida(self, cr, uid, ids, *args): |
2330 | + """ Verify if this invoice is withhold |
2331 | + """ |
2332 | type2journal = {'out_invoice': 'iva_sale', 'in_invoice': 'iva_purchase', 'out_refund': 'iva_sale', 'in_refund': 'iva_purchase'} |
2333 | type_inv = self.browse(cr, uid, ids[0]).type |
2334 | type_journal = type2journal.get(type_inv, 'iva_purchase') |
2335 | @@ -130,6 +149,8 @@ |
2336 | |
2337 | |
2338 | def wh_iva_line_create(self, cr, uid, inv): |
2339 | + """ Create line with iva withholding |
2340 | + """ |
2341 | wh_iva_rate = inv.type in ('in_invoice', 'in_refund') and inv.partner_id.wh_iva_rate or inv.type in ('out_invoice', 'out_refund') and inv.company_id.partner_id.wh_iva_rate |
2342 | return (0, False, { |
2343 | 'name': inv.name or inv.number, |
2344 | @@ -138,6 +159,8 @@ |
2345 | }) |
2346 | |
2347 | def action_wh_iva_supervisor(self, cr, uid, ids, *args): |
2348 | + """ Validate the currencys are equal |
2349 | + """ |
2350 | user_obj= self.pool.get('res.users') |
2351 | user_brw= user_obj.browse(cr,uid,uid) |
2352 | |
2353 | @@ -154,6 +177,8 @@ |
2354 | |
2355 | |
2356 | def action_wh_iva_create(self, cr, uid, ids, *args): |
2357 | + """ Create iva whithholding line |
2358 | + """ |
2359 | wh_iva_obj = self.pool.get('account.wh.iva') |
2360 | for inv in self.browse(cr, uid, ids): |
2361 | if inv.wh_iva_id: |
2362 | @@ -183,6 +208,8 @@ |
2363 | return ret_id |
2364 | |
2365 | def button_reset_taxes_ret(self, cr, uid, ids, context=None): |
2366 | + """ Recalculate taxes in invoice |
2367 | + """ |
2368 | if not context: |
2369 | context = {} |
2370 | |
2371 | @@ -196,13 +223,17 @@ |
2372 | return True |
2373 | |
2374 | def button_reset_taxes(self, cr, uid, ids, context=None): |
2375 | + """ It makes two function calls related taxes reset |
2376 | + """ |
2377 | context = context or {} |
2378 | super(account_invoice, self).button_reset_taxes(cr, uid, ids, context) |
2379 | self.button_reset_taxes_ret(cr, uid, ids, context) |
2380 | |
2381 | return True |
2382 | |
2383 | - def _withholding_partner(self, cr, uid, ids, context=None): |
2384 | + def _withholding_partner(self, cr, uid, ids, context=None): |
2385 | + """ I verify that the provider retains or not |
2386 | + """ |
2387 | if context is None: |
2388 | context={} |
2389 | obj = self.browse(cr, uid, ids[0],context=context) |
2390 | @@ -214,20 +245,21 @@ |
2391 | return False |
2392 | |
2393 | def _withholdable_tax(self, cr, uid, ids, context=None): |
2394 | + """ Verify that existing withholding in invoice |
2395 | + """ |
2396 | if context is None: |
2397 | context={} |
2398 | return any([line.tax_id.ret for line in self.browse(cr, uid, ids[0], context=context).tax_line]) |
2399 | |
2400 | def check_withholdable(self, cr, uid, ids, context=None): |
2401 | - ''' |
2402 | - This will test for Refund invoice trying to find out |
2403 | + """ This will test for Refund invoice trying to find out |
2404 | if its regarding parent is in the same fortnight. |
2405 | |
2406 | return True if invoice is type 'in_invoice' |
2407 | return True if invoice is type 'in_refund' and parent_id invoice |
2408 | are both in the same fortnight. |
2409 | return False otherwise |
2410 | - ''' |
2411 | + """ |
2412 | per_obj = self.pool.get('account.period') |
2413 | if context is None: |
2414 | context={} |
2415 | @@ -242,6 +274,8 @@ |
2416 | return False |
2417 | |
2418 | def check_wh_apply(self, cr, uid, ids, context=None): |
2419 | + """ Apply withholding to the invoice |
2420 | + """ |
2421 | if context is None: |
2422 | context={} |
2423 | invo_brw = self.browse(cr,uid,ids[0],context=context) |
2424 | @@ -256,6 +290,16 @@ |
2425 | pay_journal_id, writeoff_acc_id, |
2426 | writeoff_period_id, writeoff_journal_id, date, |
2427 | name, context=None): |
2428 | + """ Generate move lines in corresponding account |
2429 | + @param to_wh: whether or not withheld |
2430 | + @param period_id: Period |
2431 | + @param pay_journal_id: pay journal of the invoice |
2432 | + @param writeoff_acc_id: account where canceled |
2433 | + @param writeoff_period_id: period where canceled |
2434 | + @param writeoff_journal_id: journal where canceled |
2435 | + @param date: current date |
2436 | + @param name: description |
2437 | + """ |
2438 | if context is None: context = {} |
2439 | res = super(account_invoice,self)._get_move_lines(cr, uid, ids, to_wh, period_id, |
2440 | pay_journal_id, writeoff_acc_id, |
2441 | @@ -288,8 +332,7 @@ |
2442 | return res |
2443 | |
2444 | def validate_wh_iva_done(self, cr, uid, ids, context=None): |
2445 | - """ |
2446 | - Method that check if wh vat is validated in invoice refund. |
2447 | + """ Method that check if wh vat is validated in invoice refund. |
2448 | @params: ids: list of invoices. |
2449 | return: True: the wh vat is validated. |
2450 | False: the wh vat is not validated. |
2451 | @@ -316,6 +359,8 @@ |
2452 | } |
2453 | |
2454 | def compute_amount_ret(self, cr, uid, invoice_id, context={}): |
2455 | + """ Calculate withholding amount |
2456 | + """ |
2457 | context = context or {} |
2458 | res = {} |
2459 | inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context) |
2460 | |
2461 | === modified file 'l10n_ve_withholding_iva/model/partner.py' |
2462 | --- l10n_ve_withholding_iva/model/partner.py 2013-03-01 10:53:41 +0000 |
2463 | +++ l10n_ve_withholding_iva/model/partner.py 2013-04-27 02:25:32 +0000 |
2464 | @@ -47,6 +47,11 @@ |
2465 | _inherit = 'seniat.url' |
2466 | |
2467 | def _parse_dom(self,cr,uid,dom,rif,url_seniat,context=None): |
2468 | + """ Extract iva rate and whether is withholding agent or not of the partner |
2469 | + @param dom: data from seniat page |
2470 | + @param rif: vat to partner to consult |
2471 | + @param url_seniat: seniat url |
2472 | + """ |
2473 | su_obj = self.pool.get('seniat.url') |
2474 | wh_agent = dom.childNodes[0].childNodes[1].firstChild.data.upper()=='SI' and True or False |
2475 | wh_rate = su_obj._buscar_porcentaje(cr, uid, rif) |
2476 | |
2477 | === modified file 'l10n_ve_withholding_iva/model/wh_iva.py' |
2478 | --- l10n_ve_withholding_iva/model/wh_iva.py 2013-03-21 15:58:01 +0000 |
2479 | +++ l10n_ve_withholding_iva/model/wh_iva.py 2013-04-27 02:25:32 +0000 |
2480 | @@ -43,6 +43,9 @@ |
2481 | class account_wh_iva_line_tax(osv.osv): |
2482 | |
2483 | def _set_amount_ret(self, cr, uid, id, name, value, arg, ctx=None): |
2484 | + """ Change withholding amount into iva line |
2485 | + @param value: new value for retention amount |
2486 | + """ |
2487 | if ctx is None: |
2488 | ctx = {} |
2489 | if not self.browse(cr,uid,id,context=ctx).wh_vat_line_id.retention_id.type=='out_invoice': |
2490 | @@ -54,6 +57,8 @@ |
2491 | return True |
2492 | |
2493 | def _get_amount_ret(self, cr, uid, ids, fieldname, args, context=None): |
2494 | + """ Return withholding amount |
2495 | + """ |
2496 | if context is None: context=None |
2497 | res = {} |
2498 | |
2499 | @@ -91,6 +96,9 @@ |
2500 | class account_wh_iva_line(osv.osv): |
2501 | |
2502 | def _get_tax_lines(self, cr, uid, tax_id_brw, context=None): |
2503 | + """ Return dictionary with tax line data |
2504 | + @param tax_id_brw: tax object |
2505 | + """ |
2506 | if context is None: context = {} |
2507 | return { |
2508 | 'inv_tax_id':tax_id_brw.id, |
2509 | @@ -103,8 +111,11 @@ |
2510 | } |
2511 | |
2512 | def load_taxes(self, cr, uid, ids, context=None): |
2513 | + """ Clean and load again tax lines of the withholding voucher |
2514 | + """ |
2515 | if context is None: context = {} |
2516 | awilt_obj = self.pool.get('account.wh.iva.line.tax') |
2517 | + |
2518 | for ret_line in self.browse(cr, uid, ids, context): |
2519 | lines = [] |
2520 | if ret_line.invoice_id: |
2521 | @@ -125,6 +136,8 @@ |
2522 | return True |
2523 | |
2524 | def _amount_all(self, cr, uid, ids, fieldname, args, context=None): |
2525 | + """ Return amount total each line |
2526 | + """ |
2527 | res = {} |
2528 | for ret_line in self.browse(cr, uid, ids, context): |
2529 | res[ret_line.id] = { |
2530 | @@ -157,6 +170,9 @@ |
2531 | ] |
2532 | |
2533 | def invoice_id_change(self, cr, uid, ids, invoice, context=None): |
2534 | + """ Return invoice data to assign to withholding vat |
2535 | + @param invoice: invoice for assign a withholding vat |
2536 | + """ |
2537 | if context is None: |
2538 | context = {} |
2539 | if not invoice: |
2540 | @@ -183,6 +199,8 @@ |
2541 | class account_wh_iva(osv.osv): |
2542 | |
2543 | def _amount_ret_all(self, cr, uid, ids, name, args, context=None): |
2544 | + """ Return withholding amount total each line |
2545 | + """ |
2546 | res = {} |
2547 | for retention in self.browse(cr, uid, ids, context): |
2548 | res[retention.id] = { |
2549 | @@ -196,12 +214,16 @@ |
2550 | return res |
2551 | |
2552 | def _get_type(self, cr, uid, context=None): |
2553 | + """ Return invoice type |
2554 | + """ |
2555 | if context is None: |
2556 | context = {} |
2557 | type = context.get('type', 'in_invoice') |
2558 | return type |
2559 | |
2560 | def _get_journal(self, cr, uid, context): |
2561 | + """ Return a iva journal depending of invoice type |
2562 | + """ |
2563 | if context is None: |
2564 | context = {} |
2565 | type_inv = context.get('type', 'in_invoice') |
2566 | @@ -214,6 +236,8 @@ |
2567 | return False |
2568 | |
2569 | def _get_currency(self, cr, uid, context): |
2570 | + """ Return currency to use |
2571 | + """ |
2572 | user = self.pool.get('res.users').browse(cr, uid, [uid])[0] |
2573 | if user.company_id: |
2574 | return user.company_id.currency_id.id |
2575 | @@ -261,12 +285,15 @@ |
2576 | |
2577 | } |
2578 | def action_cancel(self,cr,uid,ids,context={}): |
2579 | + """ Call cancel_move and return True |
2580 | + """ |
2581 | self.cancel_move(cr,uid,ids) |
2582 | return True |
2583 | |
2584 | |
2585 | def cancel_move(self,cr,uid,ids, *args): |
2586 | - |
2587 | + """ Delete move lines related with withholding vat and cancel |
2588 | + """ |
2589 | ret_brw = self.browse(cr, uid, ids) |
2590 | account_move_obj = self.pool.get('account.move') |
2591 | for ret in ret_brw: |
2592 | @@ -282,12 +309,19 @@ |
2593 | |
2594 | |
2595 | def _get_valid_wh(self, cr, uid, amount_ret, amount, wh_iva_rate, offset=0.5, context=None): |
2596 | - '''This method can be override in a way that |
2597 | - you can afford your own value for the offset''' |
2598 | + """ This method can be override in a way that |
2599 | + you can afford your own value for the offset |
2600 | + @param amount_ret: withholding amount |
2601 | + @param amount: invoice amount |
2602 | + @param wh_iva_rate: iva rate |
2603 | + @param offset: compensation |
2604 | + """ |
2605 | if context is None: context = {} |
2606 | return amount_ret >= amount * (wh_iva_rate - offset)/100.0 and amount_ret <= amount * (wh_iva_rate + offset)/100.0 |
2607 | |
2608 | def check_wh_taxes(self, cr, uid, ids, context=None): |
2609 | + """ Check that are valid and that amount retention is not greater than amount |
2610 | + """ |
2611 | if context is None: context = {} |
2612 | res = {} |
2613 | note = _('Taxes in the following invoices have been miscalculated\n\n') |
2614 | @@ -309,6 +343,8 @@ |
2615 | return True |
2616 | |
2617 | def check_vat_wh(self, cr, uid, ids, context={}): |
2618 | + """ Check whether the bill will need to withhold taxes |
2619 | + """ |
2620 | obj = self.browse(cr, uid, ids[0]) |
2621 | res = {} |
2622 | for wh_line in obj.wh_lines: |
2623 | @@ -324,9 +360,7 @@ |
2624 | return True |
2625 | |
2626 | def check_invoice_nro_ctrl(self, cr, uid, ids, context=None): |
2627 | - """ |
2628 | - Method that check if the control number of the invoice is set |
2629 | - |
2630 | + """ Method that check if the control number of the invoice is set |
2631 | Return: True if the control number is set, and raise an exception |
2632 | when is not. |
2633 | """ |
2634 | @@ -347,9 +381,7 @@ |
2635 | return True |
2636 | |
2637 | def write_wh_invoices(self, cr, uid, ids, context=None): |
2638 | - """ |
2639 | - Method that writes the wh vat id in sale invoices. |
2640 | - |
2641 | + """ Method that writes the wh vat id in sale invoices. |
2642 | Return: True: write successfully. |
2643 | False: write unsuccessfully. |
2644 | """ |
2645 | @@ -362,9 +394,8 @@ |
2646 | return True |
2647 | |
2648 | def _check_partner(self, cr, uid, ids, context={}): |
2649 | - ''' |
2650 | - Determine if a given partner is a VAT Withholding Agent |
2651 | - ''' |
2652 | + """ Determine if a given partner is a VAT Withholding Agent |
2653 | + """ |
2654 | agt = False |
2655 | obj = self.browse(cr, uid, ids[0]) |
2656 | if obj.type in ('out_invoice', 'out_refund') and obj.partner_id.wh_iva_agent: |
2657 | @@ -383,6 +414,8 @@ |
2658 | |
2659 | |
2660 | def wh_iva_seq_get(self, cr, uid, context=None): |
2661 | + """ Generate sequences for records of withholding iva |
2662 | + """ |
2663 | pool_seq=self.pool.get('ir.sequence') |
2664 | cr.execute("select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='account.wh.iva' and active=True") |
2665 | res = cr.dictfetchone() |
2666 | @@ -395,6 +428,8 @@ |
2667 | |
2668 | |
2669 | def action_number(self, cr, uid, ids, *args): |
2670 | + """ Update records numbers |
2671 | + """ |
2672 | obj_ret = self.browse(cr, uid, ids)[0] |
2673 | if obj_ret.type == 'in_invoice': |
2674 | cr.execute('SELECT id, number ' \ |
2675 | @@ -410,12 +445,16 @@ |
2676 | return True |
2677 | |
2678 | def action_date_ret(self,cr,uid,ids,context=None): |
2679 | + """ Undated records will be assigned the current date |
2680 | + """ |
2681 | for wh in self.browse(cr, uid, ids, context): |
2682 | wh.date_ret or self.write(cr, uid, [wh.id], {'date_ret':time.strftime('%Y-%m-%d')}) |
2683 | return True |
2684 | |
2685 | |
2686 | def action_move_create(self, cr, uid, ids, context=None): |
2687 | + """ Create movements associated with retention and reconcile |
2688 | + """ |
2689 | inv_obj = self.pool.get('account.invoice') |
2690 | user_obj = self.pool.get('res.users') |
2691 | per_obj = self.pool.get('account.period') |
2692 | @@ -464,6 +503,8 @@ |
2693 | return True |
2694 | |
2695 | def _withholdable_tax_(self, cr, uid, ids, context=None): |
2696 | + """ Return lines with withholdable taxes |
2697 | + """ |
2698 | if context is None: |
2699 | context={} |
2700 | account_invo_obj = self.pool.get('account.invoice') |
2701 | @@ -471,6 +512,11 @@ |
2702 | return acc_id |
2703 | |
2704 | def onchange_partner_id(self, cr, uid, ids, type, partner_id,context=None): |
2705 | + """ Changing the partner is again determinated accounts and lines retain |
2706 | + for document |
2707 | + @param type: invoice type |
2708 | + @param partner_id: vendor or buyer |
2709 | + """ |
2710 | if context is None: context = {} |
2711 | |
2712 | acc_id = False |
2713 | @@ -512,6 +558,9 @@ |
2714 | return res |
2715 | |
2716 | def _new_check(self, cr, uid, values, context={}): |
2717 | + """ Verify that the partner associated of the invoice is correct |
2718 | + @param values: Contain withholding lines, partner id and invoice_id |
2719 | + """ |
2720 | lst_inv = [] |
2721 | |
2722 | if 'wh_lines' in values and values['wh_lines']: |
2723 | @@ -533,6 +582,8 @@ |
2724 | return True |
2725 | |
2726 | def compute_amount_wh(self, cr, uid, ids, context=None): |
2727 | + """ Calculate withholding amount each line |
2728 | + """ |
2729 | res = {} |
2730 | if context is None: |
2731 | context = {} |
2732 | @@ -545,6 +596,8 @@ |
2733 | |
2734 | |
2735 | def copy(self, cr, uid, id, default=None, context=None): |
2736 | + """ Update fields when duplicating |
2737 | + """ |
2738 | if not default: |
2739 | default = {} |
2740 | if context is None: |
2741 | |
2742 | === modified file 'l10n_ve_withholding_iva/report/list_wh_iva.py' |
2743 | --- l10n_ve_withholding_iva/report/list_wh_iva.py 2013-02-13 19:39:18 +0000 |
2744 | +++ l10n_ve_withholding_iva/report/list_wh_iva.py 2013-04-27 02:25:32 +0000 |
2745 | @@ -52,40 +52,60 @@ |
2746 | }) |
2747 | |
2748 | def _get_total_amount_doc(self,doc_id): |
2749 | + """ Return iva total amount |
2750 | + """ |
2751 | total=0 |
2752 | for line in self.pool.get('txt.iva').browse(self.cr,self.uid, doc_id).txt_ids: |
2753 | total+=line.invoice_id.amount_total |
2754 | return total |
2755 | |
2756 | def _get_alicuota(self,txt_line): |
2757 | + """ Return alicuota |
2758 | + """ |
2759 | return self.pool.get('txt.iva').get_alicuota(self.cr,self.uid,txt_line) |
2760 | |
2761 | def _get_amount_exempt(self,txt_line): |
2762 | + """ Return amount exempt |
2763 | + """ |
2764 | amount_exempt,amount_untaxed = self.pool.get('txt.iva').get_amount_exempt_document(self.cr,self.uid,txt_line) |
2765 | self.total_amount_exempt+=amount_exempt |
2766 | return amount_exempt |
2767 | |
2768 | def _get_total_amount_exempt(self): |
2769 | + """ Return total amount exempt |
2770 | + """ |
2771 | return self.total_amount_exempt |
2772 | |
2773 | def _get_amount_untaxed(self,txt_line): |
2774 | + """ Return untaxed amount |
2775 | + """ |
2776 | amount_exempt,amount_untaxed = self.pool.get('txt.iva').get_amount_exempt_document(self.cr,self.uid,txt_line) |
2777 | self.total_amount_untaxed+=amount_untaxed |
2778 | return amount_untaxed |
2779 | |
2780 | def _get_total_amount_untaxed(self): |
2781 | + """ Return untaxed total amount |
2782 | + """ |
2783 | return self.total_amount_untaxed |
2784 | |
2785 | def _get_control_number(self,txt_line): |
2786 | + """ Return control number |
2787 | + """ |
2788 | return self.pool.get('txt.iva').get_number(self.cr,self.uid,txt_line.invoice_id.nro_ctrl,'inv_ctrl',20) |
2789 | |
2790 | def _get_type_document(self,line): |
2791 | + """ Return document type |
2792 | + """ |
2793 | return self.pool.get('txt.iva').get_type_document(self.cr,self.uid,line) |
2794 | |
2795 | def _get_document_number(self,txt_id,txt_line): |
2796 | + """ Return document number |
2797 | + """ |
2798 | return self.pool.get('txt.iva').get_document_number(self.cr,self.uid,txt_id,txt_line,'inv_number') |
2799 | |
2800 | def _get_document_affected(self,line): |
2801 | + """ Return affected document |
2802 | + """ |
2803 | return self.pool.get('txt.iva').get_document_affected(self.cr,self.uid,line) |
2804 | |
2805 | report_sxw.report_sxw( |
2806 | |
2807 | === modified file 'l10n_ve_withholding_iva/report/withholding_vat.py' |
2808 | --- l10n_ve_withholding_iva/report/withholding_vat.py 2013-04-25 20:11:20 +0000 |
2809 | +++ l10n_ve_withholding_iva/report/withholding_vat.py 2013-04-27 02:25:32 +0000 |
2810 | @@ -59,11 +59,14 @@ |
2811 | }) |
2812 | |
2813 | def _get_user(self): |
2814 | - |
2815 | + """ Return current user |
2816 | + """ |
2817 | return self.pool.get('res.users').browse(self.cr, self.uid, self.uid) |
2818 | |
2819 | |
2820 | def _get_partner_addr2(self, idp=False): |
2821 | + """ Return address2 partner |
2822 | + """ |
2823 | if not idp: |
2824 | return [] |
2825 | |
2826 | @@ -81,6 +84,8 @@ |
2827 | return addr_inv |
2828 | |
2829 | def _get_tipo_doc(self, tipo=None): |
2830 | + """ Return type doc |
2831 | + """ |
2832 | if not tipo: |
2833 | return [] |
2834 | |
2835 | @@ -90,7 +95,9 @@ |
2836 | |
2837 | |
2838 | |
2839 | - def _get_totales(self, comp_id): |
2840 | + def _get_totales(self, comp_id): |
2841 | + """ Return total amount |
2842 | + """ |
2843 | if not comp_id: |
2844 | return [] |
2845 | |
2846 | @@ -230,27 +237,41 @@ |
2847 | self.ttretencion = tot_iva_ret.get('s',0.0) - tot_iva_ret.get('r',0.0) |
2848 | return lst_comp |
2849 | |
2850 | - def _get_tot_gral_compra(self): |
2851 | + def _get_tot_gral_compra(self): |
2852 | + """ Return overall total purchase |
2853 | + """ |
2854 | return self.ttcompra |
2855 | |
2856 | - def _get_tot_gral_compra_scf(self): |
2857 | + def _get_tot_gral_compra_scf(self): |
2858 | + """ Return total general not entitled to tax credit |
2859 | + """ |
2860 | return self.ttcompra_sdcf |
2861 | |
2862 | - def _get_tot_gral_base(self): |
2863 | + def _get_tot_gral_base(self): |
2864 | + """ Return total general base |
2865 | + """ |
2866 | return self.ttbase |
2867 | |
2868 | - def _get_tot_gral_iva(self): |
2869 | + def _get_tot_gral_iva(self): |
2870 | + """ Return total general iva |
2871 | + """ |
2872 | return self.ttiva |
2873 | |
2874 | - def _get_tot_gral_retencion(self): |
2875 | + def _get_tot_gral_retencion(self): |
2876 | + """ Return total general retention |
2877 | + """ |
2878 | return self.ttretencion |
2879 | |
2880 | def _get_rif(self, vat=''): |
2881 | + """ Return RIF |
2882 | + """ |
2883 | if not vat: |
2884 | return [] |
2885 | return vat[2:].replace(' ', '') |
2886 | |
2887 | - def _get_tot_linea(self, base, iva): |
2888 | + def _get_tot_linea(self, base, iva): |
2889 | + """ Return linea total |
2890 | + """ |
2891 | return base + iva |
2892 | |
2893 | |
2894 | |
2895 | === modified file 'l10n_ve_withholding_iva/wizard/account_invoice_refund.py' |
2896 | --- l10n_ve_withholding_iva/wizard/account_invoice_refund.py 2013-03-01 17:48:52 +0000 |
2897 | +++ l10n_ve_withholding_iva/wizard/account_invoice_refund.py 2013-04-27 02:25:32 +0000 |
2898 | @@ -31,9 +31,7 @@ |
2899 | _inherit = 'account.invoice.refund' |
2900 | |
2901 | def validate_wh(self, cr, uid, ids, context=None): |
2902 | - """ |
2903 | - Method that validate if invoice has non-yet processed VAT withholds. |
2904 | - |
2905 | + """ Method that validate if invoice has non-yet processed VAT withholds. |
2906 | return: True: if invoice is does not have wh's or it does have and those ones are validated. |
2907 | False: if invoice is does have and those wh's are not yet validated. |
2908 | """ |
2909 | |
2910 | === modified file 'l10n_ve_withholding_muni/model/invoice.py' |
2911 | --- l10n_ve_withholding_muni/model/invoice.py 2013-02-28 16:24:39 +0000 |
2912 | +++ l10n_ve_withholding_muni/model/invoice.py 2013-04-27 02:25:32 +0000 |
2913 | @@ -34,6 +34,17 @@ |
2914 | pay_journal_id, writeoff_acc_id, |
2915 | writeoff_period_id, writeoff_journal_id, date, |
2916 | name, context=None): |
2917 | + """ Generate move lines in corresponding account |
2918 | + @param to_wh: whether or not withheld |
2919 | + @param period_id: Period |
2920 | + @param pay_journal_id: pay journal of the invoice |
2921 | + @param writeoff_acc_id: account where canceled |
2922 | + @param writeoff_period_id: period where canceled |
2923 | + @param writeoff_journal_id: journal where canceled |
2924 | + @param date: current date |
2925 | + @param name: description |
2926 | + """ |
2927 | + |
2928 | context = context or {} |
2929 | res = super(account_invoice, self)._get_move_lines(cr, uid, ids, to_wh, |
2930 | period_id, pay_journal_id, writeoff_acc_id, |
2931 | @@ -63,6 +74,8 @@ |
2932 | return res |
2933 | |
2934 | def _retenida_munici(self, cr, uid, ids, name, args, context=None): |
2935 | + """ Check that all is well in the log lines |
2936 | + """ |
2937 | context = context or {} |
2938 | res = {} |
2939 | for id in ids: |
2940 | @@ -70,6 +83,8 @@ |
2941 | return res |
2942 | |
2943 | def test_retenida_muni(self, cr, uid, ids, *args): |
2944 | + """ Check that all lines having their share account |
2945 | + """ |
2946 | type2journal = {'out_invoice': 'mun_sale', |
2947 | 'out_refund': 'mun_sale', |
2948 | 'in_invoice': 'mun_purchase', |
2949 | @@ -91,6 +106,8 @@ |
2950 | return ok |
2951 | |
2952 | def _get_inv_munici_from_line(self, cr, uid, ids, context=None): |
2953 | + """ Return invoice from journal items |
2954 | + """ |
2955 | context = context or {} |
2956 | move = {} |
2957 | aml_brw = self.pool.get('account.move.line').browse(cr, uid, ids) |
2958 | @@ -108,6 +125,8 @@ |
2959 | return invoice_ids |
2960 | |
2961 | def _get_inv_munici_from_reconcile(self, cr, uid, ids, context=None): |
2962 | + """ Return invoice from reconciled lines |
2963 | + """ |
2964 | context = context or {} |
2965 | move = {} |
2966 | amr_brw = self.pool.get('account.move.reconcile').browse(cr, uid, ids) |
2967 | |
2968 | === modified file 'l10n_ve_withholding_muni/model/wh_muni.py' |
2969 | --- l10n_ve_withholding_muni/model/wh_muni.py 2013-04-22 20:09:48 +0000 |
2970 | +++ l10n_ve_withholding_muni/model/wh_muni.py 2013-04-27 02:25:32 +0000 |
2971 | @@ -34,12 +34,17 @@ |
2972 | class account_wh_munici(osv.osv): |
2973 | |
2974 | def _get_type(self, cr, uid, context=None): |
2975 | + """ Return invoice type |
2976 | + """ |
2977 | if context is None: |
2978 | context = {} |
2979 | type = context.get('type', 'in_invoice') |
2980 | return type |
2981 | |
2982 | def _get_journal(self, cr, uid, context=None): |
2983 | + """ Return the journal to the journal items that coresspond to local |
2984 | + retention depending on the invoice |
2985 | + """ |
2986 | if context is None: |
2987 | context = {} |
2988 | type_inv = context.get('type', 'in_invoice') |
2989 | @@ -54,6 +59,8 @@ |
2990 | return False |
2991 | |
2992 | def _get_currency(self, cr, uid, context=None): |
2993 | + """ Return company currency |
2994 | + """ |
2995 | if context is None: |
2996 | context = {} |
2997 | user = self.pool.get('res.users').browse(cr, uid, [uid])[0] |
2998 | @@ -108,6 +115,8 @@ |
2999 | ] |
3000 | |
3001 | def action_confirm(self, cr, uid, ids, context=None): |
3002 | + """ Verifies the amount withheld and the document is confirmed |
3003 | + """ |
3004 | if context is None: |
3005 | context = {} |
3006 | obj = self.pool.get('account.wh.munici').browse(cr, uid, ids) |
3007 | @@ -121,6 +130,8 @@ |
3008 | return True |
3009 | |
3010 | def action_number(self, cr, uid, ids, *args): |
3011 | + """ Generate sequence for empty number fields in account_wh_munici records |
3012 | + """ |
3013 | obj_ret = self.browse(cr, uid, ids)[0] |
3014 | if obj_ret.type == 'in_invoice': |
3015 | cr.execute('SELECT id, number ' |
3016 | @@ -136,6 +147,8 @@ |
3017 | return True |
3018 | |
3019 | def action_done(self, cr, uid, ids, context=None): |
3020 | + """ The document is done |
3021 | + """ |
3022 | if context is None: |
3023 | context = {} |
3024 | self.action_number(cr, uid, ids) |
3025 | @@ -143,6 +156,8 @@ |
3026 | return True |
3027 | |
3028 | def action_move_create(self, cr, uid, ids, context=None): |
3029 | + """ Create movements associated with retention and reconcile |
3030 | + """ |
3031 | if context is None: |
3032 | context = {} |
3033 | inv_obj = self.pool.get('account.invoice') |
3034 | @@ -192,6 +207,10 @@ |
3035 | return True |
3036 | |
3037 | def onchange_partner_id(self, cr, uid, ids, type, partner_id): |
3038 | + """ Changing the partner is again determinated accounts and lines retain for document |
3039 | + @param type: invoice type |
3040 | + @param partner_id: vendor or buyer |
3041 | + """ |
3042 | acc_id = False |
3043 | if partner_id: |
3044 | p = self.pool.get('res.partner').browse(cr, uid, partner_id) |
3045 | @@ -208,6 +227,8 @@ |
3046 | return result |
3047 | |
3048 | def _update_check(self, cr, uid, ids, partner_id, context=None): |
3049 | + """ Check if the invoices are selected partner |
3050 | + """ |
3051 | if context is None: |
3052 | context = {} |
3053 | if ids: |
3054 | @@ -224,6 +245,8 @@ |
3055 | return True |
3056 | |
3057 | def _new_check(self, cr, uid, values, context=None): |
3058 | + """ Check amount withheld and Check if the invoices are selected partner |
3059 | + """ |
3060 | if context is None: |
3061 | context = {} |
3062 | lst_inv = [] |
3063 | @@ -249,6 +272,8 @@ |
3064 | return True |
3065 | |
3066 | def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True): |
3067 | + """ Validate invoices before update records |
3068 | + """ |
3069 | if context is None: |
3070 | context = {} |
3071 | ret = self.browse(cr, uid, ids[0]) |
3072 | @@ -261,6 +286,8 @@ |
3073 | return super(account_wh_munici, self).write(cr, uid, ids, vals, context=context) |
3074 | |
3075 | def create(self, cr, uid, vals, context=None, check=True): |
3076 | + """ Validate before create record |
3077 | + """ |
3078 | if context is None: |
3079 | context = {} |
3080 | if check: |
3081 | @@ -274,6 +301,8 @@ |
3082 | class account_wh_munici_line(osv.osv): |
3083 | |
3084 | def default_get(self, cr, uid, fields, context=None): |
3085 | + """ Default for munici_context field |
3086 | + """ |
3087 | if context is None: |
3088 | context = {} |
3089 | data = super(account_wh_munici_line, self).default_get(cr, |
3090 | @@ -307,6 +336,9 @@ |
3091 | ] |
3092 | |
3093 | def onchange_invoice_id(self, cr, uid, ids, invoice_id, context=None): |
3094 | + """ Validate that the bill is no longer assigned to retention |
3095 | + @param invoice_id: invoice id |
3096 | + """ |
3097 | if context is None: |
3098 | context = {} |
3099 | lines = [] |
3100 | @@ -319,8 +351,7 @@ |
3101 | ok = True |
3102 | res = self.pool.get( |
3103 | 'account.invoice').browse(cr, uid, invoice_id, context) |
3104 | - cr.execute( |
3105 | - 'select retention_id from account_wh_munici_line where invoice_id=%s', |
3106 | + cr.execute('select retention_id from account_wh_munici_line where invoice_id=%s', |
3107 | (invoice_id,)) |
3108 | ret_ids = cr.fetchone() |
3109 | ok = ok and bool(ret_ids) |
3110 | |
3111 | === modified file 'l10n_ve_withholding_muni/report/wh_muni_report.py' |
3112 | --- l10n_ve_withholding_muni/report/wh_muni_report.py 2013-04-22 20:09:48 +0000 |
3113 | +++ l10n_ve_withholding_muni/report/wh_muni_report.py 2013-04-27 02:25:32 +0000 |
3114 | @@ -39,6 +39,8 @@ |
3115 | }) |
3116 | |
3117 | def _get_partner_addr(self, idp=False): |
3118 | + """ Return partner address |
3119 | + """ |
3120 | if not idp: |
3121 | return [] |
3122 | |
3123 | @@ -51,6 +53,8 @@ |
3124 | |
3125 | |
3126 | def _get_rif(self, vat=''): |
3127 | + """ Return partner rif |
3128 | + """ |
3129 | if not vat: |
3130 | return [] |
3131 | return vat[2:].replace(' ', '') |
3132 | |
3133 | === modified file 'l10n_ve_withholding_src/model/invoice.py' |
3134 | --- l10n_ve_withholding_src/model/invoice.py 2013-03-21 16:14:09 +0000 |
3135 | +++ l10n_ve_withholding_src/model/invoice.py 2013-04-27 02:25:32 +0000 |
3136 | @@ -33,7 +33,14 @@ |
3137 | |
3138 | def onchange_partner_id(self, cr, uid, ids, type, partner_id,\ |
3139 | date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): |
3140 | - |
3141 | + """ Change invoice information depending of the partner |
3142 | + @param type: Invoice type |
3143 | + @param partner_id: Partner id of the invoice |
3144 | + @param date_invoice: Date invoice |
3145 | + @param payment_term: Payment terms |
3146 | + @param partner_bank_id: Partner bank id of the invoice |
3147 | + @param company_id: Company id |
3148 | + """ |
3149 | p = self.pool.get('res.partner').browse(cr, uid, partner_id) |
3150 | c = self.pool.get('res.partner').browse(cr, uid, uid) |
3151 | res = super(account_invoice,self).onchange_partner_id(cr, uid, ids, type, \ |
3152 | @@ -49,6 +56,8 @@ |
3153 | return res |
3154 | |
3155 | def _retenida(self, cr, uid, ids, name, args, context): |
3156 | + """ Verify whether withholding was applied to the invoice |
3157 | + """ |
3158 | res = {} |
3159 | if context is None: |
3160 | context = {} |
3161 | @@ -57,6 +66,8 @@ |
3162 | return res |
3163 | |
3164 | def _get_inv_from_line(self, cr, uid, ids, context={}): |
3165 | + """ Returns invoice from journal items |
3166 | + """ |
3167 | move = {} |
3168 | for line in self.pool.get('account.move.line').browse(cr, uid, ids): |
3169 | if line.reconcile_partial_id: |
3170 | @@ -71,6 +82,8 @@ |
3171 | return invoice_ids |
3172 | |
3173 | def _get_inv_from_reconcile(self, cr, uid, ids, context={}): |
3174 | + """ Return invoice from reconciled lines |
3175 | + """ |
3176 | move = {} |
3177 | for r in self.pool.get('account.move.reconcile').browse(cr, uid, ids): |
3178 | for line in r.line_partial_ids: |
3179 | @@ -84,8 +97,8 @@ |
3180 | return invoice_ids |
3181 | |
3182 | def _check_retention(self, cr, uid, ids, context=None): |
3183 | - '''This method will check the retention value will be maximum 5% |
3184 | - ''' |
3185 | + """ This method will check the retention value will be maximum 5% |
3186 | + """ |
3187 | if context is None: context = {} |
3188 | |
3189 | invoice_brw = self.browse(cr, uid,ids) |
3190 | @@ -114,6 +127,16 @@ |
3191 | pay_journal_id, writeoff_acc_id, |
3192 | writeoff_period_id, writeoff_journal_id, date, |
3193 | name, context=None): |
3194 | + """ Generate move lines in corresponding account |
3195 | + @param to_wh: whether or not withheld |
3196 | + @param period_id: Period |
3197 | + @param pay_journal_id: pay journal of the invoice |
3198 | + @param writeoff_acc_id: account where canceled |
3199 | + @param writeoff_period_id: period where canceled |
3200 | + @param writeoff_journal_id: journal where canceled |
3201 | + @param date: current date |
3202 | + @param name: description |
3203 | + """ |
3204 | if context is None: context = {} |
3205 | res = super(account_invoice,self)._get_move_lines(cr, uid, ids, to_wh, period_id, |
3206 | pay_journal_id, writeoff_acc_id, |
3207 | |
3208 | === modified file 'l10n_ve_withholding_src/model/wh_src.py' |
3209 | --- l10n_ve_withholding_src/model/wh_src.py 2013-04-18 21:03:12 +0000 |
3210 | +++ l10n_ve_withholding_src/model/wh_src.py 2013-04-27 02:25:32 +0000 |
3211 | @@ -34,6 +34,8 @@ |
3212 | class account_wh_src(osv.osv): |
3213 | |
3214 | def name_get(self, cursor, user, ids, context=None): |
3215 | + """ To generate a name for src record |
3216 | + """ |
3217 | if isinstance(ids, (int, long)): |
3218 | ids = [ids] |
3219 | if not ids: |
3220 | @@ -52,11 +54,16 @@ |
3221 | return res |
3222 | |
3223 | def _get_uid_wh_agent(self, cr, uid, context=None): |
3224 | + """ Return true if current partner is social responsability agent and |
3225 | + return false in otherwise |
3226 | + """ |
3227 | context = context or {} |
3228 | user_wh_agent = self.pool.get('res.partner').browse(cr, uid, uid, context=context).wh_src_agent |
3229 | return user_wh_agent |
3230 | |
3231 | def _get_partner_agent(self, cr, uid, context=None): |
3232 | + """ Return a list of browse partner depending of invoice type |
3233 | + """ |
3234 | context = context or {} |
3235 | |
3236 | obj_partner = self.pool.get('res.partner') |
3237 | @@ -73,6 +80,9 @@ |
3238 | return l |
3239 | |
3240 | def default_get(self, cr, uid, fields, context=None): |
3241 | + """ Update fields uid_wh_agent and partner_list to the create a |
3242 | + record |
3243 | + """ |
3244 | context = context or {} |
3245 | res = super(account_wh_src, self).default_get(cr, uid, fields, context=context) |
3246 | res.update({'uid_wh_agent': self._get_uid_wh_agent(cr,uid,context=context) }) |
3247 | @@ -81,11 +91,15 @@ |
3248 | return res |
3249 | |
3250 | def _get_p_agent(self, cr, uid, ids, field_name, args, context=None): |
3251 | + """ Create a dictionary with ids partner and their browse item |
3252 | + """ |
3253 | context = context or {} |
3254 | res= {}.fromkeys(ids,self._get_partner_agent(cr,uid,context=context)) |
3255 | return res |
3256 | |
3257 | def _get_wh_agent(self, cr, uid, ids, field_name, args, context=None): |
3258 | + """ Create a dictionary with ids agent partner and their browse item |
3259 | + """ |
3260 | context = context or {} |
3261 | res= {}.fromkeys(ids,self._get_uid_wh_agent(cr,uid,context=context)) |
3262 | return res |
3263 | @@ -123,12 +137,14 @@ |
3264 | } |
3265 | |
3266 | def _diario(self, cr, uid, model, context=None): |
3267 | + """ Return journal to use in purchase or sale |
3268 | + """ |
3269 | if context is None: |
3270 | context={} |
3271 | ir_model_data = self.pool.get('ir.model.data') |
3272 | - journal_purchase=ir_model_data.search(cr, uid, [('model','=','account.journal'),('module','=','l10n_ve_withholding_src'),('name','=','withholding_scr_purchase_journal')]) |
3273 | - journal_sale=ir_model_data.search(cr, uid, [('model','=','account.journal'),('module','=','l10n_ve_withholding_src'),('name','=','withholding_src_sale_journal')]) |
3274 | - ir_model_purchase_brw=ir_model_data.browse(cr, uid, journal_purchase, context=context) |
3275 | + journal_purchase = ir_model_data.search(cr, uid, [('model','=','account.journal'),('module','=','l10n_ve_withholding_src'),('name','=','withholding_scr_purchase_journal')]) |
3276 | + journal_sale = ir_model_data.search(cr, uid, [('model','=','account.journal'),('module','=','l10n_ve_withholding_src'),('name','=','withholding_src_sale_journal')]) |
3277 | + ir_model_purchase_brw = ir_model_data.browse(cr, uid, journal_purchase, context=context) |
3278 | ir_model_sale_brw=ir_model_data.browse(cr, uid, journal_sale, context=context) |
3279 | if context.get('type') == 'in_invoice': |
3280 | return ir_model_purchase_brw[0].res_id |
3281 | @@ -150,6 +166,10 @@ |
3282 | ] |
3283 | |
3284 | def onchange_partner_id(self, cr, uid, ids, type, partner_id,context=None): |
3285 | + """ Return account depending of the invoice |
3286 | + @param type: invoice type |
3287 | + @param partner_id: partner id |
3288 | + """ |
3289 | if context is None: context = {} |
3290 | acc_id = False |
3291 | res = {} |
3292 | @@ -176,12 +196,16 @@ |
3293 | |
3294 | |
3295 | def action_date_ret(self,cr,uid,ids,context=None): |
3296 | + """ if the retention date is empty, is filled with the current date |
3297 | + """ |
3298 | for wh in self.browse(cr, uid, ids, context): |
3299 | wh.date_ret or self.write(cr, uid, [wh.id], {'date_ret':time.strftime('%Y-%m-%d')}) |
3300 | return True |
3301 | |
3302 | |
3303 | def action_draft(self, cr, uid, ids, context={}): |
3304 | + """ Passes the document to draft status |
3305 | + """ |
3306 | if context is None: |
3307 | context={} |
3308 | inv_obj = self.pool.get('account.invoice') |
3309 | @@ -194,6 +218,8 @@ |
3310 | return self.write(cr,uid,ids[0],{'state':'draft'}) |
3311 | |
3312 | def action_confirm(self, cr, uid, ids, context={}): |
3313 | + """ Retention is valid to pass a status confirmed |
3314 | + """ |
3315 | if context is None: |
3316 | context={} |
3317 | inv_obj = self.pool.get('account.invoice') |
3318 | @@ -221,6 +247,8 @@ |
3319 | return self.write(cr,uid,ids[0],{'state':'confirmed'}) |
3320 | |
3321 | def action_done(self, cr, uid, ids, context=None): |
3322 | + """ Pass the document to state done |
3323 | + """ |
3324 | if context is None: |
3325 | context = {} |
3326 | |
3327 | @@ -231,10 +259,14 @@ |
3328 | return self.write(cr,uid,ids,{'state':'done'}) |
3329 | |
3330 | def action_cancel(self,cr,uid,ids,context={}): |
3331 | + """ Still not allowed to cancel these withholdings |
3332 | + """ |
3333 | raise osv.except_osv(_('Invalid Procedure!'),_("For the moment, the systmen does not allow cancell these withholdings.")) |
3334 | return True |
3335 | |
3336 | def copy(self,cr,uid,id,default,context=None): |
3337 | + """ Lines can not be duplicated in this model |
3338 | + """ |
3339 | raise osv.except_osv('Invalid Procedure!',"You can not duplicate lines") |
3340 | return True |
3341 | |
3342 | @@ -245,7 +277,8 @@ |
3343 | |
3344 | |
3345 | def action_move_create(self, cr, uid, ids, context=None): |
3346 | - |
3347 | + """ Build account moves related to withholding invoice |
3348 | + """ |
3349 | inv_obj = self.pool.get('account.invoice') |
3350 | if context is None: context = {} |
3351 | |
3352 | @@ -297,6 +330,8 @@ |
3353 | return True |
3354 | |
3355 | def action_number(self, cr, uid, ids, *args): |
3356 | + """ Is responsible for generating a number for the document if it does not have one |
3357 | + """ |
3358 | obj_ret = self.browse(cr, uid, ids)[0] |
3359 | if obj_ret.type == 'in_invoice': |
3360 | cr.execute('SELECT id, number ' \ |
3361 | @@ -315,6 +350,8 @@ |
3362 | |
3363 | |
3364 | def wh_src_confirmed(self, cr, uid, ids): |
3365 | + """ Confirm src document |
3366 | + """ |
3367 | number = self.pool.get('account.wh.src.line') |
3368 | return True |
3369 | |
3370 | @@ -343,6 +380,12 @@ |
3371 | ] |
3372 | |
3373 | def onchange_invoice_id(self, cr, uid, ids, type, invoice_id=False,base_amount=0.0,wh_src_rate=5.0,context=None): |
3374 | + """ Change src information to change the invoice |
3375 | + @param type: invoice type |
3376 | + @param invoice_id: new invoice id |
3377 | + @param base_amount: new base amount |
3378 | + @param wh_src_rate: new rate of the withhold src |
3379 | + """ |
3380 | if context is None: context = {} |
3381 | res = {} |
3382 | inv_obj = self.pool.get('account.invoice') |
3383 | |
3384 | === modified file 'l10n_ve_withholding_src/report/wh_src_report.py' |
3385 | --- l10n_ve_withholding_src/report/wh_src_report.py 2013-02-13 19:39:18 +0000 |
3386 | +++ l10n_ve_withholding_src/report/wh_src_report.py 2013-04-27 02:25:32 +0000 |
3387 | @@ -19,6 +19,8 @@ |
3388 | |
3389 | |
3390 | def get_empresa(self, partner_id): |
3391 | + """ Get information company |
3392 | + """ |
3393 | obj_addr = self.pool.get('res.partner') |
3394 | res = {} |
3395 | for row in obj_addr.browse(self.cr, self.uid, partner_id): |
3396 | |
3397 | === modified file 'l10n_ve_withholding_src/wizard/wizard_retention.py' |
3398 | --- l10n_ve_withholding_src/wizard/wizard_retention.py 2013-02-28 16:24:39 +0000 |
3399 | +++ l10n_ve_withholding_src/wizard/wizard_retention.py 2013-04-27 02:25:32 +0000 |
3400 | @@ -32,6 +32,8 @@ |
3401 | _description = "Wizard that changes the retention value" |
3402 | |
3403 | def set_retention(self, cr, uid, ids, context=None): |
3404 | + """ Change value of the retention |
3405 | + """ |
3406 | if context is None: |
3407 | context={} |
3408 | data = self.pool.get('wiz.retention').read(cr, uid, ids)[0] |
to merge this before than https:/ /code.launchpad .net/~vauxoo/ openerp- venezuela- localization/ ovl70-rev- taskovl- yani/+merge/ 161270