Merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fb-imex-rev-kty into lp:openerp-venezuela-localization

Proposed by Katherine Zaoral (Vauxoo)
Status: Merged
Merged at revision: 830
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/ovl70-fb-imex-rev-kty
Merge into: lp:openerp-venezuela-localization
Diff against target: 2660 lines (+769/-1119)
17 files modified
l10n_ve_fiscal_book/model/fiscal_book.py (+5/-5)
l10n_ve_fiscal_book/report/book.py (+0/-403)
l10n_ve_fiscal_book/report/fiscal_book_parser.py (+11/-11)
l10n_ve_imex/__init__.py (+27/-0)
l10n_ve_imex/__openerp__.py (+54/-29)
l10n_ve_imex/i18n/es_VE.po (+95/-95)
l10n_ve_imex/model/__init__.py (+29/-2)
l10n_ve_imex/model/customs_form.py (+241/-288)
l10n_ve_imex/model/customs_form_config.py (+97/-140)
l10n_ve_imex/model/invoice.py (+120/-49)
l10n_ve_imex/security/ir.model.access.csv (+10/-12)
l10n_ve_imex/security/ir_rule.xml (+6/-6)
l10n_ve_imex/view/customs_form.xml (+18/-23)
l10n_ve_imex/view/customs_form_config.xml (+23/-23)
l10n_ve_imex/view/customs_form_menus.xml (+24/-24)
l10n_ve_imex/view/invoice.xml (+2/-2)
l10n_ve_imex/workflow/customs_form.xml (+7/-7)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/ovl70-fb-imex-rev-kty
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Pending
Review via email: mp+161483@code.launchpad.net

Description of the change

first revision imex

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'l10n_ve_fiscal_book/model/fiscal_book.py'
2--- l10n_ve_fiscal_book/model/fiscal_book.py 2013-04-25 16:22:59 +0000
3+++ l10n_ve_fiscal_book/model/fiscal_book.py 2013-04-29 19:14:27 +0000
4@@ -797,7 +797,7 @@
5 or False,
6 'accounting_date': (not imex_invoice) and \
7 inv_brw.date_invoice or False,
8- 'imex_date': imex_invoice and inv_brw.num_import_form_id.date_liq or False,
9+ 'imex_date': imex_invoice and inv_brw.customs_form_id.date_liq or False,
10 'invoice_is_imported': imex_invoice,
11 'debit_affected': inv_brw.parent_id \
12 and inv_brw.parent_id.type in ['in_invoice', 'out_invoice'] \
13@@ -821,7 +821,7 @@
14 or '01-REG',
15 'fiscal_printer': inv_brw.fiscal_printer or False,
16 'invoice_printer': inv_brw.invoice_printer or False,
17- 'custom_statement': inv_brw.num_import_form_id.name or False,
18+ 'custom_statement': inv_brw.customs_form_id.name or False,
19 'iwdl_id': (iwdl_id and iwdl_id not in no_match_dt_iwdl_ids) \
20 and iwdl_id or False,
21 'wh_number': (iwdl_id and iwdl_id not in no_match_dt_iwdl_ids) \
22@@ -1097,14 +1097,14 @@
23 return inv_brw.reference or False
24
25 def is_invoice_imex(self, cr, uid, inv_id, context=None):
26- """ Boolean method that verify is a invoice is imported.
27+ """ Boolean method that verify is a invoice is imported by cheking the
28+ customs form associated.
29 @param inv_id: invoice id
30 """
31 context = context or {}
32 inv_obj = self.pool.get('account.invoice')
33 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)
34- return inv_brw.company_id.partner_id.country_id.id != \
35- inv_brw.partner_id.country_id.id and True or False
36+ return inv_brw.customs_form_id and True or False
37
38
39 class fiscal_book_lines(orm.Model):
40
41=== removed file 'l10n_ve_fiscal_book/report/book.py'
42--- l10n_ve_fiscal_book/report/book.py 2013-04-16 16:53:35 +0000
43+++ l10n_ve_fiscal_book/report/book.py 1970-01-01 00:00:00 +0000
44@@ -1,403 +0,0 @@
45-#!/usr/bin/python
46-# -*- encoding: utf-8 -*-
47-###########################################################################
48-# Module Writen to OpenERP, Open Source Management Solution
49-# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
50-# All Rights Reserved
51-###############Credits######################################################
52-# Coded by: Luis Escobar <luis@vauxoo.com>
53-# Tulio Ruiz <tulio@vauxoo.com>
54-# Planified by: Nhomar Hernandez
55-#############################################################################
56-# This program is free software: you can redistribute it and/or modify
57-# it under the terms of the GNU General Public License as published by
58-# the Free Software Foundation, either version 3 of the License, or
59-# (at your option) any later version.
60-#
61-# This program is distributed in the hope that it will be useful,
62-# but WITHOUT ANY WARRANTY; without even the implied warranty of
63-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64-# GNU General Public License for more details.
65-#
66-# You should have received a copy of the GNU General Public License
67-# along with this program. If not, see <http://www.gnu.org/licenses/>.
68-##############################################################################
69-
70-'''
71-Fiscal Report For Venezuela
72-'''
73-
74-import time
75-from openerp.report import report_sxw
76-import openerp.pooler
77-
78-class sal_book(report_sxw.rml_parse):
79- '''
80- Generates sales book
81- '''
82-
83- def __init__(self, cr, uid, name, context):
84- '''
85- Reference to the current instance
86- '''
87- super(sal_book, self).__init__(cr, uid, name, context)
88- self._company_id = self.pool.get('res.users').browse(self.cr,self.uid,uid).company_id.id
89-
90- self.localcontext.update({
91- 'time': time,
92- 'get_data':self._get_data,
93- 'get_partner_addr': self._get_partner_addr,
94- 'get_p_country': self._get_p_country,
95- 'get_rif': self._get_rif,
96- 'get_month':self._get_month,
97- 'get_ret':self._get_ret,
98- 'get_data_adjustment': self._get_data_adjustment,
99- 'validation': self._validation,
100- 'get_data_wh': self._get_data_wh,
101- 'get_amount_withheld': self._get_amount_withheld,
102- 'get_date_wh': self._get_date_wh,
103-# 'get_v_sdcf': self._get_v_sdcf,
104- 'get_v_exent': self._get_v_exent,
105- 'get_tax_line': self._get_tax_line,
106- 'get_total_wh': self._get_total_wh,
107- 'get_total_iva': self._get_total_iva,
108- 'get_amount_untaxed_tax': self._get_amount_untaxed_tax,
109-# 'get_taxes': self._get_taxes,
110- 'get_wh_actual': self._get_wh_actual,
111- 'get_id': self._get_id,
112-# 'get_papel_anulado': self._get_papel_anulado,
113- })
114-
115- def _get_partner_addr(self):
116- '''
117- Obtains the address of partner
118- '''
119- addr_obj = self.pool.get('res.partner')
120- addr_inv = 'NO HAY DIRECCION FISCAL DEFINIDA'
121- if self._company_id:
122- addr = addr_obj.browse(self.cr,self.uid, self._company_id)
123- addr_inv = addr.type == 'invoice' and (addr.street or '')+' '+(addr.street2 or '')+' '+ \
124- (addr.zip or '')+ ' '+(addr.city or '')+ ' '+ \
125- (addr.country_id and addr.country_id.name or '')+ \
126- ', TELF.:'+(addr.phone or '') or 'NO HAY DIRECCION FISCAL DEFINIDA'
127- return addr_inv
128-
129- def _get_book_type(self,form):
130- book_type=None
131- book_type='fiscal.reports.sale'
132- if form['type']=='purchase':
133- book_type='fiscal.reports.purchase'
134-
135- return book_type
136-
137- def _get_p_country(self, idp=None):
138- '''
139- Obtains the address of partner
140- '''
141- if not idp:
142- return []
143-
144- addr_obj = self.pool.get('res.partner')
145- a_id = 1000
146- if idp:
147- a = addr_obj.browse(self.cr,self.uid, idp)
148- a_id = addr.type == 'invoice' and a.country_id.id or 1000
149- return a_id
150-
151- def _get_book_type_wh(self, form):
152- book_type=None
153- book_type='fiscal.reports.whs'
154- if form['type']=='purchase':
155- book_type='fiscal.reports.whp'
156- return book_type
157-
158- def _get_data(self, form):
159- book_type=self._get_book_type(form)
160- res = []
161- fr_obj = self.pool.get('account.invoice')
162- criteria = [('date_invoice', '<=', form['date_end']),
163- ('date_invoice', '>=', form['date_start']),
164- ('state', 'in',[ 'done', 'paid', 'open']),
165- ('import_spreadsheet', '=', False),
166- ('company_id', '=', self._company_id)]
167- if form['type'] == 'sale':
168- criteria.append(('type', 'in', ['out_refund', 'out_invoice']))
169- elif form['type'] == 'purchase':
170- criteria.append(('type', 'in', ['in_refund', 'in_invoice']))
171-
172- fr_ids = fr_obj.search(self.cr, self.uid,
173- criteria, order='date_invoice,nro_ctrl,number')
174- if len(fr_ids)>0:
175- res = fr_obj.browse(self.cr, self.uid, fr_ids)
176- self._invs_ids = fr_ids
177- self._data = res
178- else:
179- self._invs_ids = []
180- self._data = []
181- return res
182-
183- def _get_data_wh(self,form):
184-# data=[]
185-# d1=form['date_start']
186-# d2=form['date_end']
187-# fr_obj = self.pool.get('fiscal.reports.whs')
188-# fr_ids = fr_obj.search(self.cr,self.uid,
189-# [ ('ar_date_ret', '<=', d2),
190-# ('ar_date_ret', '>=',d1),
191-# ('ar_date_document','<=',d1),
192-# ('ai_company', '=', self._company_id)], order='ar_date_ret')
193-# data = fr_obj.browse(self.cr,self.uid, fr_ids)
194-
195-
196- data=[]
197- d1=form['date_start']
198- d2=form['date_end']
199- fr_obj = self.pool.get('account.wh.iva')
200- fr_ids = fr_obj.search(self.cr,self.uid,
201- [ ('date_ret', '<=', d2),
202- ('date_ret', '>=',d1),
203- ('date','<=',d1),
204- ('state', '=', 'done'),
205- ('wh_lines.invoice_id.type', 'in', ['out_invoice', 'out_refund']),
206- ('wh_lines.invoice_id.company_id.id', '=', self._company_id)], order='ar_date_ret')
207- data = fr_obj.browse(self.cr,self.uid, fr_ids)
208- return data
209-
210- def _get_rif(self, vat=''):
211- '''
212- Get R.I.F.
213- '''
214- if not vat:
215- return []
216- return vat[2:].replace(' ', '')
217-
218- def _get_month(self, form):
219- '''
220- return year and month
221- '''
222- months=["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"]
223- res = ['',0]
224- res[0] = months[time.strptime(form['date_start'],"%Y-%m-%d")[1]-1]
225- res[1] = time.strptime(form['date_start'],"%Y-%m-%d")[0]
226- return res
227-
228- def _get_ret(self, form, inv_id):
229- '''
230- Ensure that Withholding date is inside period specified on form.
231- '''
232- d1=form['date_start']
233- d2=form['date_end']
234- wil_obj = self.pool.get('account.wh.iva.line')
235- wil_ids= wil_obj.search(self.cr,self.uid,[('invoice_id', '=', inv_id)])
236- wil_brw = wil_obj.browse(self.cr, self.uid, wil_ids)
237-
238- if form['type']=='purchase':
239- return wil_brw[0].retention_id.number
240-
241- if wil_brw:
242- if time.strptime(wil_brw[0].retention_id.date, '%Y-%m-%d') >= time.strptime(d1, '%Y-%m-%d') \
243- and time.strptime(wil_brw[0].retention_id.date, '%Y-%m-%d') <= time.strptime(d2, '%Y-%m-%d'):
244- return wil_brw[0].retention_id.number
245- else:
246- return False
247- else:
248- return False
249-
250- def _get_date_wh(self,form, l):
251- if l.ar_date_document> form['date_end']:
252- return False
253- return True
254-
255- def _get_data_adjustment(self,form):
256-
257- type_doc = 'sale'
258- if form['type']=='purchase':
259- type_doc = 'purchase'
260- fb_obj = self.pool.get('fiscal.book')
261- adjust_line_obj = self.pool.get('adjustment.book.line')
262- period_obj=self.pool.get('account.period')
263- data=[]
264- data_line=[]
265- period_ids = period_obj.search(self.cr,self.uid,[('date_start','<=',form['date_start']),('date_stop','>=',form['date_end']), ('company_id', '=', self._company_id)])
266-
267- if len(period_ids)>0:
268- fr_ids = fb_obj.search(self.cr,self.uid,[('period_id', 'in',period_ids),('type','=',type_doc)])
269- if len(fr_ids)>0:
270- adj_ids = adjust_line_obj.search(self.cr,self.uid,[('fb_id','=',fr_ids[0])],order='date_admin')
271- data = fb_obj.browse(self.cr,self.uid, fr_ids)
272- data_line = adjust_line_obj.browse(self.cr,self.uid, adj_ids)
273- return (data,data_line)
274-
275- def _validation(self,form):
276- type_doc = 'sale'
277- if form['type']=='purchase':
278- type_doc = 'purchase'
279- period_obj=self.pool.get('account.period')
280- fb_obj = self.pool.get('fiscal.book')
281- period_ids = period_obj.search(self.cr,self.uid,[('date_start','<=',form['date_start']),('date_stop','>=',form['date_end']), ('company_id', '=', self._company_id)])
282- if len(period_ids)<=0:
283- return False
284- fr_ids = fb_obj.search(self.cr,self.uid,[('period_id','in',period_ids),('type','=',type_doc)])
285- if len(fr_ids)<=0:
286- return False
287- return True
288-
289- def _get_amount_withheld(self, form, inv):
290- wil_obj = self.pool.get('account.wh.iva.line')
291- wil_ids = wil_obj.search(self.cr, self.uid, [('invoice_id', '=', inv.id)])
292- amount = 0.0
293- if wil_ids:
294- data = wil_obj.browse(self.cr, self.uid, wil_ids)[0]
295- if data.retention_id:
296- if data.retention_id.date_ret < form['date_end']:
297- if inv.type in ['in_refund', 'out_refund']:
298- amount = data.amount_tax_ret*(-1)
299- else:
300- amount = data.amount_tax_ret
301-
302-# get_date_wh(data['form'],l)
303-# and (get_ret(data['form'], l.id)
304-# and (formatLang(((l.type in ['in_refund', 'out_refund'])
305-# and (self.get_amount_withheld(l.ar_line_id.id)*(-1))
306-# or get_amount_withheld(l.ar_line_id.id))))
307-# or '')
308-# or ''
309- return amount
310-
311- def _get_total_wh(self,form,actual=None):
312- total=0
313- for inv in self._data:
314- amount = self._get_amount_withheld(form, inv)
315- if amount:
316- total+= amount
317- return total
318-
319- def _get_total_iva(self,form):
320- '''
321- Return Amount Total of each invoice at Withholding Vat
322- '''
323- total = 0.0
324- for i in self._data:
325- if i.type in ['out_refund']:
326- total += i.get_total*(-1.0)
327- else:
328- total += i.get_total
329- return total
330-
331- def _get_amount_untaxed_tax(self, form, percent, nationality='', exempt=None):
332- '''
333- Return Amount Untaxed and Amount Tax, accorded percent of withholding vat
334- '''
335- amount_untaxed=0.0
336- amount_tax=0.0
337-
338- for d in self._data:
339- for tax in d.tax_line:
340- if percent in tax.name:
341- if exempt is not None:
342- if d.partner_id.vat_subjected==exempt:
343- amount_untaxed+= self._get_amount_untaxed_tax2(d.type,tax)[0]
344- amount_tax+= self._get_amount_untaxed_tax2(d.type,tax)[1]
345- else:
346- if nationality == 'nacional' and not d.get_is_imported:
347- amount_untaxed+= self._get_amount_untaxed_tax2(d.type,tax)[0]
348- amount_tax+= self._get_amount_untaxed_tax2(d.type,tax)[1]
349- elif nationality == 'internacional' and d.get_is_imported:
350- amount_untaxed+= self._get_amount_untaxed_tax2(d.type,tax)[0]
351- amount_tax+= self._get_amount_untaxed_tax2(d.type,tax)[1]
352- elif nationality == 'all' or not nationality:
353- amount_untaxed+= self._get_amount_untaxed_tax2(d.type,tax)[0]
354- amount_tax+= self._get_amount_untaxed_tax2(d.type,tax)[1]
355- return (amount_untaxed, amount_tax)
356-
357- def _get_wh_actual(self,form):
358- total=0
359- data=[]
360- book_type= self._get_book_type_wh(form)
361- fr_obj = self.pool.get('account.wh.iva')
362-
363-# fr_ids = fr_obj.search(self.cr,self.uid,
364-# [('date_ret', '<=', form['date_end']),
365-# ('date_ret', '>=', form['date_start']),
366-# ('wh_lines.invoice_id.date_invoice','>=',form['date_start']),
367-# ('wh_lines.invoice_id.date_invoice','<=',form['date_end']),
368-# ('wh_lines.invoice_id.company_id.id', '=', self._company_id)])
369- fr_ids = fr_obj.search(self.cr,self.uid,
370- [('date_ret', '<=', form['date_end']),
371- ('date_ret', '>=', form['date_start']),
372- ('wh_lines.invoice_id.id','in',self._invs_ids)])
373- data = fr_obj.browse(self.cr,self.uid, fr_ids)
374- for wh in data:
375- for wh_line in wh.wh_lines:
376- if wh_line.invoice_id.type in ['in_refund', 'out_refund']:
377- total+= wh_line.amount_tax_ret * (-1)
378- else:
379- total+= wh_line.amount_tax_ret
380- return total
381-
382- def _get_id(self,form,idh,type=None):
383- x=1
384- ids =None
385-
386- if form['type']=='sale':
387- ids = self._get_data_wh(form)
388- if form['type']=='sale' and type:
389- x+=len(ids)
390- if type=='book':
391- ids = self._get_data(form)
392-
393- for a in ids:
394- if a.id != idh:
395- x+=1
396- else:
397- return x
398-
399- def _get_tax_line(self,s):
400- name = s.name
401- cont = 0
402- if name.find('SDCF')>=0:
403- if cont==0:
404- return 0
405- else:
406- cont = cont + 1
407- return s.base_amount
408-
409- def _get_v_exent(self,l):
410- amount = 0.0
411- if not l:
412- return 0.0
413- for tax in l.tax_line:
414- name=tax.name
415- if name.find('EXENTO')>=0:
416- amount = tax.base+amount
417- if l.type in ['in_refund', 'out_refund']:
418- amount = amount * (-1)
419- return (amount)
420-
421- def _get_amount_untaxed_tax2(self,type,tax):
422- amount_untaxed=0.0
423- amount_tax=0.0
424- if type in ['in_refund', 'out_refund']:
425- amount_untaxed= tax.base * (-1)
426- amount_tax= tax.amount * (-1)
427- else:
428- amount_untaxed= tax.base
429- amount_tax= tax.amount
430- return [amount_untaxed,amount_tax]
431-
432-report_sxw.report_sxw(
433- 'report.fiscal.book.sale',
434- 'account.invoice',
435- 'addons/l10n_ve_fiscal_book/report/sales_book.rml',
436- parser=sal_book,
437- header=False
438-)
439-
440-report_sxw.report_sxw(
441- 'report.fiscal.book.purchase',
442- 'account.invoice',
443- 'addons/l10n_ve_fiscal_book/report/purchases_book.rml',
444- parser=sal_book,
445- header=False
446-)
447-
448
449=== modified file 'l10n_ve_fiscal_book/report/fiscal_book_parser.py'
450--- l10n_ve_fiscal_book/report/fiscal_book_parser.py 2013-04-24 19:04:42 +0000
451+++ l10n_ve_fiscal_book/report/fiscal_book_parser.py 2013-04-29 19:14:27 +0000
452@@ -325,19 +325,19 @@
453 #~ configuring:
454 self._add_total_string()
455
456- print '\n-----------------------------'
457- print 'Number of columns', self._get_num_of_cols(),' + 1 at first'
458- print 'Table width', self._get_table_width()
459- print 'Colums widths'
460- for col_num, col_tag in enumerate(self._purchase_cols_list, start=1):
461- print ' ', col_num, '\t', self._get_col_width(col_tag), '\t', self._cols[col_tag]['name']
462- print '-----------------------------\n'
463+ #~ print '\n-----------------------------'
464+ #~ print 'Number of columns', self._get_num_of_cols(),' + 1 at first'
465+ #~ print 'Table width', self._get_table_width()
466+ #~ print 'Colums widths'
467+ #~ for col_num, col_tag in enumerate(self._purchase_cols_list, start=1):
468+ #~ print ' ', col_num, '\t', self._get_col_width(col_tag), '\t', self._cols[col_tag]['name']
469+ #~ print '-----------------------------\n'
470
471 self._set_macro_cols_width()
472- print 'importaciones', 'compras-internas', 'datos-factura-documento', \
473- '"', self._cols['datos-factura-documento']['width'], ', ', \
474- self._cols['importaciones']['width'], ', ', \
475- self._cols['compras-internas']['width'], '"'
476+ #~ print 'importaciones', 'compras-internas', 'datos-factura-documento', \
477+ #~ '"', self._cols['datos-factura-documento']['width'], ', ', \
478+ #~ self._cols['importaciones']['width'], ', ', \
479+ #~ self._cols['compras-internas']['width'], '"'
480
481 def _get_month(self, fb):
482 """
483
484=== modified file 'l10n_ve_imex/__init__.py'
485--- l10n_ve_imex/__init__.py 2013-04-04 21:42:17 +0000
486+++ l10n_ve_imex/__init__.py 2013-04-29 19:14:27 +0000
487@@ -1,1 +1,28 @@
488+# -*- encoding: utf-8 -*-
489+###############################################################################
490+# Module Writen to OpenERP, Open Source Management Solution
491+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
492+# All Rights Reserved
493+############# Credits #########################################################
494+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
495+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
496+# Planified by:
497+# Juan Marquez <jmarquez@tecvemar.com.ve>
498+# Humberto Arocha <hbto@vauxoo.com>
499+# Audited by: Humberto Arocha <hbto@vauxoo.com>
500+###############################################################################
501+# This program is free software: you can redistribute it and/or modify
502+# it under the terms of the GNU Affero General Public License as
503+# published by the Free Software Foundation, either version 3 of the
504+# License, or (at your option) any later version.
505+#
506+# This program is distributed in the hope that it will be useful,
507+# but WITHOUT ANY WARRANTY; without even the implied warranty of
508+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
509+# GNU Affero General Public License for more details.
510+#
511+# You should have received a copy of the GNU Affero General Public License
512+# along with this program. If not, see <http://www.gnu.org/licenses/>.
513+###############################################################################
514+
515 import model
516
517=== modified file 'l10n_ve_imex/__openerp__.py'
518--- l10n_ve_imex/__openerp__.py 2013-04-15 20:24:04 +0000
519+++ l10n_ve_imex/__openerp__.py 2013-04-29 19:14:27 +0000
520@@ -1,34 +1,59 @@
521 # -*- encoding: utf-8 -*-
522-##############################################################################
523-# Company: Tecvemar, c.a.
524-# Author: Juan Marquez
525-# Creation Date: 13/09/2012
526-# Version: 0.0.0.1
527-#
528-# Description: This modules handles the l10n ve import declaration
529-# SENIAT Official FORM: Forma 99086
530-#
531-##############################################################################
532+###############################################################################
533+# Module Writen to OpenERP, Open Source Management Solution
534+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
535+# All Rights Reserved
536+############# Credits #########################################################
537+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
538+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
539+# Planified by:
540+# Juan Marquez <jmarquez@tecvemar.com.ve>
541+# Humberto Arocha <hbto@vauxoo.com>
542+# Audited by: Humberto Arocha <hbto@vauxoo.com>
543+###############################################################################
544+# This program is free software: you can redistribute it and/or modify
545+# it under the terms of the GNU Affero General Public License as
546+# published by the Free Software Foundation, either version 3 of the
547+# License, or (at your option) any later version.
548+#
549+# This program is distributed in the hope that it will be useful,
550+# but WITHOUT ANY WARRANTY; without even the implied warranty of
551+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
552+# GNU Affero General Public License for more details.
553+#
554+# You should have received a copy of the GNU Affero General Public License
555+# along with this program. If not, see <http://www.gnu.org/licenses/>.
556+###############################################################################
557+
558 {
559- "name" : "L10n ve - Import/Export",
560- "version" : "0.1",
561- "depends" : ["base", "account", "decimal_precision", "l10n_ve_fiscal_requirements"],
562- "author" : "Tecvemar - Juan Márquez",
563- "description" : "Import/Export SENIAT Forma 99086",
564- "website" : "https://code.launchpad.net/~jmarquez/openerp-tecvemar/l10n_ve_imex",
565- "category" : "Custom",
566- "init_xml" : [],
567- "demo_xml" : [],
568- "update_xml" : [
569- 'security/ir.model.access.csv',
570- 'security/ir_rule.xml',
571- 'view/seniat_form_86_config.xml',
572- 'view/seniat_form_86.xml',
573- 'view/seniat_form_86_menus.xml',
574- 'view/invoice.xml',
575- 'workflow/seniat_form_86.xml',
576- ],
577+ "name": "Imex",
578+ "version": "0.1",
579+ "depends": ["base",
580+ "account",
581+ "decimal_precision",
582+ "l10n_ve_fiscal_requirements"
583+ ],
584+ "author": "Tecvemar/Vauxoo",
585+ "description": """
586+Imex
587+===============================================================
588+This modules handles the openerp venezuela localization import
589+and export transactions. It specify the customs form model for
590+import declaration SENIAT Official FORM (Forma 99086).
591+""",
592+ "website": "http://vauxoo.com",
593+ "category": "Generic Modules/Accounting",
594+ "init_xml": [],
595+ "demo_xml": [],
596+ "update_xml": [
597+ 'security/ir.model.access.csv',
598+ 'security/ir_rule.xml',
599+ 'view/customs_form_config.xml',
600+ 'view/customs_form.xml',
601+ 'view/customs_form_menus.xml',
602+ 'view/invoice.xml',
603+ 'workflow/customs_form.xml',
604+ ],
605 "active": False,
606 "installable": True,
607 }
608-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
609
610=== modified file 'l10n_ve_imex/i18n/es_VE.po'
611--- l10n_ve_imex/i18n/es_VE.po 2013-04-11 14:28:42 +0000
612+++ l10n_ve_imex/i18n/es_VE.po 2013-04-29 19:14:27 +0000
613@@ -16,12 +16,12 @@
614 "Plural-Forms: \n"
615
616 #. module: l10n_ve_imex
617-#: field:form.86.custom.taxes,account_id:0
618+#: field:customs.duty,account_id:0
619 msgid "Account to pay"
620 msgstr "Cuentas por Pagar"
621
622 #. module: l10n_ve_imex
623-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:157
624+#: code:addons/l10n_ve_imex/model/customs_form.py:157
625 #, python-format
626 msgid "SENIAT - Forma 86 # %s):\n"
627 " Reference: %s\n"
628@@ -31,179 +31,179 @@
629 " Agente: %s"
630
631 #. module: l10n_ve_imex
632-#: help:account.invoice,num_import_form_id:0
633+#: help:account.invoice,customs_form_id:0
634 msgid "The related form 86 for this import invoice (only draft and open forms)"
635 msgstr "La planilla de importacion (F86) asociada a esta factura (solo planillas en borador y abiertas)"
636
637 #. module: l10n_ve_imex
638-#: sql_constraint:form.86.config:0
639+#: sql_constraint:customs.form.config:0
640 msgid "The company must be unique!"
641 msgstr "La Compañía debe ser unica!"
642
643 #. module: l10n_ve_imex
644-#: help:form.86.custom.taxes,account_id:0
645+#: help:customs.duty,account_id:0
646 msgid "This account will be used for expenses related to taxes"
647 msgstr "Cuenta para los gastos asociados a el impuesto"
648
649 #. module: l10n_ve_imex
650-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:145
651+#: code:addons/l10n_ve_imex/model/customs_form.py:145
652 #, python-format
653 msgid "Please set a valid configuration"
654 msgstr "Debe establecer una configuración válida"
655
656 #. module: l10n_ve_imex
657-#: field:seniat.form.86.lines,tax_code:0
658+#: field:customs.form.line,tax_code:0
659 msgid "Tax"
660 msgstr "Impuesto"
661
662 #. module: l10n_ve_imex
663-#: field:seniat.form.86,custom_id:0
664+#: field:customs.form,customs_facility_id:0
665 msgid "Custom"
666 msgstr "Aduana"
667
668 #. module: l10n_ve_imex
669-#: sql_constraint:form.86.custom.taxes:0
670+#: sql_constraint:customs.duty:0
671 msgid "The code must be unique! (for this comany)"
672 msgstr "El código debe ser único! (para la companía)"
673
674 #. module: l10n_ve_imex
675-#: field:seniat.form.86,state:0
676+#: field:customs.form,state:0
677 msgid "State"
678 msgstr "Estado"
679
680 #. module: l10n_ve_imex
681-#: view:seniat.form.86:0
682+#: view:customs.form:0
683 msgid "Other"
684 msgstr "Otros"
685
686 #. module: l10n_ve_imex
687-#: selection:seniat.form.86,state:0
688+#: selection:customs.form,state:0
689 msgid "Draft"
690 msgstr "Borrador"
691
692 #. module: l10n_ve_imex
693-#: field:seniat.form.86,move_id:0
694+#: field:customs.form,move_id:0
695 msgid "Account move"
696 msgstr "Asiento contable"
697
698 #. module: l10n_ve_imex
699-#: model:ir.actions.act_window,name:l10n_ve_imex.action_form_86_custom_taxes
700-#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_form_86_custom_taxes
701+#: model:ir.actions.act_window,name:l10n_ve_imex.action_customs_duty
702+#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_customs_duty
703 msgid "Tax codes"
704 msgstr "Códigos de impuestos"
705
706 #. module: l10n_ve_imex
707-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:122
708+#: code:addons/l10n_ve_imex/model/customs_form.py:122
709 #, python-format
710 msgid "No account found, please check customs taxes settings (%s)"
711 msgstr "No se encontró la cuenta, verifique la configuracion de: Códigos de impuestos (%s)"
712
713 #. module: l10n_ve_imex
714-#: field:seniat.form.86,date_liq:0
715+#: field:customs.form,date_liq:0
716 msgid "liq. date"
717 msgstr "Fecha liq."
718
719 #. module: l10n_ve_imex
720-#: sql_constraint:form.86.custom.taxes:0
721+#: sql_constraint:customs.duty:0
722 msgid "The sequence must be unique! (for this comany)"
723 msgstr "La secuencia debe ser única! (para la companía)"
724
725 #. module: l10n_ve_imex
726-#: field:account.invoice,num_import_form_id:0
727+#: field:account.invoice,customs_form_id:0
728 msgid "Import file number"
729 msgstr "Exp. importación"
730
731 #. module: l10n_ve_imex
732-#: help:seniat.form.86,move_id:0
733+#: help:customs.form,move_id:0
734 msgid "The move of this entry line."
735 msgstr "El asiento de esta entrada."
736
737 #. module: l10n_ve_imex
738-#: view:seniat.form.86:0
739-#: field:seniat.form.86,amount_total:0
740+#: view:customs.form:0
741+#: field:customs.form,amount_total:0
742 msgid "Amount total"
743 msgstr "Amount total"
744
745 #. module: l10n_ve_imex
746-#: sql_constraint:form.86.customs:0
747+#: sql_constraint:customs.facility:0
748 msgid "The code must be unique!"
749 msgstr "El código debe ser único!"
750
751 #. module: l10n_ve_imex
752-#: model:ir.model,name:l10n_ve_imex.model_form_86_customs
753-msgid "form.86.customs"
754-msgstr "form.86.customs"
755+#: model:ir.model,name:l10n_ve_imex.model_customs_facility
756+msgid "customs.facility"
757+msgstr "customs.facility"
758
759 #. module: l10n_ve_imex
760-#: sql_constraint:seniat.form.86.lines:0
761+#: sql_constraint:customs.form.line:0
762 msgid "The code must be unique! (for this form)"
763 msgstr "El código debe ser único! (para la companía)"
764
765 #. module: l10n_ve_imex
766-#: field:form.86.custom.taxes,ref:0
767+#: field:customs.duty,ref:0
768 msgid "Ref"
769 msgstr "Ref"
770
771 #. module: l10n_ve_imex
772-#: field:form.86.config,company_id:0
773-#: field:form.86.custom.taxes,company_id:0
774-#: field:seniat.form.86,company_id:0
775+#: field:customs.form.config,company_id:0
776+#: field:customs.duty,company_id:0
777+#: field:customs.form,company_id:0
778 msgid "Company"
779 msgstr "Compañía"
780
781 #. module: l10n_ve_imex
782-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:226
783+#: code:addons/l10n_ve_imex/model/customs_form.py:226
784 #, python-format
785 msgid "Can't cancel a import while account move state <> \"Draft\""
786 msgstr "Imposible cancelar el registro cuando el estado del asiento <> \"Borrador\""
787
788 #. module: l10n_ve_imex
789-#: field:seniat.form.86,broker_id:0
790+#: field:customs.form,broker_id:0
791 msgid "Broker"
792 msgstr "Agente"
793
794 #. module: l10n_ve_imex
795-#: model:ir.actions.act_window,name:l10n_ve_imex.action_form_86_customs
796-#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_form_86_customs
797+#: model:ir.actions.act_window,name:l10n_ve_imex.action_customs_facility
798+#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_customs_facility
799 msgid "Customs"
800 msgstr "Aduanas"
801
802 #. module: l10n_ve_imex
803-#: field:seniat.form.86,date:0
804+#: field:customs.form,date:0
805 msgid "Date"
806 msgstr "Fecha"
807
808 #. module: l10n_ve_imex
809-#: sql_constraint:seniat.form.86:0
810+#: sql_constraint:customs.form:0
811 msgid "The form # must be unique!"
812 msgstr "El número de planilla debe ser único!"
813
814 #. module: l10n_ve_imex
815-#: field:seniat.form.86.lines,line_id:0
816+#: field:customs.form.line,customs_form_id:0
817 msgid "Line"
818 msgstr "Línea"
819
820 #. module: l10n_ve_imex
821-#: model:ir.actions.act_window,name:l10n_ve_imex.action_form_86_config
822-#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_form_86_config
823+#: model:ir.actions.act_window,name:l10n_ve_imex.action_customs_form_config
824+#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_customs_form_config
825 msgid "Configuration"
826 msgstr "Configuración"
827
828 #. module: l10n_ve_imex
829-#: view:seniat.form.86:0
830-#: field:seniat.form.86,narration:0
831+#: view:customs.form:0
832+#: field:customs.form,narration:0
833 msgid "Notes"
834 msgstr "Notas"
835
836 #. module: l10n_ve_imex
837-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:211
838+#: code:addons/l10n_ve_imex/model/customs_form.py:211
839 #, python-format
840 msgid "You must indicate a amount"
841 msgstr "Debe indicar el monto"
842
843 #. module: l10n_ve_imex
844-#: field:form.86.custom.taxes,name:0
845-#: field:form.86.customs,name:0
846+#: field:customs.duty,name:0
847+#: field:customs.facility,name:0
848 msgid "Name"
849 msgstr "Nombre"
850
851@@ -213,127 +213,127 @@
852 msgstr "El documento indicado ya está registrado para esta empresa"
853
854 #. module: l10n_ve_imex
855-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:223
856+#: code:addons/l10n_ve_imex/model/customs_form.py:223
857 #, python-format
858 msgid "Multiple operations not allowed"
859 msgstr "Operaciones múltiples no permitidas"
860
861 #. module: l10n_ve_imex
862-#: field:seniat.form.86,line_ids:0
863+#: field:customs.form,cfl_ids:0
864 msgid "Lines"
865 msgstr "Lineas"
866
867 #. module: l10n_ve_imex
868-#: view:seniat.form.86:0
869+#: view:customs.form:0
870 msgid "Taxes"
871 msgstr "Impuestos"
872
873 #. module: l10n_ve_imex
874-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:122
875-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:145
876-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:223
877-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:226
878+#: code:addons/l10n_ve_imex/model/customs_form.py:122
879+#: code:addons/l10n_ve_imex/model/customs_form.py:145
880+#: code:addons/l10n_ve_imex/model/customs_form.py:223
881+#: code:addons/l10n_ve_imex/model/customs_form.py:226
882 #, python-format
883 msgid "Error!"
884 msgstr "Error!"
885
886 #. module: l10n_ve_imex
887-#: field:seniat.form.86.lines,amount:0
888+#: field:customs.form.line,amount:0
889 msgid "Amount"
890 msgstr "Monto"
891
892 #. module: l10n_ve_imex
893-#: model:ir.ui.menu,name:l10n_ve_imex.menu_form_86_config_group
894+#: model:ir.ui.menu,name:l10n_ve_imex.menu_customs_form_config_group
895 msgid "Import/Export - SENIAT - Form 99086"
896 msgstr "Importar/Exportar - SENIAT - Forma 99086"
897
898 #. module: l10n_ve_imex
899-#: field:seniat.form.86,date_reg:0
900+#: field:customs.form,date_reg:0
901 msgid "Reg. date"
902 msgstr "Fecha Reg."
903
904 #. module: l10n_ve_imex
905-#: selection:seniat.form.86,state:0
906+#: selection:customs.form,state:0
907 msgid "Cancelled"
908 msgstr "Cancelado"
909
910 #. module: l10n_ve_imex
911-#: model:ir.model,name:l10n_ve_imex.model_seniat_form_86
912-msgid "seniat.form.86"
913-msgstr "seniat.form.86"
914-
915-#. module: l10n_ve_imex
916-#: model:ir.model,name:l10n_ve_imex.model_form_86_custom_taxes
917-msgid "form.86.custom.taxes"
918-msgstr "form.86.custom.taxes"
919-
920-#. module: l10n_ve_imex
921-#: view:seniat.form.86:0
922+#: model:ir.model,name:l10n_ve_imex.model_customs_form
923+msgid "customs.form"
924+msgstr "customs.form"
925+
926+#. module: l10n_ve_imex
927+#: model:ir.model,name:l10n_ve_imex.model_customs_duty
928+msgid "customs.duty"
929+msgstr "customs.duty"
930+
931+#. module: l10n_ve_imex
932+#: view:customs.form:0
933 msgid "General info"
934 msgstr "Información general"
935
936 #. module: l10n_ve_imex
937-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:213
938+#: code:addons/l10n_ve_imex/model/customs_form.py:213
939 #, python-format
940 msgid "You must indicate a liquidation date "
941 msgstr "Debe indicar la fecha de liquidación"
942
943 #. module: l10n_ve_imex
944-#: field:form.86.custom.taxes,code:0
945-#: field:form.86.customs,code:0
946+#: field:customs.duty,code:0
947+#: field:customs.facility,code:0
948 msgid "Code"
949 msgstr "Código"
950
951 #. module: l10n_ve_imex
952-#: field:seniat.form.86,ref_liq:0
953+#: field:customs.form,ref_liq:0
954 msgid "Liq. number"
955 msgstr "Nro. Liq."
956
957 #. module: l10n_ve_imex
958-#: field:seniat.form.86,ref:0
959+#: field:customs.form,ref:0
960 msgid "Reference"
961 msgstr "Referencia"
962
963 #. module: l10n_ve_imex
964-#: field:seniat.form.86,invoice_ids:0
965+#: field:customs.form,invoice_ids:0
966 msgid "Related invoices"
967 msgstr "Facturas relacionadas"
968
969 #. module: l10n_ve_imex
970-#: model:ir.actions.act_window,name:l10n_ve_imex.action_seniat_form_86
971-#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_seniat_form_86
972+#: model:ir.actions.act_window,name:l10n_ve_imex.action_customs_form
973+#: model:ir.ui.menu,name:l10n_ve_imex.menu_action_customs_form
974 msgid "SENIAT - Form 99086"
975 msgstr "SENIAT - Forma 99086"
976
977 #. module: l10n_ve_imex
978-#: field:form.86.custom.taxes,sequence:0
979+#: field:customs.duty,sequence:0
980 msgid "Sequence"
981 msgstr "Secuencia"
982
983 #. module: l10n_ve_imex
984-#: field:seniat.form.86,ref_reg:0
985+#: field:customs.form,ref_reg:0
986 msgid "Reg. number"
987 msgstr "Nro. Reg."
988
989 #. module: l10n_ve_imex
990-#: model:ir.model,name:l10n_ve_imex.model_form_86_config
991-msgid "form.86.config"
992-msgstr "form.86.config"
993+#: model:ir.model,name:l10n_ve_imex.model_customs_form_config
994+msgid "customs.form.config"
995+msgstr "customs.form.config"
996
997 #. module: l10n_ve_imex
998-#: view:seniat.form.86:0
999+#: view:customs.form:0
1000 msgid "Reset to draft"
1001 msgstr "Cambiar a borrador"
1002
1003 #. module: l10n_ve_imex
1004-#: view:seniat.form.86:0
1005-#: selection:seniat.form.86,state:0
1006+#: view:customs.form:0
1007+#: selection:customs.form,state:0
1008 msgid "Done"
1009 msgstr "Listo"
1010
1011 #. module: l10n_ve_imex
1012-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:211
1013-#: code:addons/l10n_ve_imex/model/seniat_form_86.py:213
1014+#: code:addons/l10n_ve_imex/model/customs_form.py:211
1015+#: code:addons/l10n_ve_imex/model/customs_form.py:213
1016 #, python-format
1017 msgid "Warning!"
1018 msgstr "Atención!"
1019@@ -344,38 +344,38 @@
1020 msgstr "Factura"
1021
1022 #. module: l10n_ve_imex
1023-#: field:seniat.form.86,name:0
1024+#: field:customs.form,name:0
1025 msgid "Form #"
1026 msgstr "Nº Planilla"
1027
1028 #. module: l10n_ve_imex
1029-#: view:seniat.form.86:0
1030+#: view:customs.form:0
1031 msgid "Cancel"
1032 msgstr "Cancelar"
1033
1034 #. module: l10n_ve_imex
1035-#: field:form.86.custom.taxes,partner_id:0
1036+#: field:customs.duty,partner_id:0
1037 msgid "Partner"
1038 msgstr "Proveedor"
1039
1040 #. module: l10n_ve_imex
1041-#: model:ir.model,name:l10n_ve_imex.model_seniat_form_86_lines
1042-msgid "seniat.form.86.lines"
1043-msgstr "seniat.form.86.lines"
1044+#: model:ir.model,name:l10n_ve_imex.model_customs_form_line
1045+msgid "customs.form.line"
1046+msgstr "customs.form.line"
1047
1048 #. module: l10n_ve_imex
1049-#: view:seniat.form.86:0
1050-#: selection:seniat.form.86,state:0
1051+#: view:customs.form:0
1052+#: selection:customs.form,state:0
1053 msgid "Open"
1054 msgstr "Abierto"
1055
1056 #. module: l10n_ve_imex
1057-#: field:form.86.config,journal_id:0
1058+#: field:customs.form.config,journal_id:0
1059 msgid "Journal"
1060 msgstr "Diario"
1061
1062 #. module: l10n_ve_imex
1063-#: field:form.86.custom.taxes,acc_tax_id:0
1064+#: field:customs.duty,tax_id:0
1065 msgid "Account Tax "
1066 msgstr "Impuesto"
1067
1068
1069=== modified file 'l10n_ve_imex/model/__init__.py'
1070--- l10n_ve_imex/model/__init__.py 2013-04-10 18:22:00 +0000
1071+++ l10n_ve_imex/model/__init__.py 2013-04-29 19:14:27 +0000
1072@@ -1,3 +1,30 @@
1073-import seniat_form_86_config
1074-import seniat_form_86
1075+# -*- encoding: utf-8 -*-
1076+###############################################################################
1077+# Module Writen to OpenERP, Open Source Management Solution
1078+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
1079+# All Rights Reserved
1080+############# Credits #########################################################
1081+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
1082+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
1083+# Planified by:
1084+# Juan Marquez <jmarquez@tecvemar.com.ve>
1085+# Humberto Arocha <hbto@vauxoo.com>
1086+# Audited by: Humberto Arocha <hbto@vauxoo.com>
1087+###############################################################################
1088+# This program is free software: you can redistribute it and/or modify
1089+# it under the terms of the GNU Affero General Public License as
1090+# published by the Free Software Foundation, either version 3 of the
1091+# License, or (at your option) any later version.
1092+#
1093+# This program is distributed in the hope that it will be useful,
1094+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1095+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1096+# GNU Affero General Public License for more details.
1097+#
1098+# You should have received a copy of the GNU Affero General Public License
1099+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1100+###############################################################################
1101+
1102+import customs_form_config
1103+import customs_form
1104 import invoice
1105
1106=== renamed file 'l10n_ve_imex/model/seniat_form_86.py' => 'l10n_ve_imex/model/customs_form.py'
1107--- l10n_ve_imex/model/seniat_form_86.py 2013-04-18 00:52:00 +0000
1108+++ l10n_ve_imex/model/customs_form.py 2013-04-29 19:14:27 +0000
1109@@ -1,399 +1,352 @@
1110 # -*- encoding: utf-8 -*-
1111-##############################################################################
1112-# Company: Tecvemar, c.a.
1113-# Author: Juan V. Márquez L.
1114-# Creation Date: 04/04/2012
1115-# Version: 0.0.0.0
1116-#
1117-# Description:
1118-#
1119-#
1120-##############################################################################
1121-#~ from datetime import datetime
1122-from openerp.osv import fields,osv
1123+###############################################################################
1124+# Module Writen to OpenERP, Open Source Management Solution
1125+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
1126+# All Rights Reserved
1127+############# Credits #########################################################
1128+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
1129+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
1130+# Planified by:
1131+# Juan Marquez <jmarquez@tecvemar.com.ve>
1132+# Humberto Arocha <hbto@vauxoo.com>
1133+# Audited by: Humberto Arocha <hbto@vauxoo.com>
1134+###############################################################################
1135+# This program is free software: you can redistribute it and/or modify
1136+# it under the terms of the GNU Affero General Public License as
1137+# published by the Free Software Foundation, either version 3 of the
1138+# License, or (at your option) any later version.
1139+#
1140+# This program is distributed in the hope that it will be useful,
1141+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1142+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1143+# GNU Affero General Public License for more details.
1144+#
1145+# You should have received a copy of the GNU Affero General Public License
1146+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1147+###############################################################################
1148+from openerp.osv import fields, osv
1149 from openerp.tools.translate import _
1150 import openerp.pooler
1151 import openerp.addons.decimal_precision as dp
1152 import time
1153-#~ import netsvc
1154-
1155-
1156-##---------------------------------------------------------------------------------------- seniat_form_86
1157-
1158-class seniat_form_86(osv.osv):
1159-
1160- _name = 'seniat.form.86'
1161-
1162+
1163+
1164+class customs_form(osv.osv):
1165+
1166+ _name = 'customs.form'
1167 _description = ''
1168
1169- ##------------------------------------------------------------------------------------
1170-
1171- def name_get(self,cr, uid, ids, context):
1172+ def name_get(self, cr, uid, ids, context):
1173 if not len(ids):
1174 return []
1175 res = []
1176 so_brw = self.browse(cr, uid, ids, context)
1177 for item in so_brw:
1178- res.append((item.id, 'F86 # %s - %s'%(item.name,item.ref or '')))
1179+ res.append((item.id,
1180+ 'F86 # %s - %s' % (item.name, item.ref or '')))
1181 return res
1182
1183- ##------------------------------------------------------------------------------------ _internal methods
1184-
1185 def _amount_total(self, cr, uid, ids, field_name, arg, context=None):
1186 res = {}
1187 for f86 in self.browse(cr, uid, ids, context=context):
1188 amount_total = 0.0
1189- for line in f86.line_ids:
1190+ for line in f86.cfl_ids:
1191 amount_total += line.amount
1192 res[f86.id] = amount_total
1193 return res
1194-
1195-
1196- def _default_line_ids(self, cr, uid, context=None):
1197- """
1198- Gets default line_ids from form_86_custom_taxes
1199- """
1200- obj_ct = self.pool.get('form.86.custom.taxes')
1201+
1202+ def _default_cfl_ids(self, cr, uid, context=None):
1203+ """ Gets default cfl_ids from customs_duty. """
1204+ obj_ct = self.pool.get('customs.duty')
1205 ct_ids = obj_ct.search(cr, uid, [], context=context)
1206 res = []
1207 for id in ct_ids:
1208- vat = obj_ct.browse(cr,uid,id,context=context)
1209- res.append({'tax_code':id,'amount':0.0,'vat_detail':vat.vat_detail})
1210+ vat = obj_ct.browse(cr, uid, id, context=context)
1211+ res.append({'tax_code': id,
1212+ 'amount': 0.0, 'vat_detail': vat.vat_detail})
1213 return res
1214-
1215-
1216- def _gen_account_move_line(self, company_id, account_id, partner_id, name, debit, credit):
1217- return (0,0,{
1218- 'auto' : True,
1219+
1220+ def _gen_account_move_line(self, company_id, account_id, partner_id, name,
1221+ debit, credit):
1222+ return (0, 0, {
1223+ 'auto': True,
1224 'company_id': company_id,
1225 'account_id': account_id,
1226- 'partner_id':partner_id,
1227+ 'partner_id': partner_id,
1228 'name': name[:64],
1229 'debit': debit,
1230 'credit': credit,
1231- 'reconcile':False,
1232- })
1233-
1234-
1235- ##------------------------------------------------------------------------------------ function fields
1236+ 'reconcile': False,
1237+ })
1238
1239 _columns = {
1240- 'name': fields.char('Form #', size=16, required=True, readonly=True, states={'draft':[('readonly',False)]}),
1241- 'ref': fields.char('Reference', size=64, required=False, readonly=True, states={'draft':[('readonly',False)]}),
1242- 'date': fields.date('Date', required=True, readonly=True, states={'draft':[('readonly',False)]}, select=True),
1243- 'company_id': fields.many2one('res.company','Company',required=True, readonly=True, ondelete='restrict'),
1244- 'broker_id': fields.many2one('res.partner', 'Broker', change_default=True, readonly=True, states={'draft':[('readonly',False)]}, ondelete='restrict'),
1245- 'ref_reg': fields.char('Reg. number', size=16, required=False, readonly=True, states={'draft':[('readonly',False)]}),
1246- 'date_reg': fields.date('Reg. date', required=False, readonly=True, states={'draft':[('readonly',False)]}, select=True),
1247- 'ref_liq': fields.char('Liq. number', size=16, required=False, readonly=True, states={'draft':[('readonly',False)]}),
1248- 'date_liq': fields.date('liq. date', required=True, readonly=True, states={'draft':[('readonly',False)]}, select=True),
1249- 'custom_id': fields.many2one('form.86.customs', 'Custom', change_default=True, readonly=True, states={'draft':[('readonly',False)]}, ondelete='restrict'),
1250- 'line_ids':fields.one2many('seniat.form.86.lines','line_id','Tax lines',readonly=True, states={'draft':[('readonly',False)]}),
1251- 'amount_total':fields.function(_amount_total, method=True, type = 'float', string='Amount total', store=False),
1252- 'move_id': fields.many2one('account.move', 'Account move', ondelete='restrict', select=True, readonly=True, help="The move of this entry line."),
1253- 'narration':fields.text('Notes', readonly=False),
1254- 'invoice_ids':fields.one2many('account.invoice','num_import_form_id','Related invoices',readonly=True),
1255- 'state': fields.selection([('draft', 'Draft'),('open', 'Open'),('done', 'Done'),('cancel', 'Cancelled')], string='State', required=True, readonly=True),
1256- }
1257+ 'name': fields.char('Form #', size=16, required=True, readonly=True,
1258+ states={'draft': [('readonly', False)]}),
1259+ 'ref': fields.char('Reference', size=64, required=False, readonly=True,
1260+ states={'draft': [('readonly', False)]}),
1261+ 'date': fields.date('Date', required=True, readonly=True,
1262+ states={'draft': [('readonly', False)]},
1263+ select=True),
1264+ 'company_id': fields.many2one('res.company', 'Company', required=True,
1265+ readonly=True, ondelete='restrict'),
1266+ 'broker_id': fields.many2one('res.partner', 'Broker',
1267+ change_default=True, readonly=True,
1268+ states={'draft': [('readonly', False)]},
1269+ ondelete='restrict'),
1270+ 'ref_reg': fields.char('Reg. number', size=16, required=False,
1271+ readonly=True,
1272+ states={'draft': [('readonly', False)]}),
1273+ 'date_reg': fields.date('Reg. date', required=False, readonly=True,
1274+ states={'draft': [('readonly', False)]},
1275+ select=True),
1276+ 'ref_liq': fields.char('Liq. number', size=16, required=False,
1277+ readonly=True,
1278+ states={'draft': [('readonly', False)]}),
1279+ 'date_liq': fields.date('liq. date', required=True, readonly=True,
1280+ states={'draft': [('readonly', False)]},
1281+ select=True),
1282+ 'customs_facility_id': fields.many2one(
1283+ 'customs.facility', 'Customs Facility', change_default=True,
1284+ readonly=True, states={'draft': [('readonly', False)]},
1285+ ondelete='restrict'),
1286+ 'cfl_ids': fields.one2many('customs.form.line', 'customs_form_id',
1287+ 'Tax lines', readonly=True,
1288+ states={'draft': [('readonly', False)]}),
1289+ 'amount_total': fields.function(_amount_total, method=True,
1290+ type='float', string='Amount total',
1291+ store=False),
1292+ 'move_id': fields.many2one('account.move', 'Account move',
1293+ ondelete='restrict', select=True,
1294+ readonly=True,
1295+ help="The move of this entry line."),
1296+ 'narration': fields.text('Notes', readonly=False),
1297+ 'invoice_ids': fields.one2many('account.invoice', 'customs_form_id',
1298+ 'Related invoices', readonly=True),
1299+ 'state': fields.selection([('draft', 'Draft'), ('open', 'Open'),
1300+ ('done', 'Done'), ('cancel', 'Cancelled')],
1301+ string='State', required=True,
1302+ readonly=True),
1303+ }
1304
1305 _defaults = {
1306 'date': lambda *a: time.strftime('%Y-%m-%d'),
1307- 'company_id':lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr,uid,'seniat.form.86',context=c),
1308- 'line_ids': _default_line_ids,
1309- 'state': lambda *a: 'draft',
1310- }
1311-
1312- _sql_constraints = [
1313- ('name_uniq', 'UNIQUE(name)', 'The form # must be unique!'),
1314- ]
1315-
1316- ##------------------------------------------------------------------------------------
1317-
1318- ##------------------------------------------------------------------------------------ public methods
1319-
1320+ 'company_id': lambda self, cr, uid, c:
1321+ self.pool.get('res.company')._company_default_get(cr, uid,
1322+ 'customs.form',
1323+ context=c),
1324+ 'cfl_ids': _default_cfl_ids,
1325+ 'state': lambda *a: 'draft',
1326+ }
1327+
1328+ _sql_constraints = [
1329+ ('name_uniq', 'UNIQUE(name)', 'The form # must be unique!'),
1330+ ]
1331+
1332 def create_account_move_lines(self, cr, uid, f86, context=None):
1333- """
1334- Creates the account.move.lines from line_ids detail except for taxes with "vat_detail",
1335- in this case create debits from line_ids.line_vat_ids and get debit account from account_tax model
1336+ """ Creates the account.move.lines from cfl_ids detail except for
1337+ taxes with "vat_detail", in this case create debits from
1338+ cfl_ids.imex_tax_line and get debit account from account_tax model
1339 """
1340 lines = []
1341 company_id = context.get('f86_company_id')
1342 f86_cfg = context.get('f86_config')
1343
1344 #~ expenses
1345- for line in f86.line_ids:
1346-
1347+ for line in f86.cfl_ids:
1348 debits = []
1349 if line.tax_code.vat_detail:
1350- for vat in line.line_vat_ids:
1351- debits.append({'account_id':vat.acc_tax_id.account_collected_id.id,'amount':vat.tax_amount,'tax_info':' (%s)'%vat.acc_tax_id.name})
1352+ for vat in line.imex_tax_line:
1353+ debits.append(
1354+ {'account_id': vat.tax_id.account_collected_id.id,
1355+ 'amount': vat.amount,
1356+ 'tax_info': ' (%s)' % vat.tax_id.name})
1357 else:
1358- debits.append({'account_id':line.tax_code.account_id.id,'amount':line.amount,'tax_info':''})
1359-
1360- credit_account_id = line.tax_code.partner_id.property_account_payable.id
1361+ debits.append({'account_id': line.tax_code.account_id.id,
1362+ 'amount': line.amount, 'tax_info': ''})
1363+
1364+ credit_account_id = \
1365+ line.tax_code.partner_id.property_account_payable.id
1366
1367 for debit in debits:
1368 if not debit['account_id'] or not credit_account_id:
1369- raise osv.except_osv(_('Error!'),_('No account found, please check customs taxes settings (%s)')%line.tax_code.name)
1370- lines.append(self._gen_account_move_line(company_id, debit['account_id'], line.tax_code.partner_id.id, '[%s] %s - %s%s'%(line.tax_code.code,line.tax_code.ref,line.tax_code.name,debit['tax_info']) , debit['amount'],0.0))
1371- lines.append(self._gen_account_move_line(company_id, credit_account_id, line.tax_code.partner_id.id, 'F86 #%s - %s'%(f86.name,line.tax_code.name) ,0.0,line.amount))
1372-
1373- lines.reverse() ## set real order ;-)
1374+ raise osv.except_osv(
1375+ _('Error!'), _('No account found, please check \
1376+ customs taxes settings (%s)') % line.tax_code.name)
1377+ lines.append(
1378+ self._gen_account_move_line(
1379+ company_id, debit['account_id'],
1380+ line.tax_code.partner_id.id, '[%s] %s - %s%s'
1381+ % (line.tax_code.code, line.tax_code.ref,
1382+ line.tax_code.name, debit['tax_info']),
1383+ debit['amount'], 0.0)
1384+ )
1385+ lines.append(self._gen_account_move_line(
1386+ company_id, credit_account_id, line.tax_code.partner_id.id,
1387+ 'F86 #%s - %s' % (f86.name, line.tax_code.name), 0.0,
1388+ line.amount))
1389+
1390+ lines.reverse() # set real order ;-)
1391 return lines
1392-
1393-
1394+
1395 def create_account_move(self, cr, uid, ids, context=None):
1396 if context is None:
1397 context = {}
1398- so_brw = self.browse(cr,uid,ids,context={})
1399+ so_brw = self.browse(cr, uid, ids, context={})
1400 for f86 in so_brw:
1401- if f86.move_id: #~ The move is already done, nothing to do
1402+ if f86.move_id: # ~ The move is already done, nothing to do
1403 return []
1404 obj_move = self.pool.get('account.move')
1405- obj_cfg = self.pool.get('form.86.config')
1406- company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
1407- company = self.pool.get('res.company').browse(cr,uid,company_id,context=context)
1408+ obj_cfg = self.pool.get('customs.form.config')
1409+ company_id = self.pool.get('res.users').browse(
1410+ cr, uid, uid, context=context).company_id.id
1411+ company = self.pool.get('res.company').browse(cr, uid, company_id,
1412+ context=context)
1413 cfg_id = obj_cfg.search(cr, uid, [('company_id', '=', company_id)])
1414 if cfg_id:
1415- f86_cfg = obj_cfg.browse(cr,uid,cfg_id[0],context=context)
1416+ f86_cfg = obj_cfg.browse(cr, uid, cfg_id[0], context=context)
1417 else:
1418- raise osv.except_osv(_('Error!'),_('Please set a valid configuration'))
1419+ raise osv.except_osv(_('Error!'),
1420+ _('Please set a valid configuration'))
1421 date = time.strftime('%Y-%m-%d')
1422- context.update({'f86_company_id':company_id,'f86_config':f86_cfg})
1423+ context.update({'f86_company_id': company_id, 'f86_config': f86_cfg})
1424 move_ids = []
1425 for f86 in so_brw:
1426 move = {
1427- 'ref':'F86 #%s'%f86.name,
1428- 'journal_id':f86_cfg.journal_id.id,
1429- 'date':f86.date_liq,
1430- 'company_id':company_id,
1431- 'state':'draft',
1432- 'to_check':False,
1433- 'narration':_('Form 86 # %s\n\tReference: %s\n\tBroker: %s\n\nRelated invoices:')%(f86.name,f86.ref or '',f86.broker_id.name or ''),
1434- }
1435+ 'ref': 'F86 #%s' % f86.name,
1436+ 'journal_id': f86_cfg.journal_id.id,
1437+ 'date': f86.date_liq,
1438+ 'company_id': company_id,
1439+ 'state': 'draft',
1440+ 'to_check': False,
1441+ 'narration': _('Form 86 # %s\n\tReference: %s\n\tBroker: \
1442+ %s\n\nRelated invoices:')
1443+ % (f86.name, f86.ref or '', f86.broker_id.name or ''),
1444+ }
1445 for inv in f86.invoice_ids:
1446- str_inv = _('\n\tSupplier: %-40s Reference: %s')%(inv.partner_id.name,inv.reference)
1447- move['narration'] = '%s%s'%(move['narration'],str_inv)
1448+ str_inv = _('\n\tSupplier: %-40s Reference: %s') % \
1449+ (inv.partner_id.name, inv.reference)
1450+ move['narration'] = '%s%s' % (move['narration'], str_inv)
1451 lines = self.create_account_move_lines(cr, uid, f86, context)
1452 if lines:
1453- move.update({'line_id':lines})
1454+ move.update({'line_id': lines})
1455 move_id = obj_move.create(cr, uid, move, context)
1456 obj_move.post(cr, uid, [move_id], context=context)
1457 if move_id:
1458 move_ids.append(move_id)
1459- self.write(cr, uid, f86.id, {'move_id':move_id},context)
1460- return move_ids
1461-
1462- ##------------------------------------------------------------------------------------ buttons (object)
1463-
1464- ##------------------------------------------------------------------------------------ on_change...
1465-
1466- ##------------------------------------------------------------------------------------ create write unlink
1467-
1468- ##------------------------------------------------------------------------------------ Workflow
1469-
1470+ self.write(cr, uid, f86.id, {'move_id': move_id}, context)
1471+ return move_ids
1472+
1473 def button_draft(self, cr, uid, ids, context=None):
1474- vals={'state':'draft'}
1475- return self.write(cr,uid,ids,vals,context)
1476-
1477+ vals = {'state': 'draft'}
1478+ return self.write(cr, uid, ids, vals, context)
1479
1480 def button_open(self, cr, uid, ids, context=None):
1481 self.create_account_move(cr, uid, ids, context)
1482- vals={'state':'open'}
1483- return self.write(cr,uid,ids,vals,context)
1484-
1485+ vals = {'state': 'open'}
1486+ return self.write(cr, uid, ids, vals, context)
1487
1488 def button_done(self, cr, uid, ids, context=None):
1489- vals={'state':'done'}
1490- return self.write(cr,uid,ids,vals,context)
1491-
1492+ vals = {'state': 'done'}
1493+ return self.write(cr, uid, ids, vals, context)
1494
1495 def button_cancel(self, cr, uid, ids, context=None):
1496- f86 = self.browse(cr,uid,ids[0],context=context)
1497+ f86 = self.browse(cr, uid, ids[0], context=context)
1498 f86_move_id = f86.move_id.id if f86 and f86.move_id else False
1499- vals={'state':'cancel','move_id':0}
1500- res = self.write(cr,uid,ids,vals,context)
1501+ vals = {'state': 'cancel', 'move_id': 0}
1502+ res = self.write(cr, uid, ids, vals, context)
1503 if f86_move_id:
1504- self.pool.get('account.move').unlink(cr,uid,[f86_move_id],context)
1505- return self.write(cr,uid,ids,vals,context)
1506-
1507+ self.pool.get('account.move').unlink(cr, uid, [f86_move_id],
1508+ context)
1509+ return self.write(cr, uid, ids, vals, context)
1510
1511 def test_draft(self, cr, uid, ids, *args):
1512 return True
1513
1514-
1515 def test_open(self, cr, uid, ids, *args):
1516- so_brw = self.browse(cr,uid,ids,context={})
1517+ so_brw = self.browse(cr, uid, ids, context={})
1518 for f86 in so_brw:
1519 if f86.amount_total <= 0:
1520- raise osv.except_osv(_('Warning!'),_('You must indicate a amount'))
1521- f86_invoices = [i.id for i in f86.invoice_ids] # a lis of related invoices
1522- vat_invoices = [] # for tax (vat) related invoices
1523- for line in f86.line_ids:
1524+ raise osv.except_osv(_('Warning!'),
1525+ _('You must indicate a amount'))
1526+ f86_invoices = [i.id for i in f86.invoice_ids] # related inv list
1527+ vat_invoices = [] # for tax (vat) related invoices
1528+ for line in f86.cfl_ids:
1529 if line.vat_detail:
1530 vat_total = line.amount
1531- for vat in line.line_vat_ids:
1532- vat_total -= vat.tax_amount
1533+ for vat in line.imex_tax_line:
1534+ vat_total -= vat.amount
1535 if vat.invoice_id.id not in vat_invoices:
1536 vat_invoices.append(vat.invoice_id.id)
1537 if abs(vat_total) > 0.001:
1538- raise osv.except_osv(_('Warning!'),_('The vat detail data does not correspond with vat amount in line: %s')%line.tax_code.name)
1539+ raise osv.except_osv(
1540+ _('Warning!'),
1541+ _('The vat detail data does not correspond with \
1542+ vat amount in line: %s') % line.tax_code.name)
1543 #~ Validate related invoices vs invoice_ids (if vat)
1544 if set(f86_invoices) != set(vat_invoices):
1545- #~ No todas las facturas relacionadas con la planilla de importación se corresponden con las facturas relacionadas al IVA
1546- raise osv.except_osv(_('Warning!'),_('Not all invoices related to the import spreadsheet correspond to invoices relating to VAT'))
1547+ #~ No todas las facturas relacionadas con la planilla de
1548+ #~ importación se corresponden con las facturas relacionadas
1549+ #~ al IVA
1550+ raise osv.except_osv(
1551+ _('Warning!'),
1552+ _('Not all invoices related to the import spreadsheet \
1553+ correspond to invoices relating to VAT'))
1554 return True
1555
1556-
1557 def test_done(self, cr, uid, ids, *args):
1558 return True
1559
1560-
1561 def test_cancel(self, cr, uid, ids, *args):
1562 if len(ids) != 1:
1563- raise osv.except_osv(_('Error!'),_('Multiple operations not allowed'))
1564- for f86 in self.browse(cr,uid,ids,context=None):
1565+ raise osv.except_osv(
1566+ _('Error!'),
1567+ _('Multiple operations not allowed'))
1568+ for f86 in self.browse(cr, uid, ids, context=None):
1569 #~ Validate account_move.state != draft
1570 if f86.move_id and f86.move_id.state != 'draft':
1571- raise osv.except_osv(_('Error!'),_('Can\'t cancel a import while account move state <> "Draft" (%s)')%f86.move_id.name)
1572- #~ Validate state of related invoices (only state = draft)
1573+ raise osv.except_osv(
1574+ _('Error!'),
1575+ _('Can\'t cancel a import while account move state <> \
1576+ "Draft" (%s)') % f86.move_id.name)
1577+ #~ Validate state of related invoices (only state = draft)
1578 for inv in f86.invoice_ids:
1579 if inv.state != 'draft':
1580- raise osv.except_osv(_('Error!'),_('Can\'t cancel a import while invoice state <> "Draft" ([%s] %s, %s)')%inv.name,inv.partner_id.name,inv.reference)
1581+ raise osv.except_osv(
1582+ _('Error!'),
1583+ _('Can\'t cancel a import while invoice state <> \
1584+ "Draft" ([%s] %s, %s)') % inv.name,
1585+ inv.partner_id.name, inv.reference)
1586 return True
1587
1588
1589-seniat_form_86()
1590-
1591-
1592-
1593-##---------------------------------------------------------------------------------------- seniat_form_86
1594-
1595-class seniat_form_86_lines(osv.osv):
1596-
1597- _name = 'seniat.form.86.lines'
1598-
1599+class customs_form_line(osv.osv):
1600+
1601+ _name = 'customs.form.line'
1602 _description = ''
1603-
1604- ##------------------------------------------------------------------------------------
1605-
1606- ##------------------------------------------------------------------------------------ _internal methods
1607-
1608- ##------------------------------------------------------------------------------------ function fields
1609-
1610 _rec_name = 'tax_code'
1611
1612 _columns = {
1613- 'line_id':fields.many2one('seniat.form.86', 'Line', required=True, ondelete='cascade'),
1614- 'tax_code': fields.many2one('form.86.custom.taxes', 'Tax', ondelete='restrict',required=True, readonly=False),
1615- 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account'),required=True),
1616- 'line_vat_ids':fields.one2many('seniat.form_86.lines.vat','line_vat_id','Vat lines',attrs="{'readonly':[('vat_detail','=',True)],'required':[('vat_detail','=',True)]}"), ##
1617- 'vat_detail':fields.related('tax_code','vat_detail', type='boolean', string='Tax detail',store=False, readonly=True)
1618- }
1619-
1620- _defaults = {
1621- }
1622-
1623- _sql_constraints = [
1624- ('code_uniq', 'UNIQUE(line_id,tax_code)', 'The code must be unique! (for this form)'),
1625- ]
1626-
1627- ##------------------------------------------------------------------------------------
1628-
1629- ##------------------------------------------------------------------------------------ public methods
1630-
1631- ##------------------------------------------------------------------------------------ buttons (object)
1632-
1633- ##------------------------------------------------------------------------------------ on_change...
1634-
1635- ##------------------------------------------------------------------------------------ create write unlink
1636-
1637- ##------------------------------------------------------------------------------------ Workflow
1638-
1639-seniat_form_86_lines()
1640-
1641-
1642-##---------------------------------------------------------------------------------------- seniat_form_86_lines_vat
1643-
1644-class seniat_form_86_lines_vat(osv.osv):
1645-
1646- _name = 'seniat.form_86.lines.vat'
1647-
1648- _description = ''
1649-
1650- ##------------------------------------------------------------------------------------
1651-
1652- ##------------------------------------------------------------------------------------ _internal methods
1653-
1654- ##------------------------------------------------------------------------------------ function fields
1655-
1656- _rec_name = 'reference'
1657-
1658- _columns = {
1659- 'line_vat_id':fields.many2one('seniat.form.86.lines', 'Vat line', required=True, ondelete='cascade'),
1660- 'invoice_id': fields.many2one('account.invoice', 'Invoice Reference', ondelete='restrict', select=True, required=True),
1661- 'partner_id':fields.related('invoice_id','partner_id', type='many2one', relation='res.partner', string='Supplier',store=False, readonly=True),
1662- 'reference':fields.related('invoice_id','reference', type='char', string='Invoice ref',size=64,store=False, readonly=True),
1663- 'acc_tax_id':fields.many2one('account.tax', 'Account Tax ', required=True, ondelete='restrict', domain=[('type_tax_use','=','purchase')], help=""),
1664- 'base_amount': fields.float('Base amount', digits_compute=dp.get_precision('Account'),required=True),
1665- 'tax_amount': fields.float('Tax amount', digits_compute=dp.get_precision('Account'),required=True),
1666- }
1667-
1668- _defaults = {
1669- }
1670-
1671- _sql_constraints = [
1672- ('base_amount_gt_zero', 'CHECK (base_amount>0)', 'The base amount must be > 0!'),
1673- ('tax_amount_zero', 'CHECK (tax_amount>=0)', 'The tax amount must be >= 0!'),
1674- ]
1675-
1676- ##------------------------------------------------------------------------------------
1677-
1678- ##------------------------------------------------------------------------------------ public methods
1679-
1680- ##------------------------------------------------------------------------------------ buttons (object)
1681-
1682- ##------------------------------------------------------------------------------------ on_change...
1683-
1684- """
1685- def on_change_line_vat_id(self, cr, uid, ids, line_vat_id):
1686- '''
1687- Create a domain to filter invoice_id for invoices listed in seniat_form_86.invoice_ids only
1688- http://help.openerp.com/question/11180/how-to-create-a-domain-for-field-in-parentparent-model/
1689- '''
1690- res = {}
1691- if line_vat_id:
1692- line_obj = self.pool.get('seniat.form.86.lines')
1693- invoices = [i.id for i in line_obj.browse(cr, uid, line_vat_id).line_id.invoice_ids]
1694- res = {'domain': {'invoice_id': [('id','in',invoices)]}}
1695- return res
1696- """
1697-
1698- def on_change_amount(self, cr, uid, ids, acc_tax_id, base_amount, tax_amount):
1699- """
1700- To autocompute base or tax, only for percent based taxes
1701- """
1702- res = {}
1703- if acc_tax_id:
1704- obj_vat = self.pool.get('account.tax')
1705- vat = obj_vat.browse(cr,uid,acc_tax_id)
1706- if vat.type == 'percent':
1707- if base_amount == 0 and tax_amount > 0:
1708- base_amount = round(tax_amount / vat.amount,2)
1709- res = {'value':{'base_amount':base_amount}}
1710- return res
1711-
1712-
1713- def on_change_invoice_id(self, cr, uid, ids, invoice_id):
1714- res = {}
1715- if invoice_id:
1716- obj_inv = self.pool.get('account.invoice')
1717- inv = obj_inv.browse(cr,uid,invoice_id)
1718- res = {'value':{'partner_id':inv.partner_id.id,'reference':inv.reference}}
1719- return res
1720-
1721- ##------------------------------------------------------------------------------------ create write unlink
1722-
1723- ##------------------------------------------------------------------------------------ Workflow
1724-
1725-seniat_form_86_lines_vat()
1726+ 'customs_form_id': fields.many2one('customs.form', 'Customs',
1727+ required=True, ondelete='cascade'),
1728+ 'tax_code': fields.many2one('customs.duty', 'Tax',
1729+ ondelete='restrict', required=True,
1730+ readonly=False),
1731+ 'amount': fields.float('Amount', required=True,
1732+ digits_compute=dp.get_precision('Account')),
1733+ 'imex_tax_line': fields.one2many(
1734+ 'account.invoice.tax', 'cfl_id', 'Vat lines',
1735+ attrs="{'readonly':[('vat_detail','=',True)], \
1736+ 'required':[('vat_detail','=',True)]}"),
1737+ 'vat_detail': fields.related('tax_code', 'vat_detail', type='boolean',
1738+ string='Tax detail', store=False,
1739+ readonly=True)
1740+ }
1741+
1742+ _defaults = {
1743+ }
1744+
1745+ _sql_constraints = [
1746+ ('code_uniq', 'UNIQUE(customs_form_id,tax_code)',
1747+ 'The code must be unique! (for this form)'),
1748+ ]
1749+
1750
1751=== renamed file 'l10n_ve_imex/model/seniat_form_86_config.py' => 'l10n_ve_imex/model/customs_form_config.py'
1752--- l10n_ve_imex/model/seniat_form_86_config.py 2013-04-25 20:18:13 +0000
1753+++ l10n_ve_imex/model/customs_form_config.py 2013-04-29 19:14:27 +0000
1754@@ -1,197 +1,154 @@
1755 # -*- encoding: utf-8 -*-
1756-##############################################################################
1757-# Company: Tecvemar, c.a.
1758-# Author: Juan V. Márquez L.
1759-# Creation Date: 10/04/2012
1760-# Version: 0.0.0.0
1761-#
1762-# Description:
1763-#
1764-#
1765-##############################################################################
1766-#~ from datetime import datetime
1767-from openerp.osv import fields,osv
1768+###############################################################################
1769+# Module Writen to OpenERP, Open Source Management Solution
1770+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
1771+# All Rights Reserved
1772+############# Credits #########################################################
1773+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
1774+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
1775+# Planified by:
1776+# Juan Marquez <jmarquez@tecvemar.com.ve>
1777+# Humberto Arocha <hbto@vauxoo.com>
1778+# Audited by: Humberto Arocha <hbto@vauxoo.com>
1779+###############################################################################
1780+# This program is free software: you can redistribute it and/or modify
1781+# it under the terms of the GNU Affero General Public License as
1782+# published by the Free Software Foundation, either version 3 of the
1783+# License, or (at your option) any later version.
1784+#
1785+# This program is distributed in the hope that it will be useful,
1786+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1787+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1788+# GNU Affero General Public License for more details.
1789+#
1790+# You should have received a copy of the GNU Affero General Public License
1791+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1792+###############################################################################
1793+
1794+from openerp.osv import fields, osv
1795 from openerp.tools.translate import _
1796 import openerp.pooler
1797-#~ import openerp.addons.decimal_precision as dp
1798-#~ import time
1799-#~ import netsvc
1800-
1801-
1802-##---------------------------------------------------------------------------------------- seniat_form_86_config
1803-
1804-class form_86_config(osv.osv):
1805+
1806+
1807+class customs_form_config(osv.osv):
1808 '''
1809 Stores common config parameters for form_86 data
1810 '''
1811-
1812- _name = 'form.86.config'
1813
1814+ _name = 'customs.form.config'
1815 _description = ''
1816-
1817- ##------------------------------------------------------------------------------------
1818-
1819- ##------------------------------------------------------------------------------------ _internal methods
1820-
1821- ##------------------------------------------------------------------------------------ function fields
1822-
1823- _columns = {
1824- 'company_id':fields.many2one('res.company','Company', required=True, readonly=True, ondelete='restrict'),
1825- 'journal_id': fields.many2one('account.journal', 'Journal', required=True, ondelete='restrict'),
1826- }
1827-
1828 _rec_name = "company_id"
1829-
1830+
1831+ _columns = {
1832+ 'company_id': fields.many2one('res.company', 'Company', required=True,
1833+ readonly=True, ondelete='restrict'),
1834+ 'journal_id': fields.many2one('account.journal', 'Journal',
1835+ required=True, ondelete='restrict'),
1836+ }
1837
1838 _defaults = {
1839- 'company_id':lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr,uid,'form.86.config',context=c),
1840- }
1841+ 'company_id': lambda self, cr, uid, c:
1842+ self.pool.get('res.company')._company_default_get(
1843+ cr, uid, 'customs.form.config', context=c),
1844+ }
1845
1846 _sql_constraints = [
1847- ('company_id_uniq', 'UNIQUE(company_id)', 'The company must be unique!'),
1848- ]
1849-
1850- ##------------------------------------------------------------------------------------
1851-
1852- ##------------------------------------------------------------------------------------ public methods
1853-
1854- ##------------------------------------------------------------------------------------ buttons (object)
1855-
1856- ##------------------------------------------------------------------------------------ on_change...
1857-
1858- ##------------------------------------------------------------------------------------ create write unlink
1859-
1860- ##------------------------------------------------------------------------------------ Workflow
1861-
1862-form_86_config()
1863-
1864-
1865-
1866-##---------------------------------------------------------------------------------------- form_86_customs
1867-
1868-class form_86_customs(osv.osv):
1869+ ('company_id_uniq', 'UNIQUE(company_id)',
1870+ 'The company must be unique!'),
1871+ ]
1872+
1873+
1874+class customs_facility(osv.osv):
1875 '''
1876 Stores a list with Venezuela's customs
1877 '''
1878
1879- _name = 'form.86.customs'
1880-
1881+ _name = 'customs.facility'
1882 _description = ''
1883
1884- ##------------------------------------------------------------------------------------
1885-
1886 def name_get(self, cr, uid, ids, context=None):
1887 if not ids:
1888 return []
1889- so_brw = self.browse(cr,uid,ids,context={})
1890+ so_brw = self.browse(cr, uid, ids, context={})
1891 res = []
1892 for item in so_brw:
1893- res.append((item.id, '[%s] %s'%(item.code, item.name)))
1894+ res.append((item.id, '[%s] %s' % (item.code, item.name)))
1895 return res
1896-
1897-
1898- def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
1899+
1900+ def name_search(self, cr, user, name, args=None, operator='ilike',
1901+ context=None, limit=100):
1902 #~ Based on account.account.name_search...
1903- res = super(form_86_customs, self).name_search(cr, user, name, args, operator, context, limit)
1904+ res = super(customs_facility, self).name_search(
1905+ cr, user, name, args, operator, context, limit)
1906 if not res and name:
1907- ids = self.search(cr, user, [('code', '=like', name+"%")]+args, limit=limit)
1908+ ids = self.search(cr, user, [(
1909+ 'code', '=like', name+"%")]+args, limit=limit)
1910 if ids:
1911 res = self.name_get(cr, user, ids, context=context)
1912 return res
1913
1914- ##------------------------------------------------------------------------------------ _internal methods
1915-
1916- ##------------------------------------------------------------------------------------ function fields
1917-
1918 _columns = {
1919- 'code': fields.char('Code', size=16, required=True, readonly=False),
1920+ 'code': fields.char('Code', size=16, required=True, readonly=False),
1921 'name': fields.char('Name', size=64, required=True, readonly=False),
1922- }
1923+ }
1924
1925 _defaults = {
1926- }
1927+ }
1928
1929- _sql_constraints = [
1930+ _sql_constraints = [
1931 ('code_uniq', 'UNIQUE(code)', 'The code must be unique!'),
1932- ]
1933-
1934- ##------------------------------------------------------------------------------------
1935-
1936- ##------------------------------------------------------------------------------------ public methods
1937-
1938- ##------------------------------------------------------------------------------------ buttons (object)
1939-
1940- ##------------------------------------------------------------------------------------ on_change...
1941-
1942- ##------------------------------------------------------------------------------------ create write unlink
1943-
1944- ##------------------------------------------------------------------------------------ Workflow
1945-
1946-form_86_customs()
1947-
1948-
1949-
1950-##---------------------------------------------------------------------------------------- form_86_custom_taxes
1951-
1952-class form_86_custom_taxes(osv.osv):
1953+ ]
1954+
1955+
1956+class customs_duty(osv.osv):
1957 '''
1958 A list of the concepts for taxes in form_86
1959 '''
1960
1961- _name = 'form.86.custom.taxes'
1962-
1963+ _name = 'customs.duty'
1964 _description = ''
1965-
1966 _order = 'sequence'
1967
1968-
1969- ##------------------------------------------------------------------------------------
1970-
1971- def name_get(self,cr, uid, ids, context):
1972+ def name_get(self, cr, uid, ids, context):
1973 if not len(ids):
1974 return []
1975 res = []
1976 so_brw = self.browse(cr, uid, ids, context)
1977 for item in so_brw:
1978- res.append((item.id, '[%s] %s - %s'%(item.code,item.ref,item.name)))
1979+ res.append((item.id, '[%s] %s - %s' % (
1980+ item.code, item.ref, item.name)))
1981 return res
1982-
1983- ##------------------------------------------------------------------------------------ _internal methods
1984-
1985- ##------------------------------------------------------------------------------------ function fields
1986
1987 _columns = {
1988- 'code': fields.char('Code', size=16, required=True, readonly=False),
1989+ 'code': fields.char('Code', size=16, required=True, readonly=False),
1990 'name': fields.char('Name', size=64, required=True, readonly=False),
1991- 'ref': fields.char('Ref', size=16, required=False, readonly=False),
1992- 'sequence': fields.integer('Sequence'),
1993- 'partner_id': fields.many2one('res.partner', 'Partner', change_default=True, ondelete='restrict'),
1994- 'account_id':fields.many2one('account.account', 'Account to pay', domain="[('type','!=','view')]", ondelete='restrict',help="This account will be used for expenses related to taxes"),
1995- 'vat_detail':fields.boolean('Tax detail',help="Set true if this is vat related tax"),
1996- 'company_id': fields.many2one('res.company','Company',required=True, readonly=True, ondelete='restrict'),
1997- }
1998+ 'ref': fields.char('Ref', size=16, required=False, readonly=False),
1999+ 'sequence': fields.integer('Sequence'),
2000+ 'partner_id': fields.many2one('res.partner', 'Partner',
2001+ change_default=True,
2002+ ondelete='restrict'),
2003+ 'account_id': fields.many2one('account.account', 'Account to pay',
2004+ domain="[('type','!=','view')]",
2005+ ondelete='restrict',
2006+ help="This account will be used for \
2007+ expenses related to taxes"),
2008+ 'vat_detail': fields.boolean('Tax detail', help="Set true if this is \
2009+ vat related tax"),
2010+ 'company_id': fields.many2one('res.company', 'Company', required=True,
2011+ readonly=True, ondelete='restrict'),
2012+ }
2013
2014 _defaults = {
2015- 'company_id':lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr,uid,'form.86.config',context=c),
2016+ 'company_id': lambda self, cr, uid, c:
2017+ self.pool.get('res.company')._company_default_get(
2018+ cr, uid, 'customs.form.config', context=c),
2019 'vat_detail': False,
2020- }
2021-
2022- _sql_constraints = [
2023- ('code_uniq', 'UNIQUE(code,company_id)', 'The code must be unique! (for this comany)'),
2024- ('sequence_uniq', 'UNIQUE(sequence,company_id)', 'The sequence must be unique! (for this comany)'),
2025- ]
2026-
2027- ##------------------------------------------------------------------------------------
2028-
2029- ##------------------------------------------------------------------------------------ public methods
2030-
2031- ##------------------------------------------------------------------------------------ buttons (object)
2032-
2033- ##------------------------------------------------------------------------------------ on_change...
2034-
2035- ##------------------------------------------------------------------------------------ create write unlink
2036-
2037- ##------------------------------------------------------------------------------------ Workflow
2038-
2039-form_86_custom_taxes()
2040+ }
2041+
2042+ _sql_constraints = [
2043+ ('code_uniq', 'UNIQUE(code,company_id)',
2044+ 'The code must be unique! (for this comany)'),
2045+ ('sequence_uniq', 'UNIQUE(sequence,company_id)',
2046+ 'The sequence must be unique! (for this comany)'),
2047+ ]
2048
2049
2050=== modified file 'l10n_ve_imex/model/invoice.py'
2051--- l10n_ve_imex/model/invoice.py 2013-04-16 20:42:20 +0000
2052+++ l10n_ve_imex/model/invoice.py 2013-04-29 19:14:27 +0000
2053@@ -1,63 +1,134 @@
2054 # -*- encoding: utf-8 -*-
2055-##############################################################################
2056-# Company: Tecvemar, c.a.
2057-# Author: Juan V. Márquez L.
2058-# Creation Date: 10/04/2012
2059-# Version: 0.0.0.0
2060-#
2061-# Description:
2062-#
2063-#
2064-##############################################################################
2065-
2066-from openerp.osv import osv
2067-from openerp.osv import fields
2068-
2069-
2070-##---------------------------------------------------------------------------------------- inherited_invoice
2071+###############################################################################
2072+# Module Writen to OpenERP, Open Source Management Solution
2073+# Copyright (c) 2013 Vauxoo C.A. (http://openerp.com.ve/)
2074+# All Rights Reserved
2075+############# Credits #########################################################
2076+# Coded by: Juan Marzquez (Tecvemar, c.a.) <jmarquez@tecvemar.com.ve>
2077+# Katherine Zaoral <katherine.zaoral@vauxoo.com>
2078+# Planified by:
2079+# Juan Marquez <jmarquez@tecvemar.com.ve>
2080+# Humberto Arocha <hbto@vauxoo.com>
2081+# Audited by: Humberto Arocha <hbto@vauxoo.com>
2082+###############################################################################
2083+# This program is free software: you can redistribute it and/or modify
2084+# it under the terms of the GNU Affero General Public License as
2085+# published by the Free Software Foundation, either version 3 of the
2086+# License, or (at your option) any later version.
2087+#
2088+# This program is distributed in the hope that it will be useful,
2089+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2090+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2091+# GNU Affero General Public License for more details.
2092+#
2093+# You should have received a copy of the GNU Affero General Public License
2094+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2095+###############################################################################
2096+
2097+from openerp.osv import osv, fields
2098+import openerp.addons.decimal_precision as dp
2099+
2100
2101 class inherited_invoice(osv.osv):
2102
2103 _inherit = "account.invoice"
2104
2105-
2106- ##------------------------------------------------------------------------------------
2107-
2108- ##------------------------------------------------------------------------------------ _internal methods
2109-
2110- ##------------------------------------------------------------------------------------ function fields
2111-
2112 _columns = {
2113- 'num_import_form_id':fields.many2one('seniat.form.86', 'Import file number', change_default=True, required=False, readonly=True,
2114- states={'draft':[('readonly',False)]}, ondelete='restrict',
2115- domain = [('state','=',('draft'))], help="The related form 86 for this import invoice (only draft)"),
2116- }
2117-
2118- ##------------------------------------------------------------------------------------
2119-
2120- ##------------------------------------------------------------------------------------ public methods
2121-
2122- ##------------------------------------------------------------------------------------ buttons (object)
2123-
2124- ##------------------------------------------------------------------------------------ on_change...
2125-
2126- def on_change_num_import_form_id(self, cr, uid, ids, num_import_form_id):
2127+ 'customs_form_id': fields.many2one(
2128+ 'customs.form', 'Import file number', change_default=True,
2129+ required=False, readonly=True,
2130+ states={'draft': [('readonly', False)]}, ondelete='restrict',
2131+ domain=[('state', '=', ('draft'))],
2132+ help="The related form 86 for this import invoice (only draft)"),
2133+ 'imex_tax_line': fields.one2many(
2134+ 'account.invoice.tax', 'imex_inv_id', 'Vat lines',
2135+ attrs="{'readonly':[('vat_detail','=',True)], \
2136+ 'required':[('vat_detail','=',True)]}"),
2137+ }
2138+
2139+ def on_change_customs_form_id(self, cr, uid, ids, customs_form_id):
2140 res = {}
2141- if num_import_form_id:
2142- imp = self.pool.get('seniat.form.86').browse(cr,uid,num_import_form_id,context=None)
2143- res = {'value':{'num_import_form':imp.name,'import_invo':imp.date_liq}}
2144+ if customs_form_id:
2145+ imp = self.pool.get('customs.form').browse(cr, uid,
2146+ customs_form_id,
2147+ context=None)
2148+ res = {'value': {'num_import_form': imp.name,
2149+ 'import_invo': imp.date_liq}}
2150 return res
2151
2152- ##------------------------------------------------------------------------------------ create write unlink
2153-
2154- ##------------------------------------------------------------------------------------ Workflow
2155-
2156 def test_open(self, cr, uid, ids, *args):
2157- so_brw = self.browse(cr,uid,ids,context={})
2158+ so_brw = self.browse(cr, uid, ids, context={})
2159 for item in so_brw:
2160- if item.num_import_form_id and item.num_import_form_id.state in ('draft','cancel'):
2161- raise osv.except_osv(_('Error!'),_('Can\'t validate a invoice while the form 86 state\'s is cancel or draft (%s).\nPlease validate the form 86 first.')%item.num_import_form_id.name)
2162+ if item.customs_form_id and \
2163+ item.customs_form_id.state in ('draft', 'cancel'):
2164+ raise osv.except_osv(_('Error!'), _(
2165+ 'Can\'t validate a invoice while the form 86 state\'s is \
2166+ cancel or draft (%s).\nPlease validate the form 86 first.')
2167+ % item.customs_form_id.name)
2168 return super(account_invoice, self).test_open(cr, uid, ids, args)
2169
2170-inherited_invoice()
2171-
2172+
2173+class inheried_account_invoice_tax(osv.osv):
2174+
2175+ _inherit = 'account.invoice.tax'
2176+
2177+ _columns = {
2178+ 'cfl_id': fields.many2one('customs.form.line',
2179+ 'Vat line',
2180+ ondelete='cascade'),
2181+ 'imex_inv_id': fields.many2one('account.invoice', 'Imex Invoice',
2182+ ondelete='cascade', select=True),
2183+ 'partner_id': fields.related('imex_inv_id', 'partner_id',
2184+ type='many2one', relation='res.partner',
2185+ string='Supplier'),
2186+ 'reference': fields.related('imex_inv_id', 'reference', type='char',
2187+ string='Invoice ref', size=64, store=False,
2188+ readonly=True),
2189+ }
2190+
2191+ _defaults = {
2192+ }
2193+
2194+ #~ _sql_constraints = [
2195+ #~ ('base_gt_zero', 'CHECK (base>0)',
2196+ #~ 'The base amount must be > 0!'),
2197+ #~ ('amount_zero', 'CHECK (amount>=0)',
2198+ #~ 'The tax amount must be >= 0!'),
2199+ #~ ]
2200+
2201+ #~ def on_change_cfl_id(self, cr, uid, ids,
2202+ #~ cfl_id):
2203+ #~ '''
2204+ #~ Create a domain to filter invoice_id for invoices listed in
2205+ #~ customs_form.invoice_ids only
2206+ #~ http://help.openerp.com/question/11180/how-to-create-a-domain-for-
2207+ #~ field-in-parentparent-model/
2208+ #~ '''
2209+ #~ res = {}
2210+ #~ if cfl_id:
2211+ #~ line_obj = self.pool.get('customs.form.line')
2212+ #~ invoices = [i.id for i in line_obj.browse(
2213+ #~ cr, uid, cfl_id).customs_form_id.invoice_ids]
2214+ #~ res = {'domain': {'invoice_id': [('id','in',invoices)]}}
2215+ #~ return res
2216+
2217+ def on_change_amount(self, cr, uid, ids, tax_id, base, amount):
2218+ """ To autocompute base or tax, only for percent based taxes. """
2219+ res = {}
2220+ if tax_id:
2221+ obj_vat = self.pool.get('account.tax')
2222+ vat = obj_vat.browse(cr, uid, tax_id)
2223+ if vat.type == 'percent':
2224+ if base == 0 and amount > 0:
2225+ base = round(amount / vat.amount, 2)
2226+ res = {'value': {'base': base}}
2227+ return res
2228+
2229+ def on_change_invoice_id(self, cr, uid, ids, invoice_id):
2230+ res = {}
2231+ if invoice_id:
2232+ obj_inv = self.pool.get('account.invoice')
2233+ inv = obj_inv.browse(cr, uid, invoice_id)
2234+ res = {'value': {'partner_id': inv.partner_id.id,
2235+ 'reference': inv.reference}}
2236+ return res
2237
2238=== modified file 'l10n_ve_imex/security/ir.model.access.csv'
2239--- l10n_ve_imex/security/ir.model.access.csv 2013-04-11 21:42:15 +0000
2240+++ l10n_ve_imex/security/ir.model.access.csv 2013-04-29 19:14:27 +0000
2241@@ -1,13 +1,11 @@
2242 "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
2243-"form_86_config_user","form.86.config.user","model_form_86_config","account.group_account_user",1,0,0,0
2244-"form_86_config_manager","form.86.config.manager","model_form_86_config","account.group_account_manager",1,1,1,1
2245-"form_86_customs_user","form.86.customs.user","model_form_86_customs","account.group_account_user",1,0,0,0
2246-"form_86_customs_manager","form.86.customs.manager","model_form_86_customs","account.group_account_manager",1,1,1,1
2247-"form_86_custom_taxes_user","form.86.custom.taxes.user","model_form_86_custom_taxes","account.group_account_user",1,0,0,0
2248-"form_86_custom_taxes_manager","form.86.custom.taxes.manager","model_form_86_custom_taxes","account.group_account_manager",1,1,1,1
2249-"seniat_form_86_user","seniat.form.86.user","model_seniat_form_86","account.group_account_user",1,1,1,0
2250-"seniat_form_86_manager","seniat.form.86.manager","model_seniat_form_86","account.group_account_manager",1,1,1,1
2251-"seniat_form_86_lines_user","seniat.form.86.lines.user","model_seniat_form_86_lines","account.group_account_user",1,1,1,0
2252-"seniat_form_86_lines_manager","seniat.form.86.lines.manager","model_seniat_form_86_lines","account.group_account_manager",1,1,1,1
2253-"seniat_form_86_lines_vat_user","seniat.form.86.lines.vat.user","model_seniat_form_86_lines_vat","account.group_account_user",1,1,1,0
2254-"seniat_form_86_lines_vat_manager","seniat.form.86.lines.vat.manager","model_seniat_form_86_lines_vat","account.group_account_manager",1,1,1,1
2255+"customs_form_config_user","customs.form.config.user","model_customs_form_config","account.group_account_user",1,0,0,0
2256+"customs_form_config_manager","customs.form.config.manager","model_customs_form_config","account.group_account_manager",1,1,1,1
2257+"customs_facility_user","customs.facility.user","model_customs_facility","account.group_account_user",1,0,0,0
2258+"customs_facility_manager","customs.facility.manager","model_customs_facility","account.group_account_manager",1,1,1,1
2259+"customs_duty_user","customs.duty.user","model_customs_duty","account.group_account_user",1,0,0,0
2260+"customs_duty_manager","customs.duty.manager","model_customs_duty","account.group_account_manager",1,1,1,1
2261+"customs_form_user","customs.form.user","model_customs_form","account.group_account_user",1,1,1,0
2262+"customs_form_manager","customs.form.manager","model_customs_form","account.group_account_manager",1,1,1,1
2263+"customs_form_line_user","customs.form.line.user","model_customs_form_line","account.group_account_user",1,1,1,0
2264+"customs_form_line_manager","customs.form.line.manager","model_customs_form_line","account.group_account_manager",1,1,1,1
2265
2266=== modified file 'l10n_ve_imex/security/ir_rule.xml'
2267--- l10n_ve_imex/security/ir_rule.xml 2013-04-09 19:08:41 +0000
2268+++ l10n_ve_imex/security/ir_rule.xml 2013-04-29 19:14:27 +0000
2269@@ -2,16 +2,16 @@
2270 <openerp>
2271 <data>
2272
2273- <record model="ir.rule" id="form_86_config_comp_rule">
2274- <field name="name">Form 86 config company rule</field>
2275- <field name="model_id" ref="model_form_86_config"/>
2276+ <record model="ir.rule" id="customs_form_config_comp_rule">
2277+ <field name="name">Customs Form Config Company Rule</field>
2278+ <field name="model_id" ref="model_customs_form_config"/>
2279 <field name="global" eval="True"/>
2280 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
2281 </record>
2282
2283- <record model="ir.rule" id="form_86_custom_taxes_comp_rule">
2284- <field name="name">Form 86 customs tax company rule</field>
2285- <field name="model_id" ref="model_form_86_custom_taxes"/>
2286+ <record model="ir.rule" id="customs_duty_comp_rule">
2287+ <field name="name">Customs Form Duty Company Rule</field>
2288+ <field name="model_id" ref="model_customs_duty"/>
2289 <field name="global" eval="True"/>
2290 <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
2291 </record>
2292
2293=== renamed file 'l10n_ve_imex/view/seniat_form_86.xml' => 'l10n_ve_imex/view/customs_form.xml'
2294--- l10n_ve_imex/view/seniat_form_86.xml 2013-04-25 20:18:13 +0000
2295+++ l10n_ve_imex/view/customs_form.xml 2013-04-29 19:14:27 +0000
2296@@ -1,14 +1,10 @@
2297 <?xml version="1.0" encoding="utf-8"?>
2298 <openerp>
2299 <data>
2300-
2301-<!--
2302-seniat_form_86
2303--->
2304
2305- <record id="view_seniat_form_86_form" model="ir.ui.view">
2306- <field name="name">seniat.form.86.form</field>
2307- <field name="model">seniat.form.86</field>
2308+ <record id="view_customs_form_form" model="ir.ui.view">
2309+ <field name="name">customs.form.form</field>
2310+ <field name="model">customs.form</field>
2311 <field name="arch" type="xml">
2312 <form string="Seniat" version='7.0'>
2313 <header>
2314@@ -28,8 +24,8 @@
2315 <field name="ref_liq"/>
2316 <field name="date_liq"/>
2317 </group>
2318- <field name="custom_id" colspan="4"/>
2319- <field name="line_ids" colspan="4" nolabel="1">
2320+ <field name="customs_facility_id" colspan="4"/>
2321+ <field name="cfl_ids" colspan="4" nolabel="1">
2322 <tree string="Tax lines">
2323 <field name="tax_code"/>
2324 <field name="amount" sum="Amount total"/>
2325@@ -40,28 +36,28 @@
2326 <field name="amount"/>
2327 </group>
2328 <field name="vat_detail" invisible="1"/>
2329- <field name="line_vat_ids" colspan="4" nolabel="1" attrs="{'invisible':[('vat_detail','!=',True)]}">
2330+ <field name="imex_tax_line" colspan="4" nolabel="1" required="1" attrs="{'invisible':[('vat_detail','!=',True)]}">
2331 <tree string="Vat tax detail" editable="bottom">
2332 <!--
2333- <field name="line_vat_id" invisible="1" on_change="on_change_line_vat_id(line_vat_id)"/>
2334+ <field name="cfl_id" invisible="1" on_change="on_change_cfl_id(cfl_id)"/>
2335 -->
2336 <field name="invoice_id" on_change="on_change_invoice_id(invoice_id)"/>
2337 <field name="partner_id"/>
2338 <field name="reference"/>
2339- <field name="acc_tax_id" widget="selection"/>
2340- <field name="base_amount" on_change="on_change_amount(acc_tax_id, base_amount, tax_amount)"/>
2341- <field name="tax_amount" on_change="on_change_amount(acc_tax_id, base_amount, tax_amount)" sum="Tax amount total"/>
2342+ <field name="tax_id" domain="[('type_tax_use', '=', 'purchase')]" widget="selection"/>
2343+ <field name="base" on_change="on_change_amount(tax_id, base, amount)"/>
2344+ <field name="amount" on_change="on_change_amount(tax_id, base, amount)" sum="Tax amount total"/>
2345 </tree>
2346 <form>
2347 <!--
2348- <field name="line_vat_id" invisible="1" on_change="on_change_line_vat_id(line_vat_id)"/>
2349+ <field name="cfl_id" invisible="1" on_change="on_change_cfl_id(cfl_id)"/>
2350 -->
2351 <field name="invoice_id" on_change="on_change_invoice_id(invoice_id)"/>
2352 <field name="partner_id"/>
2353 <field name="reference"/>
2354- <field name="acc_tax_id" widget="selection"/>
2355- <field name="base_amount" on_change="on_change_amount(acc_tax_id, base_amount, tax_amount)"/>
2356- <field name="tax_amount" on_change="on_change_amount(acc_tax_id, base_amount, tax_amount)"/>
2357+ <field name="tax_id" domain="[('type_tax_use', '=', 'purchase')]" widget="selection"/>
2358+ <field name="base" on_change="on_change_amount(tax_id, base, amount)"/>
2359+ <field name="amount" on_change="on_change_amount(tax_id, base, amount)"/>
2360 </form>
2361 </field>
2362 </form>
2363@@ -87,10 +83,9 @@
2364 </field>
2365 </record>
2366
2367-
2368- <record id="view_seniat_form_86_tree" model="ir.ui.view" >
2369- <field name="name">seniat.form.86.tree</field>
2370- <field name="model">seniat.form.86</field>
2371+ <record id="view_customs_form_tree" model="ir.ui.view" >
2372+ <field name="name">customs.form.tree</field>
2373+ <field name="model">customs.form</field>
2374 <field name="arch" type="xml">
2375 <tree string="SENIAT" colors="red:state in ('draft');gray:state in ('cancel');darkgreen:state in ('open')">
2376 <field name="name"/>
2377@@ -98,7 +93,7 @@
2378 <field name="broker_id"/>
2379 <field name="ref_liq"/>
2380 <field name="date_liq"/>
2381- <field name="custom_id"/>
2382+ <field name="customs_facility_id"/>
2383 <field name="amount_total"/>
2384 <field name="state" invisible="1"/>
2385 </tree>
2386
2387=== renamed file 'l10n_ve_imex/view/seniat_form_86_config.xml' => 'l10n_ve_imex/view/customs_form_config.xml'
2388--- l10n_ve_imex/view/seniat_form_86_config.xml 2013-04-25 20:18:13 +0000
2389+++ l10n_ve_imex/view/customs_form_config.xml 2013-04-29 19:14:27 +0000
2390@@ -3,14 +3,14 @@
2391 <data>
2392
2393 <!--
2394-form_86_config
2395+customs_form_config
2396 -->
2397
2398- <record id="view_form_86_config_form" model="ir.ui.view">
2399- <field name="name">form.86.config.form</field>
2400- <field name="model">form.86.config</field>
2401+ <record id="view_customs_form_config_form" model="ir.ui.view">
2402+ <field name="name">customs.form.config.form</field>
2403+ <field name="model">customs.form.config</field>
2404 <field name="arch" type="xml">
2405- <form string="Form 86 Config" version='7.0'>
2406+ <form string="Customs Form Config" version='7.0'>
2407 <header>
2408 <!--
2409 <field name="state" widget="statusbar" statusbar_visible="draft,open,done" statusbar_colors='{"draft":"blue","open":"green","done":"red"}' />
2410@@ -25,11 +25,11 @@
2411 </record>
2412
2413
2414- <record id="view_form_86_config_tree" model="ir.ui.view">
2415- <field name="name">form.86.config.tree</field>
2416- <field name="model">form.86.config</field>
2417+ <record id="view_customs_form_config_tree" model="ir.ui.view">
2418+ <field name="name">customs.form.config.tree</field>
2419+ <field name="model">customs.form.config</field>
2420 <field name="arch" type="xml">
2421- <tree string="Form 86 Config">
2422+ <tree string="Customs Form Config">
2423 <field name="company_id"/>
2424 <field name="journal_id"/>
2425 </tree>
2426@@ -38,12 +38,12 @@
2427
2428
2429 <!--
2430-form_86_customs
2431+customs_facility
2432 -->
2433
2434- <record id="view_form_86_customs_form" model="ir.ui.view">
2435- <field name="name">form.86.customs.form</field>
2436- <field name="model">form.86.customs</field>
2437+ <record id="view_customs_facility_form" model="ir.ui.view">
2438+ <field name="name">customs.facility.form</field>
2439+ <field name="model">customs.facility</field>
2440 <field name="arch" type="xml">
2441 <form string="Customs" version='7.0'>
2442 <header>
2443@@ -60,9 +60,9 @@
2444 </record>
2445
2446
2447- <record id="view_form_86_customs_tree" model="ir.ui.view">
2448- <field name="name">form.86.customs.tree</field>
2449- <field name="model">form.86.customs</field>
2450+ <record id="view_customs_facility_tree" model="ir.ui.view">
2451+ <field name="name">customs.facility.tree</field>
2452+ <field name="model">customs.facility</field>
2453 <field name="arch" type="xml">
2454 <tree string="Customs">
2455 <field name="code"/>
2456@@ -73,12 +73,12 @@
2457
2458
2459 <!--
2460-form_86_customs_tax_codes
2461+customs_facility_tax_codes
2462 -->
2463
2464- <record id="view_form_86_custom_taxes_form" model="ir.ui.view">
2465- <field name="name">form.86.custom.taxes.form</field>
2466- <field name="model">form.86.custom.taxes</field>
2467+ <record id="view_customs_duty_form" model="ir.ui.view">
2468+ <field name="name">customs.duty.form</field>
2469+ <field name="model">customs.duty</field>
2470 <field name="arch" type="xml">
2471 <form string="Custom Taxes">
2472 <field name="code"/>
2473@@ -94,9 +94,9 @@
2474 </record>
2475
2476
2477- <record id="view_form_86_custom_taxes_tree" model="ir.ui.view">
2478- <field name="name">form.86.custom.taxes.tree</field>
2479- <field name="model">form.86.custom.taxes</field>
2480+ <record id="view_customs_duty_tree" model="ir.ui.view">
2481+ <field name="name">customs.duty.tree</field>
2482+ <field name="model">customs.duty</field>
2483 <field name="arch" type="xml">
2484 <tree string="Custom Taxes">
2485 <field name="code"/>
2486
2487=== renamed file 'l10n_ve_imex/view/seniat_form_86_menus.xml' => 'l10n_ve_imex/view/customs_form_menus.xml'
2488--- l10n_ve_imex/view/seniat_form_86_menus.xml 2013-04-16 14:56:39 +0000
2489+++ l10n_ve_imex/view/customs_form_menus.xml 2013-04-29 19:14:27 +0000
2490@@ -7,70 +7,70 @@
2491 -->
2492
2493 <menuitem name="Import/Export - SENIAT - Form 99086"
2494- id="menu_form_86_config_group"
2495+ id="menu_customs_form_config_group"
2496 parent="l10n_ve_fiscal_requirements.menu_finance_fiscal_settings"
2497 sequence="80"/>
2498
2499 <!--
2500-form_86_config
2501+customs_form_config
2502 -->
2503
2504- <record model="ir.actions.act_window" id="action_form_86_config">
2505+ <record model="ir.actions.act_window" id="action_customs_form_config">
2506 <field name="name">Configuration</field>
2507- <field name="res_model">form.86.config</field>
2508+ <field name="res_model">customs.form.config</field>
2509 <field name="type">ir.actions.act_window</field>
2510 <field name="view_type">form</field>
2511 <field name="view_mode">tree,form</field>
2512 </record>
2513
2514 <menuitem
2515- id="menu_action_form_86_config"
2516- parent="menu_form_86_config_group"
2517- action="action_form_86_config"/>
2518+ id="menu_action_customs_form_config"
2519+ parent="menu_customs_form_config_group"
2520+ action="action_customs_form_config"/>
2521
2522 <!--
2523-form_86_customs
2524+customs_facility
2525 -->
2526
2527- <record model="ir.actions.act_window" id="action_form_86_customs">
2528+ <record model="ir.actions.act_window" id="action_customs_facility">
2529 <field name="name">Customs</field>
2530- <field name="res_model">form.86.customs</field>
2531+ <field name="res_model">customs.facility</field>
2532 <field name="type">ir.actions.act_window</field>
2533 <field name="view_type">form</field>
2534 <field name="view_mode">tree,form</field>
2535 </record>
2536
2537 <menuitem
2538- id="menu_action_form_86_customs"
2539- parent="menu_form_86_config_group"
2540- action="action_form_86_customs"/>
2541+ id="menu_action_customs_facility"
2542+ parent="menu_customs_form_config_group"
2543+ action="action_customs_facility"/>
2544
2545 <!--
2546-form_86_customs_tax_codes
2547+customs_facility_tax_codes
2548 -->
2549
2550- <record model="ir.actions.act_window" id="action_form_86_custom_taxes">
2551+ <record model="ir.actions.act_window" id="action_customs_duty">
2552 <field name="name">Tax codes</field>
2553- <field name="res_model">form.86.custom.taxes</field>
2554+ <field name="res_model">customs.duty</field>
2555 <field name="type">ir.actions.act_window</field>
2556 <field name="view_type">form</field>
2557 <field name="view_mode">tree,form</field>
2558 </record>
2559
2560 <menuitem
2561- id="menu_action_form_86_custom_taxes"
2562- parent="menu_form_86_config_group"
2563- action="action_form_86_custom_taxes"/>
2564+ id="menu_action_customs_duty"
2565+ parent="menu_customs_form_config_group"
2566+ action="action_customs_duty"/>
2567
2568
2569 <!--
2570-seniat_form_86
2571+customs_form
2572 -->
2573
2574
2575- <record model="ir.actions.act_window" id="action_seniat_form_86">
2576+ <record model="ir.actions.act_window" id="action_customs_form">
2577 <field name="name">SENIAT - Form 99086</field>
2578- <field name="res_model">seniat.form.86</field>
2579+ <field name="res_model">customs.form</field>
2580 <field name="type">ir.actions.act_window</field>
2581 <field name="view_type">form</field>
2582 <field name="view_mode">tree,form</field>
2583@@ -83,9 +83,9 @@
2584 sequence="8"/>
2585
2586 <menuitem
2587- id="menu_action_seniat_form_86"
2588+ id="menu_action_customs_form"
2589 parent="menu_finance_forma"
2590- action="action_seniat_form_86"/>
2591+ action="action_customs_form"/>
2592
2593 </data>
2594 </openerp>
2595
2596=== modified file 'l10n_ve_imex/view/invoice.xml'
2597--- l10n_ve_imex/view/invoice.xml 2013-04-15 20:40:38 +0000
2598+++ l10n_ve_imex/view/invoice.xml 2013-04-29 19:14:27 +0000
2599@@ -8,8 +8,8 @@
2600 <field name="inherit_id" ref="l10n_ve_fiscal_requirements.account_invoice_ext_view_supp_form_loc_ve"/>
2601 <field name="arch" type="xml">
2602 <xpath expr="//field[@name='nro_ctrl']" position="before">
2603- <field name="num_import_form_id" attrs="{'readonly':[('expedient','=',False)],'required':[('expedient','=',True)]}"
2604- on_change="on_change_num_import_form_id(num_import_form_id)"/>
2605+ <field name="customs_form_id" attrs="{'readonly':[('expedient','=',False)],'required':[('expedient','=',True)]}"
2606+ on_change="on_change_customs_form_id(customs_form_id)"/>
2607 </xpath>
2608 </field>
2609 </record>
2610
2611=== renamed file 'l10n_ve_imex/workflow/seniat_form_86.xml' => 'l10n_ve_imex/workflow/customs_form.xml'
2612--- l10n_ve_imex/workflow/seniat_form_86.xml 2013-04-11 14:28:42 +0000
2613+++ l10n_ve_imex/workflow/customs_form.xml 2013-04-29 19:14:27 +0000
2614@@ -6,9 +6,9 @@
2615 Workflow
2616 -->
2617
2618- <record id="wkf_seniat_form_86" model="workflow">
2619- <field name="name">seniat_form_86_wkf</field>
2620- <field name="osv">seniat.form.86</field>
2621+ <record id="wkf_customs_form" model="workflow">
2622+ <field name="name">customs_form_wkf</field>
2623+ <field name="osv">customs.form</field>
2624 <field name="on_create">True</field>
2625 </record>
2626
2627@@ -17,7 +17,7 @@
2628 -->
2629
2630 <record id="act_draft" model="workflow.activity">
2631- <field name="wkf_id" ref="wkf_seniat_form_86"/>
2632+ <field name="wkf_id" ref="wkf_customs_form"/>
2633 <field name="flow_start">True</field>
2634 <field name="name">draft</field>
2635 <field name="action">button_draft()</field>
2636@@ -25,21 +25,21 @@
2637 </record>
2638
2639 <record id="act_open" model="workflow.activity">
2640- <field name="wkf_id" ref="wkf_seniat_form_86"/>
2641+ <field name="wkf_id" ref="wkf_customs_form"/>
2642 <field name="name">open</field>
2643 <field name="kind">function</field>
2644 <field name="action">button_open()</field>
2645 </record>
2646
2647 <record id="act_done" model="workflow.activity">
2648- <field name="wkf_id" ref="wkf_seniat_form_86"/>
2649+ <field name="wkf_id" ref="wkf_customs_form"/>
2650 <field name="name">done</field>
2651 <field name="kind">function</field>
2652 <field name="action">button_done()</field>
2653 </record>
2654
2655 <record id="act_cancel" model="workflow.activity">
2656- <field name="wkf_id" ref="wkf_seniat_form_86"/>
2657+ <field name="wkf_id" ref="wkf_customs_form"/>
2658 <field name="name">cancel</field>
2659 <field name="action">button_cancel()</field>
2660 <field name="kind">function</field>