Merge lp:~vauxoo/openerp-venezuela-localization/7.0-pylint5-dev-sabrina into lp:openerp-venezuela-localization

Proposed by Sabrina Romero - http://www.vauxoo.com
Status: Merged
Merged at revision: 1045
Proposed branch: lp:~vauxoo/openerp-venezuela-localization/7.0-pylint5-dev-sabrina
Merge into: lp:openerp-venezuela-localization
Diff against target: 10707 lines (+2306/-2410)
120 files modified
l10n_ve_fiscal_book/__init__.py (+3/-3)
l10n_ve_fiscal_book/__openerp__.py (+2/-2)
l10n_ve_fiscal_book/adjustment_book.py (+117/-126)
l10n_ve_fiscal_book/model/__init__.py (+5/-5)
l10n_ve_fiscal_book/model/customs_form.py (+1/-3)
l10n_ve_fiscal_book/model/fiscal_book.py (+237/-240)
l10n_ve_fiscal_book/model/invoice.py (+2/-2)
l10n_ve_fiscal_book/model/wh_iva.py (+7/-7)
l10n_ve_fiscal_book/wizard/__init__.py (+3/-3)
l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py (+1/-2)
l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py (+11/-14)
l10n_ve_fiscal_requirements/__init__.py (+3/-3)
l10n_ve_fiscal_requirements/__openerp__.py (+3/-3)
l10n_ve_fiscal_requirements/installer.py (+16/-15)
l10n_ve_fiscal_requirements/model/__init__.py (+9/-9)
l10n_ve_fiscal_requirements/model/account.py (+15/-14)
l10n_ve_fiscal_requirements/model/account_tax.py (+8/-8)
l10n_ve_fiscal_requirements/model/invoice.py (+42/-38)
l10n_ve_fiscal_requirements/model/l10n_ut.py (+1/-3)
l10n_ve_fiscal_requirements/model/partner.py (+74/-68)
l10n_ve_fiscal_requirements/model/res_company.py (+2/-5)
l10n_ve_fiscal_requirements/model/res_users.py (+10/-11)
l10n_ve_fiscal_requirements/model/seniat_url.py (+18/-22)
l10n_ve_fiscal_requirements/wizard/__init__.py (+8/-8)
l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py (+33/-38)
l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py (+96/-96)
l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py (+22/-22)
l10n_ve_fiscal_requirements/wizard/update_info_partner.py (+6/-8)
l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py (+32/-36)
l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py (+3/-5)
l10n_ve_fiscal_requirements/wizard/wizard_update_name.py (+6/-5)
l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py (+24/-28)
l10n_ve_generic/__init__.py (+1/-1)
l10n_ve_imex/__init__.py (+1/-1)
l10n_ve_imex/model/__init__.py (+3/-3)
l10n_ve_imex/model/customs_form.py (+2/-4)
l10n_ve_imex/model/customs_form_config.py (+4/-4)
l10n_ve_imex/model/invoice.py (+26/-26)
l10n_ve_sale_purchase/__init__.py (+2/-2)
l10n_ve_sale_purchase/__openerp__.py (+1/-1)
l10n_ve_sale_purchase/model/__init__.py (+5/-5)
l10n_ve_sale_purchase/model/product.py (+10/-14)
l10n_ve_sale_purchase/model/purchase.py (+15/-17)
l10n_ve_sale_purchase/model/sale.py (+10/-14)
l10n_ve_sale_purchase/model/stock.py (+8/-13)
l10n_ve_split_invoice/__init__.py (+1/-1)
l10n_ve_split_invoice/model/__init__.py (+3/-3)
l10n_ve_split_invoice/model/installer.py (+10/-9)
l10n_ve_split_invoice/model/invoice.py (+15/-16)
l10n_ve_split_invoice/model/res_company.py (+5/-6)
l10n_ve_vat_write_off/__init__.py (+1/-1)
l10n_ve_vat_write_off/__openerp__.py (+1/-1)
l10n_ve_vat_write_off/model/__init__.py (+1/-1)
l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py (+99/-99)
l10n_ve_withholding/__init__.py (+2/-2)
l10n_ve_withholding/__openerp__.py (+4/-4)
l10n_ve_withholding/model/__init__.py (+3/-3)
l10n_ve_withholding/model/account.py (+47/-44)
l10n_ve_withholding/model/invoice.py (+43/-42)
l10n_ve_withholding_islr/__init__.py (+3/-3)
l10n_ve_withholding_islr/edi/__init__.py (+2/-2)
l10n_ve_withholding_islr/edi/islr_wh_doc.py (+10/-13)
l10n_ve_withholding_islr/model/__init__.py (+9/-9)
l10n_ve_withholding_islr/model/installer.py (+9/-9)
l10n_ve_withholding_islr/model/invoice.py (+12/-10)
l10n_ve_withholding_islr/model/islr_wh_concept.py (+11/-17)
l10n_ve_withholding_islr/model/islr_wh_doc.py (+78/-90)
l10n_ve_withholding_islr/model/islr_xml_wh.py (+78/-80)
l10n_ve_withholding_islr/model/partner.py (+4/-4)
l10n_ve_withholding_islr/model/product.py (+11/-13)
l10n_ve_withholding_islr/model/rates.py (+23/-27)
l10n_ve_withholding_islr/model/res_company.py (+6/-10)
l10n_ve_withholding_islr/report/__init__.py (+2/-2)
l10n_ve_withholding_islr/report/list_wh_islr.py (+2/-2)
l10n_ve_withholding_islr/report/wh_islr.py (+14/-14)
l10n_ve_withholding_islr/wizard/__init__.py (+4/-4)
l10n_ve_withholding_islr/wizard/account_invoice_refund.py (+5/-7)
l10n_ve_withholding_islr/wizard/employee_income_wh.py (+13/-13)
l10n_ve_withholding_islr/wizard/income_wh_change_concept.py (+3/-2)
l10n_ve_withholding_islr/wizard/partner_income_wh_print.py (+9/-9)
l10n_ve_withholding_iva/__init__.py (+4/-4)
l10n_ve_withholding_iva/__openerp__.py (+2/-2)
l10n_ve_withholding_iva/model/__init__.py (+8/-8)
l10n_ve_withholding_iva/model/account.py (+2/-2)
l10n_ve_withholding_iva/model/generate_txt.py (+106/-110)
l10n_ve_withholding_iva/model/installer.py (+37/-37)
l10n_ve_withholding_iva/model/invoice.py (+68/-70)
l10n_ve_withholding_iva/model/partner.py (+2/-1)
l10n_ve_withholding_iva/model/res_company.py (+4/-3)
l10n_ve_withholding_iva/model/wh_iva.py (+158/-147)
l10n_ve_withholding_iva/report/__init__.py (+2/-2)
l10n_ve_withholding_iva/report/list_wh_iva.py (+41/-43)
l10n_ve_withholding_iva/report/withholding_vat.py (+71/-78)
l10n_ve_withholding_iva/wizard/__init__.py (+4/-4)
l10n_ve_withholding_iva/wizard/account_invoice_refund.py (+5/-7)
l10n_ve_withholding_iva/wizard/wizard_retention.py (+6/-8)
l10n_ve_withholding_iva/wizard/wizard_wh_nro.py (+6/-5)
l10n_ve_withholding_muni/__init__.py (+2/-2)
l10n_ve_withholding_muni/model/__init__.py (+4/-4)
l10n_ve_withholding_muni/model/invoice.py (+23/-24)
l10n_ve_withholding_muni/model/partner.py (+1/-0)
l10n_ve_withholding_muni/model/wh_muni.py (+16/-16)
l10n_ve_withholding_muni/report/__init__.py (+2/-2)
l10n_ve_withholding_muni/report/wh_muni_report.py (+10/-12)
l10n_ve_withholding_src/__init__.py (+4/-4)
l10n_ve_withholding_src/__openerp__.py (+5/-5)
l10n_ve_withholding_src/model/__init__.py (+5/-5)
l10n_ve_withholding_src/model/invoice.py (+56/-56)
l10n_ve_withholding_src/model/partner.py (+3/-4)
l10n_ve_withholding_src/model/res_company.py (+3/-5)
l10n_ve_withholding_src/model/wh_src.py (+144/-153)
l10n_ve_withholding_src/report/__init__.py (+2/-2)
l10n_ve_withholding_src/report/wh_src_report.py (+19/-23)
l10n_ve_withholding_src/wizard/__init__.py (+2/-2)
l10n_ve_withholding_src/wizard/wizard_retention.py (+8/-10)
ovl/__init__.py (+1/-1)
ovl/__openerp__.py (+13/-13)
ovl/model/__init__.py (+1/-1)
ovl/model/account.py (+3/-4)
ovl_all/__openerp__.py (+2/-2)
To merge this branch: bzr merge lp:~vauxoo/openerp-venezuela-localization/7.0-pylint5-dev-sabrina
Reviewer Review Type Date Requested Status
hbto [Vauxoo] http://www.vauxoo.com Approve
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Review via email: mp+237828@code.launchpad.net

Description of the change

Pylint relative import fixed.

To post a comment you must log in.
1045. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint unused import fixed.

1046. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint unused variable fixed.

1047. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint autopep8 fixed.

1048. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint trailing whitespace fixed.

1049. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint W0104 fixed.

1050. By Sabrina Romero - http://www.vauxoo.com

[FIX] Pylint relative import fixed.

Revision history for this message
Sabrina Romero - http://www.vauxoo.com (sabrina) wrote :

Hbto, requiero su "approve" para subir estos cambios!

Revision history for this message
hbto [Vauxoo] http://www.vauxoo.com (humbertoarocha) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'l10n_ve_fiscal_book/__init__.py'
--- l10n_ve_fiscal_book/__init__.py 2013-04-30 18:17:08 +0000
+++ l10n_ve_fiscal_book/__init__.py 2014-10-11 00:06:17 +0000
@@ -4,7 +4,7 @@
4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.
5# Javier Duran <javier@vauxoo.com>5# Javier Duran <javier@vauxoo.com>
6# Nhomar Hernandéz <nhomar@vauxoo.com>6# Nhomar Hernandéz <nhomar@vauxoo.com>
7# 7#
8#8#
9# WARNING: This program as such is intended to be used by professional9# WARNING: This program as such is intended to be used by professional
10# programmers who take the whole responsability of assessing all potential10# programmers who take the whole responsability of assessing all potential
@@ -29,5 +29,5 @@
29#29#
30##############################################################################30##############################################################################
3131
32import model32from . import model
33import wizard33from . import wizard
3434
=== modified file 'l10n_ve_fiscal_book/__openerp__.py'
--- l10n_ve_fiscal_book/__openerp__.py 2014-09-19 15:18:43 +0000
+++ l10n_ve_fiscal_book/__openerp__.py 2014-10-11 00:06:17 +0000
@@ -4,7 +4,7 @@
4# Copyright (c) 2011 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.4# Copyright (c) 2011 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.
5# Luis Escobar <luis@vauxoo.com>5# Luis Escobar <luis@vauxoo.com>
6# Tulio Ruiz <tulio@vauxoo.com>6# Tulio Ruiz <tulio@vauxoo.com>
7# 7#
8#8#
9# WARNING: This program as such is intended to be used by professional9# WARNING: This program as such is intended to be used by professional
10# programmers who take the whole responsability of assessing all potential10# programmers who take the whole responsability of assessing all potential
@@ -40,7 +40,7 @@
40Build all Fiscal Reports for Law in Venezuela.40Build all Fiscal Reports for Law in Venezuela.
41Add 2 new columns because of:41Add 2 new columns because of:
4242
43Según Articulo 77 del Reglamento de la Ley del IVA No.5.363 del 12 de Julio de 1999. 43Según Articulo 77 del Reglamento de la Ley del IVA No.5.363 del 12 de Julio de 1999.
44Parágrafo Segundo: El registro de las operaciones contenidas en el reporte global diario generado por las máquinas fiscales, se reflejarán en el Libro de Ventas del mismo modo que se establece respecto de los comprobantes que se emiten a no contibuyentes, indicando el número de registro de la máquina.44Parágrafo Segundo: El registro de las operaciones contenidas en el reporte global diario generado por las máquinas fiscales, se reflejarán en el Libro de Ventas del mismo modo que se establece respecto de los comprobantes que se emiten a no contibuyentes, indicando el número de registro de la máquina.
4545
46.. note::46.. note::
4747
=== modified file 'l10n_ve_fiscal_book/adjustment_book.py'
--- l10n_ve_fiscal_book/adjustment_book.py 2014-01-08 20:42:28 +0000
+++ l10n_ve_fiscal_book/adjustment_book.py 2014-10-11 00:06:17 +0000
@@ -7,7 +7,7 @@
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# María Gabriela Quilarque <gabrielaquilarque97@gmail.com>9# María Gabriela Quilarque <gabrielaquilarque97@gmail.com>
10# Javier Duran <javier@vauxoo.com> 10# Javier Duran <javier@vauxoo.com>
11# Planified by: Nhomar Hernandez11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve13# Audited by: Humberto Arocha humberto@openerp.com.ve
@@ -25,29 +25,25 @@
25# You should have received a copy of the GNU Affero General Public License25# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields
30from openerp.tools.translate import _
31from openerp.tools import config
32import time
33import datetime
34from openerp.addons import decimal_precision as dp29from openerp.addons import decimal_precision as dp
3530
31
36class adjustment_book(osv.osv):32class adjustment_book(osv.osv):
3733
38 def _get_amount_total(self,cr,uid,ids,name,args,context=None):34 def _get_amount_total(self, cr, uid, ids, name, args, context=None):
39 res = {}35 res = {}
40 for adj in self.browse(cr,uid,ids,context):36 for adj in self.browse(cr, uid, ids, context):
41 res[adj.id] = {37 res[adj.id] = {
42 'amount_total': 0.0,38 'amount_total': 0.0,
43 'amount_untaxed_n_total' : 0.0,39 'amount_untaxed_n_total': 0.0,
44 'amount_with_vat_n_total': 0.0,40 'amount_with_vat_n_total': 0.0,
45 'amount_untaxed_i_total' : 0.0,41 'amount_untaxed_i_total': 0.0,
46 'amount_with_vat_i_total': 0.0,42 'amount_with_vat_i_total': 0.0,
47 'uncredit_fiscal_total' : 0.0,43 'uncredit_fiscal_total': 0.0,
48 'amount_with_vat_total' : 0.0,44 'amount_with_vat_total': 0.0,
49 'amount_base_total' : 0.0,45 'amount_base_total': 0.0,
50 'amount_percent_total' : 0.0,46 'amount_percent_total': 0.0,
51 }47 }
52 for line in adj.adjustment_ids:48 for line in adj.adjustment_ids:
53 res[adj.id]['amount_total'] += line.amount49 res[adj.id]['amount_total'] += line.amount
@@ -57,134 +53,129 @@
57 res[adj.id]['amount_with_vat_i_total'] += line.amount_with_vat_i53 res[adj.id]['amount_with_vat_i_total'] += line.amount_with_vat_i
58 res[adj.id]['uncredit_fiscal_total'] += line.uncredit_fiscal54 res[adj.id]['uncredit_fiscal_total'] += line.uncredit_fiscal
59 res[adj.id]['amount_with_vat_total'] += line.amount_with_vat55 res[adj.id]['amount_with_vat_total'] += line.amount_with_vat
60 res[adj.id]['amount_base_total'] += adj.vat_general_i+adj.vat_general_add_i+adj.vat_reduced_i+adj.vat_general_n+\56 res[adj.id]['amount_base_total'] += adj.vat_general_i + adj.vat_general_add_i + adj.vat_reduced_i + adj.vat_general_n +\
61 adj.vat_general_add_n+adj.vat_reduced_n+adj.adjustment+adj.no_grav+adj.sale_export57 adj.vat_general_add_n + adj.vat_reduced_n + adj.adjustment + adj.no_grav + adj.sale_export
62 res[adj.id]['amount_percent_total'] += adj.vat_general_icf+adj.vat_general_add_icf+adj.vat_reduced_icf+adj.vat_general_ncf+\58 res[adj.id]['amount_percent_total'] += adj.vat_general_icf + adj.vat_general_add_icf + adj.vat_reduced_icf + adj.vat_general_ncf +\
63 adj.vat_general_add_ncf+adj.vat_reduced_ncf+adj.adjustment_cf+adj.sale_export_cf59 adj.vat_general_add_ncf + adj.vat_reduced_ncf + adj.adjustment_cf + adj.sale_export_cf
64 60
65 return res61 return res
6662
67 _name='adjustment.book'63 _name = 'adjustment.book'
68 _columns={64 _columns = {
69 'name':fields.char('Description', size=256,required=True,help="Description of adjustment book"),65 'name': fields.char('Description', size=256, required=True, help="Description of adjustment book"),
70 'period_id':fields.many2one('account.period','Period',required=True,help="Period of adjustment book"),66 'period_id': fields.many2one('account.period', 'Period', required=True, help="Period of adjustment book"),
71 'adjustment_ids': fields.one2many('adjustment.book.line','adjustment_id','Adjustment Book Line'),67 'adjustment_ids': fields.one2many('adjustment.book.line', 'adjustment_id', 'Adjustment Book Line'),
72 'note': fields.text('Note',required=True),68 'note': fields.text('Note', required=True),
73 'type': fields.selection([69 'type': fields.selection([
74 ('sale','Sale'),70 ('sale', 'Sale'),
75 ('purchase', 'Purchase'),71 ('purchase', 'Purchase'),
76 ],'Type', select=True, required=True, help="Type of adjustment book: Sale or Purchase"),72 ], 'Type', select=True, required=True, help="Type of adjustment book: Sale or Purchase"),
77 'amount_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='VAT Withholding Total Amount',readonly=True,help="Total Amount for adjustment book of invoice"),73 'amount_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='VAT Withholding Total Amount', readonly=True, help="Total Amount for adjustment book of invoice"),
78 'amount_untaxed_n_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Amount Untaxed National',readonly=True,help="Amount Total Untaxed for adjustment book of nacional operations"),74 'amount_untaxed_n_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Amount Untaxed National', readonly=True, help="Amount Total Untaxed for adjustment book of nacional operations"),
79 'amount_with_vat_n_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Amount Withheld National',readonly=True,help="Amount Total Withheld for adjustment book of national operations"),75 'amount_with_vat_n_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Amount Withheld National', readonly=True, help="Amount Total Withheld for adjustment book of national operations"),
80 'amount_untaxed_i_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Amount Untaxed International',readonly=True,help="Amount Total Untaxed for adjustment book of internacional operations"),76 'amount_untaxed_i_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Amount Untaxed International', readonly=True, help="Amount Total Untaxed for adjustment book of internacional operations"),
81 'amount_with_vat_i_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Amount Withheld International',readonly=True,help="Amount Total Withheld for adjustment book of international operations"),77 'amount_with_vat_i_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Amount Withheld International', readonly=True, help="Amount Total Withheld for adjustment book of international operations"),
82 'uncredit_fiscal_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Sin derecho a credito fiscal',readonly=True,help="Sin derecho a credito fiscal"),78 'uncredit_fiscal_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Sin derecho a credito fiscal', readonly=True, help="Sin derecho a credito fiscal"),
83 'amount_with_vat_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='VAT Withholding Total Amount',readonly=True,help="VAT Withholding total amount for adjustment book"),79 'amount_with_vat_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='VAT Withholding Total Amount', readonly=True, help="VAT Withholding total amount for adjustment book"),
84 'no_grav': fields.float('Compras/Ventas no Gravadas y/o SDCF', digits_compute=dp.get_precision('Account'),help="Compras/Ventas no gravadas y/o sin derecho a credito fiscal/ Ventas Internas no grabadas"),80 'no_grav': fields.float('Compras/Ventas no Gravadas y/o SDCF', digits_compute=dp.get_precision('Account'), help="Compras/Ventas no gravadas y/o sin derecho a credito fiscal/ Ventas Internas no grabadas"),
85 'vat_general_i': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general"),81 'vat_general_i': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general"),
86 'vat_general_add_i': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'),help="Importaciones gravadas por alicuota general mas alicuota adicional"),82 'vat_general_add_i': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general mas alicuota adicional"),
87 'vat_reduced_i': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'),help="Importaciones gravadas por alicuota reducida"),83 'vat_reduced_i': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota reducida"),
88 'vat_general_n': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'),help="Compras gravadas por alicuota general/Ventas internas gravadas por alicuota general"),84 'vat_general_n': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Compras gravadas por alicuota general/Ventas internas gravadas por alicuota general"),
89 'vat_general_add_n': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'),help="Compras/Ventas internas gravadas por alicuota general mas alicuota adicional"),85 'vat_general_add_n': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'), help="Compras/Ventas internas gravadas por alicuota general mas alicuota adicional"),
90 'vat_reduced_n': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'),help="Compras/Ventas Internas gravadas por alicuota reducida"),86 'vat_reduced_n': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'), help="Compras/Ventas Internas gravadas por alicuota reducida"),
91 'adjustment': fields.float('Ajustes', digits_compute=dp.get_precision('Account'),help="Ajustes a los creditos/debitos fiscales de los periodos anteriores"),87 'adjustment': fields.float('Ajustes', digits_compute=dp.get_precision('Account'), help="Ajustes a los creditos/debitos fiscales de los periodos anteriores"),
92 'vat_general_icf': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general"),88 'vat_general_icf': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general"),
93 'vat_general_add_icf': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'),help="Importaciones gravadas por alicuota general mas alicuota adicional"),89 'vat_general_add_icf': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota general mas alicuota adicional"),
94 'vat_reduced_icf': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'),help="Importaciones gravadas por alicuota reducida"),90 'vat_reduced_icf': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'), help="Importaciones gravadas por alicuota reducida"),
95 'vat_general_ncf': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'),help="Compras gravadas por alicuota general/Ventas internas gravadas por alicuota general"),91 'vat_general_ncf': fields.float('Alicuota general', digits_compute=dp.get_precision('Account'), help="Compras gravadas por alicuota general/Ventas internas gravadas por alicuota general"),
96 'vat_general_add_ncf': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'),help="Compras/Ventas internas gravadas por alicuota general mas alicuota adicional"),92 'vat_general_add_ncf': fields.float('Alicuota general + Alicuota adicional', digits_compute=dp.get_precision('Account'), help="Compras/Ventas internas gravadas por alicuota general mas alicuota adicional"),
97 'vat_reduced_ncf': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'),help="Compras/Ventas Internas gravadas por alicuota reducida"),93 'vat_reduced_ncf': fields.float('Alicuota Reducida', digits_compute=dp.get_precision('Account'), help="Compras/Ventas Internas gravadas por alicuota reducida"),
98 'adjustment_cf': fields.float('Ajustes', digits_compute=dp.get_precision('Account'),help="Ajustes a los creditos/debitos fiscales de los periodos anteriores"),94 'adjustment_cf': fields.float('Ajustes', digits_compute=dp.get_precision('Account'), help="Ajustes a los creditos/debitos fiscales de los periodos anteriores"),
99 'amount_base_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Total Base Imponible',readonly=True,help="TOTAL COMPRAS DEL PERIODO/TOTAL VENTAS PARA EFECTOS DE DETERMINACION"),95 'amount_base_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Total Base Imponible', readonly=True, help="TOTAL COMPRAS DEL PERIODO/TOTAL VENTAS PARA EFECTOS DE DETERMINACION"),
100 'amount_percent_total':fields.function(_get_amount_total,multi='all',method=True, digits_compute=dp.get_precision('Account'),string='Total % Fiscal',readonly=True,help="TOTALCREDITOS FISCALES DEL PERIODO/TOTAL DEBITOS FISCALES PARA EFECTOS DE DETERMINACION"),96 'amount_percent_total': fields.function(_get_amount_total, multi='all', method=True, digits_compute=dp.get_precision('Account'), string='Total % Fiscal', readonly=True, help="TOTALCREDITOS FISCALES DEL PERIODO/TOTAL DEBITOS FISCALES PARA EFECTOS DE DETERMINACION"),
101 'sale_export':fields.float('Ventas de Exportacion', digits_compute=dp.get_precision('Account'),help="Ventas de Exportacion"),97 'sale_export': fields.float('Ventas de Exportacion', digits_compute=dp.get_precision('Account'), help="Ventas de Exportacion"),
102 'sale_export_cf':fields.float('Ventas de Exportacion', digits_compute=dp.get_precision('Account'),help="Ventas de Exportacion"),98 'sale_export_cf': fields.float('Ventas de Exportacion', digits_compute=dp.get_precision('Account'), help="Ventas de Exportacion"),
103 }99 }
104100
105 _sql_constraints = [101 _sql_constraints = [
106 ('period_id_type_uniq', 'unique (period_id,type)', 'The period and type combination must be unique!')102 ('period_id_type_uniq', 'unique (period_id,type)', 'The period and type combination must be unique!')
107 ]103 ]
108 104
109
110 #~ def action_set_totals(self,cr,uid,ids, *args):105 #~ def action_set_totals(self,cr,uid,ids, *args):
111 #~ self.write(cr, uid, ids, {'vat_general_i':0.00,106 #~ self.write(cr, uid, ids, {'vat_general_i':0.00,
112 #~ 'vat_general_add_i':0.00,'vat_reduced_i':0.00,107 #~ 'vat_general_add_i':0.00,'vat_reduced_i':0.00,
113 #~ 'vat_general_n':0.00,'vat_general_add_n':0.00,108 #~ 'vat_general_n':0.00,'vat_general_add_n':0.00,
114 #~ 'vat_reduced_n':0.00,'sale_export':0.00,109 #~ 'vat_reduced_n':0.00,'sale_export':0.00,
115 #~ })110 #~ })
116 #~ total={'amount_untaxed_n':0.0,'amount_untaxed_n_scdf':0.0,111 #~ total={'amount_untaxed_n':0.0,'amount_untaxed_n_scdf':0.0,
117 #~ 'amount_untaxed_i':0.0,'amount_untaxed_i_scdf':0.0,112 #~ 'amount_untaxed_i':0.0,'amount_untaxed_i_scdf':0.0,
118 #~ 'vat_general_ncf':0.0,'vat_general_ncf':0.0,113 #~ 'vat_general_ncf':0.0,'vat_general_ncf':0.0,
119 #~ 'vat_add_ncf':0.0}114 #~ 'vat_add_ncf':0.0}
120#~ 115#~
121 #~ for adj in self.browse(cr, uid, ids):116 #~ for adj in self.browse(cr, uid, ids):
122 #~ if adj.type=='purchase':117 #~ if adj.type=='purchase':
123 #~ self.write(cr, uid, ids, {'vat_general_i':adj.amount_untaxed_i_total,118 #~ self.write(cr, uid, ids, {'vat_general_i':adj.amount_untaxed_i_total,
124 #~ 'vat_general_add_i':adj.amount_untaxed_i_total,119 #~ 'vat_general_add_i':adj.amount_untaxed_i_total,
125 #~ 'vat_reduced_i':adj.amount_untaxed_i_total,})120 #~ 'vat_reduced_i':adj.amount_untaxed_i_total,})
126 #~ else:121 #~ else:
127 #~ self.write(cr, uid, ids, {'sale_export':adj.amount_untaxed_n_total,})122 #~ self.write(cr, uid, ids, {'sale_export':adj.amount_untaxed_n_total,})
128 #~ self.write(cr, uid, ids, {'vat_general_n':adj.amount_untaxed_n_total,123 #~ self.write(cr, uid, ids, {'vat_general_n':adj.amount_untaxed_n_total,
129 #~ 'vat_general_add_n':adj.amount_untaxed_n_total,124 #~ 'vat_general_add_n':adj.amount_untaxed_n_total,
130 #~ 'vat_reduced_n':adj.amount_untaxed_n_total,125 #~ 'vat_reduced_n':adj.amount_untaxed_n_total,
131 #~ })126 #~ })
132 #~ for line in adj.adjustment_ids:127 #~ for line in adj.adjustment_ids:
133 #~ 128 #~
134 #~ if 0==line.percent_with_vat_n:129 #~ if 0==line.percent_with_vat_n:
135 #~ total['amount_untaxed_n_scdf']+=line.amount_untaxed_n130 #~ total['amount_untaxed_n_scdf']+=line.amount_untaxed_n
136 #~ total['amount_untaxed_i_scdf']+=line.amount_untaxed_i131 #~ total['amount_untaxed_i_scdf']+=line.amount_untaxed_i
137 #~ else:132 #~ else:
138 #~ total['amount_untaxed_n']+=line.amount_untaxed_n133 #~ total['amount_untaxed_n']+=line.amount_untaxed_n
139 #~ total['amount_untaxed_i']+=line.amount_untaxed_i134 #~ total['amount_untaxed_i']+=line.amount_untaxed_i
140 #~ if 12 == line.percent_with_vat_n:135 #~ if 12 == line.percent_with_vat_n:
141 #~ total['vat_general_ncf']+=12.0136 #~ total['vat_general_ncf']+=12.0
142 #~ if 8 == line.percent_with_vat_n:137 #~ if 8 == line.percent_with_vat_n:
143 #~ total['vat_reduced_ncf']+=8.0138 #~ total['vat_reduced_ncf']+=8.0
144 #~ if 22 == line.percent_with_vat_n:139 #~ if 22 == line.percent_with_vat_n:
145 #~ total['vat_additional_ncf']+=22.0140 #~ total['vat_additional_ncf']+=22.0
146 #~ self.write(cr, uid, ids, {'vat_general_ncf':total['vat_general_ncf'],141 #~ self.write(cr, uid, ids, {'vat_general_ncf':total['vat_general_ncf'],
147 #~ 'vat_general_add_ncf':total['vat_general_ncf']+total['vat_add_ncf'],142 #~ 'vat_general_add_ncf':total['vat_general_ncf']+total['vat_add_ncf'],
148 #~ 'vat_reduced_n':total['vat_reduced_n'],143 #~ 'vat_reduced_n':total['vat_reduced_n'],
149 #~ })144 #~ })
150 #~ return True145 #~ return True
151 146
152 147
153
154adjustment_book()148adjustment_book()
155149
156150
157class adjustment_book_line(osv.osv):151class adjustment_book_line(osv.osv):
158 152
159 _name='adjustment.book.line'153 _name = 'adjustment.book.line'
160 _columns={154 _columns = {
161 'date_accounting': fields.date('Date Accounting', required=True,help="Date accounting for adjustment book"),155 'date_accounting': fields.date('Date Accounting', required=True, help="Date accounting for adjustment book"),
162 'date_admin': fields.date('Date Administrative',required=True, help="Date administrative for adjustment book"),156 'date_admin': fields.date('Date Administrative', required=True, help="Date administrative for adjustment book"),
163 'vat':fields.char('Vat', size=10,required=True,help="Vat of partner for adjustment book"),157 'vat': fields.char('Vat', size=10, required=True, help="Vat of partner for adjustment book"),
164 'partner':fields.char('Partner', size=256,required=True,help="Partner for adjustment book"),158 'partner': fields.char('Partner', size=256, required=True, help="Partner for adjustment book"),
165 'invoice_number':fields.char('Invoice Number', size=256,required=True,help="Invoice number for adjustment book"),159 'invoice_number': fields.char('Invoice Number', size=256, required=True, help="Invoice number for adjustment book"),
166 'control_number':fields.char('Invoice Control', size=256,required=True,help="Invoice control for adjustment book"), 160 'control_number': fields.char('Invoice Control', size=256, required=True, help="Invoice control for adjustment book"),
167 'amount':fields.float('Amount Document at VAT Withholding', digits_compute=dp.get_precision('Account'),required=True,help="Amount document for adjustment book"),161 'amount': fields.float('Amount Document at VAT Withholding', digits_compute=dp.get_precision('Account'), required=True, help="Amount document for adjustment book"),
168 'type_doc': fields.selection([162 'type_doc': fields.selection([
169 ('F','Invoice'),163 ('F', 'Invoice'),
170 ('ND', 'Debit Note'),164 ('ND', 'Debit Note'),
171 ('NC', 'Credit Note'),165 ('NC', 'Credit Note'),
172 ],'Document Type', select=True, required=True, help="Type of Document for adjustment book: -Invoice(F),-Debit Note(dn),-Credit Note(cn)"),166 ], 'Document Type', select=True, required=True, help="Type of Document for adjustment book: -Invoice(F),-Debit Note(dn),-Credit Note(cn)"),
173 'doc_affected':fields.char('Affected Document', size=256,required=True,help="Affected Document for adjustment book"),167 'doc_affected': fields.char('Affected Document', size=256, required=True, help="Affected Document for adjustment book"),
174 'uncredit_fiscal':fields.float('Sin derecho a Credito Fiscal', digits_compute=dp.get_precision('Account'),required=True,help="Sin derechoa credito fiscal"),168 'uncredit_fiscal': fields.float('Sin derecho a Credito Fiscal', digits_compute=dp.get_precision('Account'), required=True, help="Sin derechoa credito fiscal"),
175 'amount_untaxed_n': fields.float('Amount Untaxed', digits_compute=dp.get_precision('Account'),required=True,help="Amount untaxed for national operations"),169 'amount_untaxed_n': fields.float('Amount Untaxed', digits_compute=dp.get_precision('Account'), required=True, help="Amount untaxed for national operations"),
176 'percent_with_vat_n': fields.float('VAT Withholding (%)', digits_compute=dp.get_precision('Account'),required=True,help="VAT Percent(%) for national operations"),170 'percent_with_vat_n': fields.float('VAT Withholding (%)', digits_compute=dp.get_precision('Account'), required=True, help="VAT Percent(%) for national operations"),
177 'amount_with_vat_n': fields.float('VAT Withholding Amount', digits_compute=dp.get_precision('Account'),required=True,help="VAT Amount for national operations"),171 'amount_with_vat_n': fields.float('VAT Withholding Amount', digits_compute=dp.get_precision('Account'), required=True, help="VAT Amount for national operations"),
178 'amount_untaxed_i': fields.float('Amount Untaxed', digits_compute=dp.get_precision('Account'),required=True,help="Amount untaxed for international operations"),172 'amount_untaxed_i': fields.float('Amount Untaxed', digits_compute=dp.get_precision('Account'), required=True, help="Amount untaxed for international operations"),
179 'percent_with_vat_i': fields.float('VAT Withholding (%)', digits_compute=dp.get_precision('Account'),required=True,help="VAT Percent(%) for international operations"),173 'percent_with_vat_i': fields.float('VAT Withholding (%)', digits_compute=dp.get_precision('Account'), required=True, help="VAT Percent(%) for international operations"),
180 'amount_with_vat_i': fields.float('VAT Withholding Amount', digits_compute=dp.get_precision('Account'),required=True,help="VAT Amount for international operations"),174 'amount_with_vat_i': fields.float('VAT Withholding Amount', digits_compute=dp.get_precision('Account'), required=True, help="VAT Amount for international operations"),
181 'amount_with_vat': fields.float('VAT Withholding Total Amount', digits_compute=dp.get_precision('Account'),required=True,help="VAT withholding total amount"),175 'amount_with_vat': fields.float('VAT Withholding Total Amount', digits_compute=dp.get_precision('Account'), required=True, help="VAT withholding total amount"),
182 'voucher': fields.char('VAT Withholding Voucher', size=256,required=True,help="VAT withholding voucher"),176 'voucher': fields.char('VAT Withholding Voucher', size=256, required=True, help="VAT withholding voucher"),
183 'adjustment_id':fields.many2one('adjustment.book','Adjustment Book')177 'adjustment_id': fields.many2one('adjustment.book', 'Adjustment Book')
184 }178 }
185 _rec_rame = 'partner'179 _rec_rame = 'partner'
186 180
187adjustment_book_line()181adjustment_book_line()
188
189
190
191182
=== modified file 'l10n_ve_fiscal_book/model/__init__.py'
--- l10n_ve_fiscal_book/model/__init__.py 2013-06-10 19:36:18 +0000
+++ l10n_ve_fiscal_book/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -4,7 +4,7 @@
4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.
5# Javier Duran <javier@vauxoo.com>5# Javier Duran <javier@vauxoo.com>
6# Nhomar Hernandéz <nhomar@vauxoo.com>6# Nhomar Hernandéz <nhomar@vauxoo.com>
7# 7#
8#8#
9# WARNING: This program as such is intended to be used by professional9# WARNING: This program as such is intended to be used by professional
10# programmers who take the whole responsability of assessing all potential10# programmers who take the whole responsability of assessing all potential
@@ -29,8 +29,8 @@
29#29#
30##############################################################################30##############################################################################
3131
32import invoice 32from . import invoice
33import fiscal_book33from . import fiscal_book
34import wh_iva34from . import wh_iva
35import customs_form35from . import customs_form
3636
3737
=== modified file 'l10n_ve_fiscal_book/model/customs_form.py'
--- l10n_ve_fiscal_book/model/customs_form.py 2013-06-10 19:36:18 +0000
+++ l10n_ve_fiscal_book/model/customs_form.py 2014-10-11 00:06:17 +0000
@@ -24,14 +24,12 @@
24# along with this program. If not, see <http://www.gnu.org/licenses/>.24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25###############################################################################25###############################################################################
26from openerp.osv import fields, osv26from openerp.osv import fields, osv
27import openerp.pooler
2827
2928
30class customs_form(osv.osv):29class customs_form(osv.osv):
31 _inherit = 'customs.form'30 _inherit = 'customs.form'
32 _columns = {31 _columns = {
33 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',32 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
34 help='Fiscal Book where this customs form' \33 help='Fiscal Book where this customs form'
35 ' is srelated to'),34 ' is srelated to'),
36 }35 }
37
3836
=== modified file 'l10n_ve_fiscal_book/model/fiscal_book.py'
--- l10n_ve_fiscal_book/model/fiscal_book.py 2014-10-07 06:41:36 +0000
+++ l10n_ve_fiscal_book/model/fiscal_book.py 2014-10-11 00:06:17 +0000
@@ -67,7 +67,7 @@
67 #~ TODO: ASK: what company, fisal.book.company_id?67 #~ TODO: ASK: what company, fisal.book.company_id?
68 ru_obj = self.pool.get('res.users')68 ru_obj = self.pool.get('res.users')
69 rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id69 rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id
70 addr = rp_obj._find_accounting_partner(rc_brw.partner_id)70 addr = rp_obj._find_accounting_partner(rc_brw.partner_id)
71 for fb_id in ids:71 for fb_id in ids:
72 if addr:72 if addr:
73 res[fb_id] = (addr.street or '') + \73 res[fb_id] = (addr.street or '') + \
@@ -88,8 +88,8 @@
88 "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]88 "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"]
89 res = {}.fromkeys(ids, '')89 res = {}.fromkeys(ids, '')
90 for fb_brw in self.browse(cr, uid, ids, context=context):90 for fb_brw in self.browse(cr, uid, ids, context=context):
91 month = months[time.strptime(fb_brw.period_id.date_start,"%Y-%m-%d")[1]-1]91 month = months[time.strptime(fb_brw.period_id.date_start, "%Y-%m-%d")[1] - 1]
92 year = time.strptime(fb_brw.period_id.date_start,"%Y-%m-%d")[0]92 year = time.strptime(fb_brw.period_id.date_start, "%Y-%m-%d")[0]
93 res[fb_brw.id] = "Correspodiente al Mes de " + str(month) + " del año " + str(year)93 res[fb_brw.id] = "Correspodiente al Mes de " + str(month) + " del año " + str(year)
94 return res94 return res
9595
@@ -115,8 +115,8 @@
115 fbl_brw.total_with_iva115 fbl_brw.total_with_iva
116116
117 res[fb_brw.id]['get_total_with_iva_sum'] = \117 res[fb_brw.id]['get_total_with_iva_sum'] = \
118 sum( [ res[fb_brw.id]["get_total_with_iva_" + optype + "_sum"]118 sum([res[fb_brw.id]["get_total_with_iva_" + optype + "_sum"]
119 for optype in op_types ] )119 for optype in op_types])
120 return res120 return res
121121
122 def _get_vat_sdcf_sum(self, cr, uid, ids, field_name, arg, context=None):122 def _get_vat_sdcf_sum(self, cr, uid, ids, field_name, arg, context=None):
@@ -147,14 +147,14 @@
147 tax_types = ['reduced', 'general', 'additional']147 tax_types = ['reduced', 'general', 'additional']
148148
149 res[fb_brw.id]['get_total_tax_credit_debit_base_sum'] += \149 res[fb_brw.id]['get_total_tax_credit_debit_base_sum'] += \
150 sum( [ getattr(fb_brw, op + '_' + ttax + '_vat_base_sum')150 sum([getattr(fb_brw, op + '_' + ttax + '_vat_base_sum')
151 for ttax in tax_types151 for ttax in tax_types
152 for op in op_types ] )152 for op in op_types])
153153
154 res[fb_brw.id]['get_total_tax_credit_debit_tax_sum'] += \154 res[fb_brw.id]['get_total_tax_credit_debit_tax_sum'] += \
155 sum( [ getattr(fb_brw, op + '_' + ttax + '_vat_tax_sum')155 sum([getattr(fb_brw, op + '_' + ttax + '_vat_tax_sum')
156 for ttax in tax_types156 for ttax in tax_types
157 for op in op_types ] )157 for op in op_types])
158 return res158 return res
159159
160 def _get_wh(self, cr, uid, ids, field_names, arg, context=None):160 def _get_wh(self, cr, uid, ids, field_names, arg, context=None):
@@ -220,7 +220,7 @@
220 string='Status', required=True, readonly=True),220 string='Status', required=True, readonly=True),
221 'type': fields.selection([('sale', 'Sale Book'),221 'type': fields.selection([('sale', 'Sale Book'),
222 ('purchase', 'Purchase Book')],222 ('purchase', 'Purchase Book')],
223 help="Select Sale for Customers and" \223 help="Select Sale for Customers and"
224 " Purchase for Suppliers",224 " Purchase for Suppliers",
225 string='Book Type', required=True),225 string='Book Type', required=True),
226 'base_amount': fields.float('Taxable Amount',226 'base_amount': fields.float('Taxable Amount',
@@ -234,47 +234,47 @@
234 'fbts_ids': fields.one2many('fiscal.book.taxes.summary', 'fb_id',234 'fbts_ids': fields.one2many('fiscal.book.taxes.summary', 'fb_id',
235 'Tax Summary'),235 'Tax Summary'),
236 'invoice_ids': fields.one2many('account.invoice', 'fb_id', 'Invoices',236 'invoice_ids': fields.one2many('account.invoice', 'fb_id', 'Invoices',
237 help="Invoices being recorded in a" \237 help="Invoices being recorded in a"
238 " Fiscal Book"),238 " Fiscal Book"),
239 'issue_invoice_ids': fields.one2many('account.invoice', 'issue_fb_id',239 'issue_invoice_ids': fields.one2many('account.invoice', 'issue_fb_id',
240 'Issue Invoices',240 'Issue Invoices',
241 help="Invoices that are in" \241 help="Invoices that are in"
242 " pending state cancel or draft"),242 " pending state cancel or draft"),
243 'iwdl_ids': fields.one2many('account.wh.iva.line', 'fb_id',243 'iwdl_ids': fields.one2many('account.wh.iva.line', 'fb_id',
244 'Vat Withholdings',244 'Vat Withholdings',
245 help="Vat Withholdings being recorded" \245 help="Vat Withholdings being recorded"
246 " in a Fiscal Book"),246 " in a Fiscal Book"),
247 'cf_ids': fields.one2many('customs.form', 'fb_id', 'Customs Form',247 'cf_ids': fields.one2many('customs.form', 'fb_id', 'Customs Form',
248 help="Customs Form being recorded in the" \248 help="Customs Form being recorded in the"
249 " Fiscal Book"),249 " Fiscal Book"),
250 'abl_ids': fields.one2many('adjustment.book.line', 'fb_id',250 'abl_ids': fields.one2many('adjustment.book.line', 'fb_id',
251 'Adjustment Lines',251 'Adjustment Lines',
252 help="Adjustment Lines being recorded in " \252 help="Adjustment Lines being recorded in "
253 " a Fiscal Book"),253 " a Fiscal Book"),
254 'note': fields.text('Note'),254 'note': fields.text('Note'),
255 'article_number': fields.selection(255 'article_number': fields.selection(
256 _get_article_number_types,256 _get_article_number_types,
257 string = "Article Number",257 string="Article Number",
258 required=True,258 required=True,
259 help="Article number describing the fiscal book special features" \259 help="Article number describing the fiscal book special features"
260 " according to the Venezuelan RLIVA statement for fiscal" \260 " according to the Venezuelan RLIVA statement for fiscal"
261 " accounting books. Options:" \261 " accounting books. Options:"
262 " - Art. 75: Pruchase Book." \262 " - Art. 75: Pruchase Book."
263 " - Art. 76: Sale Book. Reflects every individual operation detail." \263 " - Art. 76: Sale Book. Reflects every individual operation detail."
264 " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " \264 " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one "
265 " consolidated line. Only fiscal billing." \265 " consolidated line. Only fiscal billing."
266 " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" \266 " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show"
267 " automatic and mechanized operations in individual way, and " \267 " automatic and mechanized operations in individual way, and "
268 " groups fiscal billing operationss in one consolidated line." ),268 " groups fiscal billing operationss in one consolidated line."),
269269
270 #~ Withholding fields270 #~ Withholding fields
271 'get_wh_sum': fields.function(271 'get_wh_sum': fields.function(
272 _get_wh,272 _get_wh,
273 type="float", method=True, store=True, multi="get_wh",273 type="float", method=True, store=True, multi="get_wh",
274 string="Current Period Withholding",274 string="Current Period Withholding",
275 help="Used at" \275 help="Used at"
276 " 1. Totalization row in Fiscal Book Line block at Withholding" \276 " 1. Totalization row in Fiscal Book Line block at Withholding"
277 " VAT Column" \277 " VAT Column"
278 " 2. Second row at the Withholding Summary block"),278 " 2. Second row at the Withholding Summary block"),
279 'get_previous_wh_sum': fields.function(279 'get_previous_wh_sum': fields.function(
280 _get_wh,280 _get_wh,
@@ -290,7 +290,7 @@
290 _get_wh,290 _get_wh,
291 type="float", method=True, store=True, multi="get_wh",291 type="float", method=True, store=True, multi="get_wh",
292 string="Based Tax Debit Sum",292 string="Based Tax Debit Sum",
293 help="Totalization row in Fiscal Book Line block at" \293 help="Totalization row in Fiscal Book Line block at"
294 " Based Tax Debit Column"),294 " Based Tax Debit Column"),
295295
296 #~ Printable report data296 #~ Printable report data
@@ -309,21 +309,21 @@
309 type="float", method=True, store=True,309 type="float", method=True, store=True,
310 multi="get_total_with_iva",310 multi="get_total_with_iva",
311 string='Total amount with VAT',311 string='Total amount with VAT',
312 help="Total with VAT Sum (Import/Export, Domestic, Tax Payer and" \312 help="Total with VAT Sum (Import/Export, Domestic, Tax Payer and"
313 " Non-Tax Payer"),313 " Non-Tax Payer"),
314 'get_vat_sdcf_sum': fields.function(314 'get_vat_sdcf_sum': fields.function(
315 _get_vat_sdcf_sum,315 _get_vat_sdcf_sum,
316 type="float", method=True, store=True,316 type="float", method=True, store=True,
317 string="Exempt and SDCF Tax Sum",317 string="Exempt and SDCF Tax Sum",
318 help="Exempt and Non entitled to tax credit totalization. Sum of" \318 help="Exempt and Non entitled to tax credit totalization. Sum of"
319 " SDCF and Exempt Tax Totalization columns for all transaction" \319 " SDCF and Exempt Tax Totalization columns for all transaction"
320 " types"),320 " types"),
321 'get_total_tax_credit_debit_base_sum': fields.function(321 'get_total_tax_credit_debit_base_sum': fields.function(
322 _get_total_tax_credit_debit,322 _get_total_tax_credit_debit,
323 type="float", method=True, store=True,323 type="float", method=True, store=True,
324 multi="get_total_tax_credit_debit",324 multi="get_total_tax_credit_debit",
325 string="Tax Credit Total Base Amount",325 string="Tax Credit Total Base Amount",
326 help="Uses at 1. purchase: total row at summary taxes." \326 help="Uses at 1. purchase: total row at summary taxes."
327 " 2. sales: row at summary taxes."),327 " 2. sales: row at summary taxes."),
328 'get_total_tax_credit_debit_tax_sum': fields.function(328 'get_total_tax_credit_debit_tax_sum': fields.function(
329 _get_total_tax_credit_debit,329 _get_total_tax_credit_debit,
@@ -333,8 +333,8 @@
333 'do_sdcf_and_exempt_sum': fields.float(333 'do_sdcf_and_exempt_sum': fields.float(
334 digits_compute=dp.get_precision('Account'),334 digits_compute=dp.get_precision('Account'),
335 string="Domestic Untaxed VAT Sum",335 string="Domestic Untaxed VAT Sum",
336 help="SDCF and Exempt sum for domestict transanctions." \336 help="SDCF and Exempt sum for domestict transanctions."
337 " At Sale book represent the sum of Tax Payer and Non-Tax Payer" \337 " At Sale book represent the sum of Tax Payer and Non-Tax Payer"
338 " transactions."),338 " transactions."),
339339
340 #~ Totalization fields for international transactions340 #~ Totalization fields for international transactions
@@ -347,48 +347,48 @@
347 'imex_vat_base_sum': fields.float(347 'imex_vat_base_sum': fields.float(
348 digits_compute=dp.get_precision('Account'),348 digits_compute=dp.get_precision('Account'),
349 string="International Taxable Amount",349 string="International Taxable Amount",
350 help="Sum of International Tax Base Amounts (reduced, general" \350 help="Sum of International Tax Base Amounts (reduced, general"
351 " and additional). Used at 2nd row in thw Sale book's summary" \351 " and additional). Used at 2nd row in thw Sale book's summary"
352 " with Exports Sales title"),352 " with Exports Sales title"),
353 'imex_exempt_vat_sum': fields.float(353 'imex_exempt_vat_sum': fields.float(
354 digits_compute=dp.get_precision('Account'),354 digits_compute=dp.get_precision('Account'),
355 string="Exempt Tax",355 string="Exempt Tax",
356 help="Import/Export Exempt Tax Totalization: Sum of Exempt" \356 help="Import/Export Exempt Tax Totalization: Sum of Exempt"
357 " column for international transactions"),357 " column for international transactions"),
358 'imex_sdcf_vat_sum': fields.float(358 'imex_sdcf_vat_sum': fields.float(
359 digits_compute=dp.get_precision('Account'),359 digits_compute=dp.get_precision('Account'),
360 string="SDCF Tax",360 string="SDCF Tax",
361 help="Import/Export SDCF Tax Totalization: Sum of SDCF column" \361 help="Import/Export SDCF Tax Totalization: Sum of SDCF column"
362 " for international transactions"),362 " for international transactions"),
363 'imex_general_vat_base_sum': fields.float(363 'imex_general_vat_base_sum': fields.float(
364 digits_compute=dp.get_precision('Account'),364 digits_compute=dp.get_precision('Account'),
365 string="General VAT Taxable Amount",365 string="General VAT Taxable Amount",
366 help="General VAT Taxed Imports/Exports Base Amount. Sum of" \366 help="General VAT Taxed Imports/Exports Base Amount. Sum of"
367 " General VAT Base column for international transactions"),367 " General VAT Base column for international transactions"),
368 'imex_general_vat_tax_sum': fields.float(368 'imex_general_vat_tax_sum': fields.float(
369 digits_compute=dp.get_precision('Account'),369 digits_compute=dp.get_precision('Account'),
370 string="General VAT Taxed Amount",370 string="General VAT Taxed Amount",
371 help="General VAT Taxed Imports/Exports Tax Amount. Sum of" \371 help="General VAT Taxed Imports/Exports Tax Amount. Sum of"
372 " General VAT Tax column for international transactions"),372 " General VAT Tax column for international transactions"),
373 'imex_additional_vat_base_sum': fields.float(373 'imex_additional_vat_base_sum': fields.float(
374 digits_compute=dp.get_precision('Account'),374 digits_compute=dp.get_precision('Account'),
375 string="Additional VAT Taxable Amount",375 string="Additional VAT Taxable Amount",
376 help="Additional VAT Taxed Imports/Exports Base Amount. Sum of" \376 help="Additional VAT Taxed Imports/Exports Base Amount. Sum of"
377 " Additional VAT Base column for international transactions"),377 " Additional VAT Base column for international transactions"),
378 'imex_additional_vat_tax_sum': fields.float(378 'imex_additional_vat_tax_sum': fields.float(
379 digits_compute=dp.get_precision('Account'),379 digits_compute=dp.get_precision('Account'),
380 string="Additional VAT Taxed Amount",380 string="Additional VAT Taxed Amount",
381 help="Additional VAT Taxed Imports/Exports Tax Amount. Sum of " \381 help="Additional VAT Taxed Imports/Exports Tax Amount. Sum of "
382 " Additional VAT Tax column for international transactions"),382 " Additional VAT Tax column for international transactions"),
383 'imex_reduced_vat_base_sum': fields.float(383 'imex_reduced_vat_base_sum': fields.float(
384 digits_compute=dp.get_precision('Account'),384 digits_compute=dp.get_precision('Account'),
385 string="Reduced VAT Taxable Amount",385 string="Reduced VAT Taxable Amount",
386 help="Reduced VAT Taxed Imports/Exports Base Amount. Sum of " \386 help="Reduced VAT Taxed Imports/Exports Base Amount. Sum of "
387 " Reduced VAT Base column for international transactions"),387 " Reduced VAT Base column for international transactions"),
388 'imex_reduced_vat_tax_sum': fields.float(388 'imex_reduced_vat_tax_sum': fields.float(
389 digits_compute=dp.get_precision('Account'),389 digits_compute=dp.get_precision('Account'),
390 string="Reduced VAT Taxed Amount",390 string="Reduced VAT Taxed Amount",
391 help="Reduced VAT Taxed Imports/Exports Tax Amount. Sum of " \391 help="Reduced VAT Taxed Imports/Exports Tax Amount. Sum of "
392 " Reduced VAT Tax column for international transactions"),392 " Reduced VAT Tax column for international transactions"),
393393
394 #~ Totalization fields for domestic transactions394 #~ Totalization fields for domestic transactions
@@ -401,61 +401,61 @@
401 'do_vat_base_sum': fields.float(401 'do_vat_base_sum': fields.float(
402 digits_compute=dp.get_precision('Account'),402 digits_compute=dp.get_precision('Account'),
403 string="Domestic Taxable Amount",403 string="Domestic Taxable Amount",
404 help="Sum of all domestic transaction base amounts (reduced," \404 help="Sum of all domestic transaction base amounts (reduced,"
405 " general and additional)"),405 " general and additional)"),
406 'do_exempt_vat_sum': fields.float(406 'do_exempt_vat_sum': fields.float(
407 digits_compute=dp.get_precision('Account'),407 digits_compute=dp.get_precision('Account'),
408 string="Exempt Tax",408 string="Exempt Tax",
409 help="Domestic Exempt Tax Totalization. For Purchase Book it" \409 help="Domestic Exempt Tax Totalization. For Purchase Book it"
410 " sums Exempt column for domestic transactions. For Sale Book it" \410 " sums Exempt column for domestic transactions. For Sale Book it"
411 " sums Tax Payer and Non-Tax Payer Exempt columns"),411 " sums Tax Payer and Non-Tax Payer Exempt columns"),
412 'do_sdcf_vat_sum': fields.float(412 'do_sdcf_vat_sum': fields.float(
413 digits_compute=dp.get_precision('Account'),413 digits_compute=dp.get_precision('Account'),
414 string="SDCF Tax",414 string="SDCF Tax",
415 help="Domestic SDCF Tax Totalization. For Purchase Book it sums" \415 help="Domestic SDCF Tax Totalization. For Purchase Book it sums"
416 " SDCF column for domestic transactions. For Sale Book it sums" \416 " SDCF column for domestic transactions. For Sale Book it sums"
417 " Tax Payer and Non-Tax Payer SDCF columns"),417 " Tax Payer and Non-Tax Payer SDCF columns"),
418 'do_general_vat_base_sum': fields.float(418 'do_general_vat_base_sum': fields.float(
419 digits_compute=dp.get_precision('Account'),419 digits_compute=dp.get_precision('Account'),
420 string="General VAT Taxable Amount",420 string="General VAT Taxable Amount",
421 help="General VAT Taxed Domestic Base Amount Totalization." \421 help="General VAT Taxed Domestic Base Amount Totalization."
422 " For Purchase Book it sums General VAT Base column for domestic" \422 " For Purchase Book it sums General VAT Base column for domestic"
423 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer" \423 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer"
424 " General VAT Base columns"),424 " General VAT Base columns"),
425 'do_general_vat_tax_sum': fields.float(425 'do_general_vat_tax_sum': fields.float(
426 digits_compute=dp.get_precision('Account'),426 digits_compute=dp.get_precision('Account'),
427 string="General VAT Taxed Amount",427 string="General VAT Taxed Amount",
428 help="General VAT Taxed Domestic Tax Amount Totalization." \428 help="General VAT Taxed Domestic Tax Amount Totalization."
429 " For Purchase Book it sums General VAT Tax column for domestic" \429 " For Purchase Book it sums General VAT Tax column for domestic"
430 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer" \430 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer"
431 " General VAT Tax columns"),431 " General VAT Tax columns"),
432 'do_additional_vat_base_sum': fields.float(432 'do_additional_vat_base_sum': fields.float(
433 digits_compute=dp.get_precision('Account'),433 digits_compute=dp.get_precision('Account'),
434 string="Additional VAT Taxable Amount",434 string="Additional VAT Taxable Amount",
435 help="Additional VAT Taxed Domestic Base Amount Totalization." \435 help="Additional VAT Taxed Domestic Base Amount Totalization."
436 " For Purchase Book it sums Additional VAT Base column for" \436 " For Purchase Book it sums Additional VAT Base column for"
437 " domestic transactions. For Sale Book it sums Tax Payer and No" \437 " domestic transactions. For Sale Book it sums Tax Payer and No"
438 " Tax Payer Additional VAT Base columns"),438 " Tax Payer Additional VAT Base columns"),
439 'do_additional_vat_tax_sum': fields.float(439 'do_additional_vat_tax_sum': fields.float(
440 digits_compute=dp.get_precision('Account'),440 digits_compute=dp.get_precision('Account'),
441 string="Additional VAT Taxed Amount",441 string="Additional VAT Taxed Amount",
442 help="Additional VAT Taxed Domestic Tax Amount Totalization." \442 help="Additional VAT Taxed Domestic Tax Amount Totalization."
443 " For Purchase Book it sums Additional VAT Tax column for" \443 " For Purchase Book it sums Additional VAT Tax column for"
444 " domestic transactions. For Sale Book it sums Tax Payer and No" \444 " domestic transactions. For Sale Book it sums Tax Payer and No"
445 " Tax Payer Additional VAT Tax columns"),445 " Tax Payer Additional VAT Tax columns"),
446 'do_reduced_vat_base_sum': fields.float(446 'do_reduced_vat_base_sum': fields.float(
447 digits_compute=dp.get_precision('Account'),447 digits_compute=dp.get_precision('Account'),
448 string="Reduced VAT Taxable Amount",448 string="Reduced VAT Taxable Amount",
449 help="Reduced VAT Taxed Domestic Base Amount Totalization." \449 help="Reduced VAT Taxed Domestic Base Amount Totalization."
450 " For Purchase Book it sums Reduced VAT Base column for domestic" \450 " For Purchase Book it sums Reduced VAT Base column for domestic"
451 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer" \451 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer"
452 " Reduced VAT Base columns"),452 " Reduced VAT Base columns"),
453 'do_reduced_vat_tax_sum': fields.float(453 'do_reduced_vat_tax_sum': fields.float(
454 digits_compute=dp.get_precision('Account'),454 digits_compute=dp.get_precision('Account'),
455 string="Reduced VAT Taxed Amount",455 string="Reduced VAT Taxed Amount",
456 help="Reduced VAT Taxed Domestic Tax Amount Totalization." \456 help="Reduced VAT Taxed Domestic Tax Amount Totalization."
457 " For Purchase Book it sums Reduced VAT Tax column for domestic" \457 " For Purchase Book it sums Reduced VAT Tax column for domestic"
458 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer" \458 " transactions. For Sale Book it sums Tax Payer and Non-Tax Payer"
459 " Reduced VAT Tax columns"),459 " Reduced VAT Tax columns"),
460 'do_adjustment_vat_tax_sum': fields.function(460 'do_adjustment_vat_tax_sum': fields.function(
461 _get_do_adjustment_vat_tax_sum, method=True, type='float',461 _get_do_adjustment_vat_tax_sum, method=True, type='float',
@@ -464,10 +464,10 @@
464 #~ Apply only for sale book464 #~ Apply only for sale book
465 #~ Totalization fields for tax payer and Non-Tax Payer transactions465 #~ Totalization fields for tax payer and Non-Tax Payer transactions
466 'ntp_fbl_ids': fields.one2many("fiscal.book.line", "ntp_fb_id",466 'ntp_fbl_ids': fields.one2many("fiscal.book.line", "ntp_fb_id",
467 string = "Non-Tax Payer Detail Lines",467 string="Non-Tax Payer Detail Lines",
468 help="Non-Tax Payer Lines that are" \468 help="Non-Tax Payer Lines that are"
469 " grouped by the statement law that" \469 " grouped by the statement law that"
470 " represent the data of are" \470 " represent the data of are"
471 " consolidate book lines"),471 " consolidate book lines"),
472 'get_total_with_iva_tp_sum': fields.function(472 'get_total_with_iva_tp_sum': fields.function(
473 _get_total_with_iva_sum,473 _get_total_with_iva_sum,
@@ -478,47 +478,47 @@
478 'tp_vat_base_sum': fields.float(478 'tp_vat_base_sum': fields.float(
479 digits_compute=dp.get_precision('Account'),479 digits_compute=dp.get_precision('Account'),
480 string="Tax Payer Taxable Amount",480 string="Tax Payer Taxable Amount",
481 help="Sum of all Tax Payer Grand Base Sum (reduced, general and" \481 help="Sum of all Tax Payer Grand Base Sum (reduced, general and"
482 " additional taxes)"),482 " additional taxes)"),
483 'tp_exempt_vat_sum': fields.float(483 'tp_exempt_vat_sum': fields.float(
484 digits_compute=dp.get_precision('Account'),484 digits_compute=dp.get_precision('Account'),
485 string="Exempt Tax",485 string="Exempt Tax",
486 help="Tax Payer Exempt Tax Totalization. Sum of Exempt column" \486 help="Tax Payer Exempt Tax Totalization. Sum of Exempt column"
487 " for tax payer transactions"),487 " for tax payer transactions"),
488 'tp_sdcf_vat_sum': fields.float(488 'tp_sdcf_vat_sum': fields.float(
489 digits_compute=dp.get_precision('Account'),489 digits_compute=dp.get_precision('Account'),
490 string="SDCF Tax",490 string="SDCF Tax",
491 help="Tax Payer SDCF Tax Totalization. Sum of SDCF column for" \491 help="Tax Payer SDCF Tax Totalization. Sum of SDCF column for"
492 " tax payer transactions"),492 " tax payer transactions"),
493 'tp_general_vat_base_sum': fields.float(493 'tp_general_vat_base_sum': fields.float(
494 digits_compute=dp.get_precision('Account'),494 digits_compute=dp.get_precision('Account'),
495 string="General VAT Taxable Amount",495 string="General VAT Taxable Amount",
496 help="General VAT Taxed Tax Payer Base Amount Totalization." \496 help="General VAT Taxed Tax Payer Base Amount Totalization."
497 " Sum of General VAT Base column for taxy payer transactions"),497 " Sum of General VAT Base column for taxy payer transactions"),
498 'tp_general_vat_tax_sum': fields.float(498 'tp_general_vat_tax_sum': fields.float(
499 digits_compute=dp.get_precision('Account'),499 digits_compute=dp.get_precision('Account'),
500 string="General VAT Taxed Amount",500 string="General VAT Taxed Amount",
501 help="General VAT Taxed Tax Payer Tax Amount Totalization." \501 help="General VAT Taxed Tax Payer Tax Amount Totalization."
502 " Sum of General VAT Tax column for tax payer transactions"),502 " Sum of General VAT Tax column for tax payer transactions"),
503 'tp_additional_vat_base_sum': fields.float(503 'tp_additional_vat_base_sum': fields.float(
504 digits_compute=dp.get_precision('Account'),504 digits_compute=dp.get_precision('Account'),
505 string="Additional VAT Taxable Amount",505 string="Additional VAT Taxable Amount",
506 help="Additional VAT Taxed Tax Payer Base Amount Totalization." \506 help="Additional VAT Taxed Tax Payer Base Amount Totalization."
507 " Sum of Additional VAT Base column for tax payer transactions"),507 " Sum of Additional VAT Base column for tax payer transactions"),
508 'tp_additional_vat_tax_sum': fields.float(508 'tp_additional_vat_tax_sum': fields.float(
509 digits_compute=dp.get_precision('Account'),509 digits_compute=dp.get_precision('Account'),
510 string="Additional VAT Taxed Amount",510 string="Additional VAT Taxed Amount",
511 help="Additional VAT Taxed Tax Payer Tax Amount Totalization." \511 help="Additional VAT Taxed Tax Payer Tax Amount Totalization."
512 " Sum of Additional VAT Tax column for tax payer transactions"),512 " Sum of Additional VAT Tax column for tax payer transactions"),
513 'tp_reduced_vat_base_sum': fields.float(513 'tp_reduced_vat_base_sum': fields.float(
514 digits_compute=dp.get_precision('Account'),514 digits_compute=dp.get_precision('Account'),
515 string="Reduced VAT Taxable Amount",515 string="Reduced VAT Taxable Amount",
516 help="Reduced VAT Taxed Tax Payer Base Amount Totalization." \516 help="Reduced VAT Taxed Tax Payer Base Amount Totalization."
517 " Sum of Reduced VAT Base column for tax payer transactions"),517 " Sum of Reduced VAT Base column for tax payer transactions"),
518 'tp_reduced_vat_tax_sum': fields.float(518 'tp_reduced_vat_tax_sum': fields.float(
519 digits_compute=dp.get_precision('Account'),519 digits_compute=dp.get_precision('Account'),
520 string="Reduced VAT Taxed Amount",520 string="Reduced VAT Taxed Amount",
521 help="Reduced VAT Taxed Tax Payer Tax Amount Totalization." \521 help="Reduced VAT Taxed Tax Payer Tax Amount Totalization."
522 " Sum of Reduced VAT Tax column for tax payer transactions"),522 " Sum of Reduced VAT Tax column for tax payer transactions"),
523523
524 'get_total_with_iva_ntp_sum': fields.function(524 'get_total_with_iva_ntp_sum': fields.function(
@@ -530,55 +530,55 @@
530 'ntp_vat_base_sum': fields.float(530 'ntp_vat_base_sum': fields.float(
531 digits_compute=dp.get_precision('Account'),531 digits_compute=dp.get_precision('Account'),
532 string="Non-Tax Payer Taxable Amount",532 string="Non-Tax Payer Taxable Amount",
533 help="Non-Tax Payer Grand Base Totalization. Sum of all no tax" \533 help="Non-Tax Payer Grand Base Totalization. Sum of all no tax"
534 " payer tax bases (reduced, general and additional)"),534 " payer tax bases (reduced, general and additional)"),
535 'ntp_exempt_vat_sum': fields.float(535 'ntp_exempt_vat_sum': fields.float(
536 digits_compute=dp.get_precision('Account'),536 digits_compute=dp.get_precision('Account'),
537 string="Exempt Tax",537 string="Exempt Tax",
538 help="Non-Tax Payer Exempt Tax Totalization. Sum of Exempt" \538 help="Non-Tax Payer Exempt Tax Totalization. Sum of Exempt"
539 " column for Non-Tax Payer transactions"),539 " column for Non-Tax Payer transactions"),
540 'ntp_sdcf_vat_sum': fields.float(540 'ntp_sdcf_vat_sum': fields.float(
541 digits_compute=dp.get_precision('Account'),541 digits_compute=dp.get_precision('Account'),
542 string="SDCF Tax",542 string="SDCF Tax",
543 help="Non-Tax Payer SDCF Tax Totalization. Sum of SDCF column" \543 help="Non-Tax Payer SDCF Tax Totalization. Sum of SDCF column"
544 " for Non-Tax Payer transactions"),544 " for Non-Tax Payer transactions"),
545 'ntp_general_vat_base_sum': fields.float(545 'ntp_general_vat_base_sum': fields.float(
546 digits_compute=dp.get_precision('Account'),546 digits_compute=dp.get_precision('Account'),
547 string="General VAT Taxable Amount",547 string="General VAT Taxable Amount",
548 help="General VAT Taxed Non-Tax Payer Base Amount Totalization." \548 help="General VAT Taxed Non-Tax Payer Base Amount Totalization."
549 " Sum of General VAT Base column for taxy payer transactions"),549 " Sum of General VAT Base column for taxy payer transactions"),
550 'ntp_general_vat_tax_sum': fields.float(550 'ntp_general_vat_tax_sum': fields.float(
551 digits_compute=dp.get_precision('Account'),551 digits_compute=dp.get_precision('Account'),
552 string="General VAT Taxed Amount",552 string="General VAT Taxed Amount",
553 help="General VAT Taxed Non-Tax Payer Tax Amount Totalization." \553 help="General VAT Taxed Non-Tax Payer Tax Amount Totalization."
554 " Sum of General VAT Tax column for Non-Tax Payer transactions"),554 " Sum of General VAT Tax column for Non-Tax Payer transactions"),
555 'ntp_additional_vat_base_sum': fields.float(555 'ntp_additional_vat_base_sum': fields.float(
556 digits_compute=dp.get_precision('Account'),556 digits_compute=dp.get_precision('Account'),
557 string="Additional VAT Taxable Amount",557 string="Additional VAT Taxable Amount",
558 help="Additional VAT Taxed Non-Tax Payer Base Amount Totalization." \558 help="Additional VAT Taxed Non-Tax Payer Base Amount Totalization."
559 " Sum of Additional VAT Base column for Non-Tax Payer transactions"),559 " Sum of Additional VAT Base column for Non-Tax Payer transactions"),
560 'ntp_additional_vat_tax_sum': fields.float(560 'ntp_additional_vat_tax_sum': fields.float(
561 digits_compute=dp.get_precision('Account'),561 digits_compute=dp.get_precision('Account'),
562 string="Additional VAT Taxed Amount",562 string="Additional VAT Taxed Amount",
563 help="Additional VAT Taxed Non-Tax Payer Tax Amount Totalization." \563 help="Additional VAT Taxed Non-Tax Payer Tax Amount Totalization."
564 " Sum of Additional VAT Tax column for Non-Tax Payer transactions"),564 " Sum of Additional VAT Tax column for Non-Tax Payer transactions"),
565 'ntp_reduced_vat_base_sum': fields.float(565 'ntp_reduced_vat_base_sum': fields.float(
566 digits_compute=dp.get_precision('Account'),566 digits_compute=dp.get_precision('Account'),
567 string="Reduced VAT Taxable Amount",567 string="Reduced VAT Taxable Amount",
568 help="Reduced VAT Taxed Non-Tax Payer Base Amount Totalization." \568 help="Reduced VAT Taxed Non-Tax Payer Base Amount Totalization."
569 " Sum of Reduced VAT Base column for Non-Tax Payer transactions"),569 " Sum of Reduced VAT Base column for Non-Tax Payer transactions"),
570 'ntp_reduced_vat_tax_sum': fields.float(570 'ntp_reduced_vat_tax_sum': fields.float(
571 digits_compute=dp.get_precision('Account'),571 digits_compute=dp.get_precision('Account'),
572 string="Reduced VAT Taxed Amount",572 string="Reduced VAT Taxed Amount",
573 help="Reduced VAT Taxed Non-Tax Payer Tax Amount Totalization." \573 help="Reduced VAT Taxed Non-Tax Payer Tax Amount Totalization."
574 " Sum of Reduced VAT Tax column for Non-Tax Payer transactions"),574 " Sum of Reduced VAT Tax column for Non-Tax Payer transactions"),
575 }575 }
576576
577 _defaults = {577 _defaults = {
578 'state': 'draft',578 'state': 'draft',
579 'type': _get_type,579 'type': _get_type,
580 'company_id': lambda s, c, u, ctx: \580 'company_id': lambda s, c, u, ctx:
581 s.pool.get('res.users').browse(c, u, u, context=ctx).company_id.id,581 s.pool.get('res.users').browse(c, u, u, context=ctx).company_id.id,
582 'article_number': _get_article_number,582 'article_number': _get_article_number,
583 'fortnight': None,583 'fortnight': None,
584 }584 }
@@ -595,7 +595,7 @@
595 """ It make clear all stuff of book. """595 """ It make clear all stuff of book. """
596 context = context or {}596 context = context or {}
597 self.clear_book(cr, uid, ids, context=context)597 self.clear_book(cr, uid, ids, context=context)
598 return {'value':{}}598 return {'value': {}}
599599
600 #~ update book methods600 #~ update book methods
601601
@@ -717,7 +717,7 @@
717 ['|',717 ['|',
718 '&', ('fb_id', '=', fb_brw.id), ('period_id', '!=', fb_brw.period_id.id),718 '&', ('fb_id', '=', fb_brw.id), ('period_id', '!=', fb_brw.period_id.id),
719 '&', '&', ('period_id', '=', fb_brw.period_id.id), ('type', 'in', inv_type),719 '&', '&', ('period_id', '=', fb_brw.period_id.id), ('type', 'in', inv_type),
720 ('state', 'not in', inv_state)],720 ('state', 'not in', inv_state)],
721 order='date_invoice asc', context=context)721 order='date_invoice asc', context=context)
722 if fb_brw.fortnight:722 if fb_brw.fortnight:
723 issue_inv_ids = self.get_invoices_from_fortnight(723 issue_inv_ids = self.get_invoices_from_fortnight(
@@ -752,8 +752,8 @@
752 awil_obj = self.pool.get('account.wh.iva.line')752 awil_obj = self.pool.get('account.wh.iva.line')
753 fb_brw = self.browse(cr, uid, fb_id, context=context)753 fb_brw = self.browse(cr, uid, fb_id, context=context)
754 awil_type = fb_brw.type == 'sale' \754 awil_type = fb_brw.type == 'sale' \
755 and ['out_invoice', 'out_refund'] \755 and ['out_invoice', 'out_refund'] \
756 or ['in_invoice', 'in_refund']756 or ['in_invoice', 'in_refund']
757 #~ pull wh iva line data757 #~ pull wh iva line data
758 awil_ids = []758 awil_ids = []
759 awi_ids = awi_obj.search(cr, uid,759 awi_ids = awi_obj.search(cr, uid,
@@ -763,7 +763,7 @@
763 context=context)763 context=context)
764 if fb_brw.fortnight:764 if fb_brw.fortnight:
765 awi_ids = self.get_awi_from_fortnight(765 awi_ids = self.get_awi_from_fortnight(
766 cr, uid, fb_id, awi_ids, context=context)766 cr, uid, fb_id, awi_ids, context=context)
767767
768 for awi_id in awi_ids:768 for awi_id in awi_ids:
769 list_ids = awil_obj.search(cr, uid,769 list_ids = awil_obj.search(cr, uid,
@@ -868,7 +868,6 @@
868 and 'accounting_date asc, invoice_number asc' \868 and 'accounting_date asc, invoice_number asc' \
869 or 'emission_date asc, invoice_number asc'869 or 'emission_date asc, invoice_number asc'
870870
871
872 def order_book_lines(self, cr, uid, fb_id, context=None):871 def order_book_lines(self, cr, uid, fb_id, context=None):
873 """ It orders book lines by a set of criteria:872 """ It orders book lines by a set of criteria:
874 - chronologically ascendant date (For purchase book by873 - chronologically ascendant date (For purchase book by
@@ -885,16 +884,15 @@
885884
886 ajst_order_criteria = self.get_order_criteria_adjustment(cr, uid, fb_brw.type, context=context)885 ajst_order_criteria = self.get_order_criteria_adjustment(cr, uid, fb_brw.type, context=context)
887 ajst_ordered_fbl_ids = \886 ajst_ordered_fbl_ids = \
888 fbl_obj.search(cr, uid, [('id', 'in', fbl_ids),('doc_type', '=', 'AJST')],887 fbl_obj.search(cr, uid, [('id', 'in', fbl_ids), ('doc_type', '=', 'AJST')],
889 order=ajst_order_criteria, context=context)888 order=ajst_order_criteria, context=context)
890889
891 for rank, fbl_id in enumerate(ajst_ordered_fbl_ids, 1):890 for rank, fbl_id in enumerate(ajst_ordered_fbl_ids, 1):
892 fbl_obj.write(cr, uid, fbl_id, {'rank': rank}, context=context)891 fbl_obj.write(cr, uid, fbl_id, {'rank': rank}, context=context)
893892
894
895 order_criteria = self.get_order_criteria(cr, uid, fb_brw.type, context=context)893 order_criteria = self.get_order_criteria(cr, uid, fb_brw.type, context=context)
896 ordered_fbl_ids = \894 ordered_fbl_ids = \
897 fbl_obj.search(cr, uid, [('id', 'in', fbl_ids),('doc_type', '!=', 'AJST')],895 fbl_obj.search(cr, uid, [('id', 'in', fbl_ids), ('doc_type', '!=', 'AJST')],
898 order=order_criteria, context=context)896 order=order_criteria, context=context)
899897
900 for rank, fbl_id in enumerate(ordered_fbl_ids, len(ajst_ordered_fbl_ids) + 1):898 for rank, fbl_id in enumerate(ordered_fbl_ids, len(ajst_ordered_fbl_ids) + 1):
@@ -917,7 +915,7 @@
917 context=context)915 context=context)
918 if iwdl_id:916 if iwdl_id:
919 if inv_brw.date_invoice != \917 if inv_brw.date_invoice != \
920 iwdl_obj.browse(cr, uid, iwdl_id, context=context).date_ret:918 iwdl_obj.browse(cr, uid, iwdl_id, context=context).date_ret:
921 res.append(iwdl_id)919 res.append(iwdl_id)
922 return res920 return res
923921
@@ -927,7 +925,6 @@
927 """925 """
928 # TODO: make this method aware of fortnight.926 # TODO: make this method aware of fortnight.
929 context = context or {}927 context = context or {}
930 per_obj = self.pool.get('account.period')
931 cf_obj = self.pool.get('customs.form')928 cf_obj = self.pool.get('customs.form')
932929
933 ids = isinstance(ids, (int, long)) and [ids] or ids930 ids = isinstance(ids, (int, long)) and [ids] or ids
@@ -936,9 +933,9 @@
936 continue933 continue
937 add_cf_ids = cf_obj.search(934 add_cf_ids = cf_obj.search(
938 cr, uid,935 cr, uid,
939 [('state','=', 'done'),936 [('state', '=', 'done'),
940 ('date_liq','>=', fb_brw.period_id.date_start),937 ('date_liq', '>=', fb_brw.period_id.date_start),
941 ('date_liq','<=', fb_brw.period_id.date_stop)],938 ('date_liq', '<=', fb_brw.period_id.date_stop)],
942 context=context)939 context=context)
943 add_cf_ids and self.write(940 add_cf_ids and self.write(
944 cr, uid, fb_brw.id, {'cf_ids': [(4, cf) for cf in add_cf_ids]},941 cr, uid, fb_brw.id, {'cf_ids': [(4, cf) for cf in add_cf_ids]},
@@ -953,7 +950,6 @@
953 context = context or {}950 context = context or {}
954 data = []951 data = []
955 iwdl_obj = self.pool.get('account.wh.iva.line')952 iwdl_obj = self.pool.get('account.wh.iva.line')
956 cf_obj = self.pool.get('customs.form')
957 fb_brw = self.browse(cr, uid, fb_id, context=context)953 fb_brw = self.browse(cr, uid, fb_id, context=context)
958 rp_obj = self.pool.get('res.partner')954 rp_obj = self.pool.get('res.partner')
959955
@@ -968,7 +964,7 @@
968 t_type = fb_brw.type == 'sale' and 'tp' or 'do'964 t_type = fb_brw.type == 'sale' and 'tp' or 'do'
969 for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids,965 for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids,
970 context=context):966 context=context):
971 rp_brw = rp_obj._find_accounting_partner(iwdl_brw.retention_id.partner_id)967 rp_brw = rp_obj._find_accounting_partner(iwdl_brw.retention_id.partner_id)
972 values = {968 values = {
973 'iwdl_id': iwdl_brw.id,969 'iwdl_id': iwdl_brw.id,
974 'type': t_type,970 'type': t_type,
@@ -980,12 +976,12 @@
980 'partner_name': rp_brw.name or 'N/A',976 'partner_name': rp_brw.name or 'N/A',
981 'partner_vat': rp_brw.vat or 'N/A',977 'partner_vat': rp_brw.vat or 'N/A',
982 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer978 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer
983 and iwdl_brw.invoice_id.invoice_printer979 and iwdl_brw.invoice_id.invoice_printer
984 or (fb_brw.type == 'sale'980 or (fb_brw.type == 'sale'
985 and iwdl_brw.invoice_id.number981 and iwdl_brw.invoice_id.number
986 or iwdl_brw.invoice_id.supplier_invoice_number),982 or iwdl_brw.invoice_id.supplier_invoice_number),
987 'affected_invoice_date': iwdl_brw.invoice_id.date_document \983 'affected_invoice_date': iwdl_brw.invoice_id.date_document
988 or iwdl_brw.invoice_id.date_invoice,984 or iwdl_brw.invoice_id.date_invoice,
989 'wh_rate': iwdl_brw.wh_iva_rate,985 'wh_rate': iwdl_brw.wh_iva_rate,
990 }986 }
991 data.append((0, 0, values))987 data.append((0, 0, values))
@@ -1000,45 +996,45 @@
1000 doc_type = self.get_doc_type(cr, uid, inv_id=inv_brw.id,996 doc_type = self.get_doc_type(cr, uid, inv_id=inv_brw.id,
1001 fb_id=fb_id, context=context)997 fb_id=fb_id, context=context)
1002998
1003 rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id)999 rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id)
10041000
1005 iwdl_brw = iwdl_obj.browse(cr, uid, iwdl_id, context=context) if \1001 iwdl_brw = iwdl_obj.browse(cr, uid, iwdl_id, context=context) if \
1006 iwdl_id and iwdl_id not in no_match_dt_iwdl_ids else False1002 iwdl_id and iwdl_id not in no_match_dt_iwdl_ids else False
10071003
1008 values = {1004 values = {
1009 'invoice_id': inv_brw.id,1005 'invoice_id': inv_brw.id,
1010 'emission_date': (not imex_invoice) \1006 'emission_date': (not imex_invoice)
1011 and (inv_brw.date_document or inv_brw.date_invoice) \1007 and (inv_brw.date_document or inv_brw.date_invoice)
1012 or False,1008 or False,
1013 'accounting_date': (not imex_invoice) and \1009 'accounting_date': (not imex_invoice) and
1014 inv_brw.date_invoice or False,1010 inv_brw.date_invoice or False,
1015 'imex_date': imex_invoice and inv_brw.customs_form_id.date_liq or False,1011 'imex_date': imex_invoice and inv_brw.customs_form_id.date_liq or False,
1016 'type': self.get_transaction_type(cr, uid, fb_id, inv_brw.id,1012 'type': self.get_transaction_type(cr, uid, fb_id, inv_brw.id,
1017 context=context),1013 context=context),
1018 'debit_affected': inv_brw.parent_id \1014 'debit_affected': inv_brw.parent_id
1019 and inv_brw.parent_id.type in ['in_invoice', 'out_invoice'] \1015 and inv_brw.parent_id.type in ['in_invoice', 'out_invoice']
1020 and inv_brw.parent_id.parent_id \1016 and inv_brw.parent_id.parent_id
1021 and inv_brw.parent_id.number or False,1017 and inv_brw.parent_id.number or False,
1022 'credit_affected': inv_brw.parent_id and \1018 'credit_affected': inv_brw.parent_id and
1023 inv_brw.parent_id.type in ['in_refund', 'out_refund'] \1019 inv_brw.parent_id.type in ['in_refund', 'out_refund']
1024 and inv_brw.parent_id.number or False,1020 and inv_brw.parent_id.number or False,
1025 'ctrl_number': not inv_brw.fiscal_printer and inv_brw.nro_ctrl or False,1021 'ctrl_number': not inv_brw.fiscal_printer and inv_brw.nro_ctrl or False,
1026 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") \1022 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR")
1027 and (inv_brw.parent_id and inv_brw.parent_id.number or False) \1023 and (inv_brw.parent_id and inv_brw.parent_id.number or False)
1028 or False,1024 or False,
1029 'partner_name': rp_brw.name or 'N/A',1025 'partner_name': rp_brw.name or 'N/A',
1030 'partner_vat': rp_brw.vat \1026 'partner_vat': rp_brw.vat
1031 and rp_brw.vat[2:] or 'N/A',1027 and rp_brw.vat[2:] or 'N/A',
1032 'invoice_number': inv_brw.fiscal_printer1028 'invoice_number': inv_brw.fiscal_printer
1033 and inv_brw.invoice_printer1029 and inv_brw.invoice_printer
1034 or (fb_brw.type == 'sale'1030 or (fb_brw.type == 'sale'
1035 and inv_brw.number1031 and inv_brw.number
1036 or inv_brw.supplier_invoice_number),1032 or inv_brw.supplier_invoice_number),
1037 'doc_type': doc_type,1033 'doc_type': doc_type,
1038 'void_form': inv_brw.name and \1034 'void_form': inv_brw.name and
1039 (inv_brw.name.find('PAPELANULADO') >= 0 \1035 (inv_brw.name.find('PAPELANULADO') >= 0
1040 and '03-ANU' or '01-REG') \1036 and '03-ANU' or '01-REG')
1041 or '01-REG',1037 or '01-REG',
1042 'fiscal_printer': inv_brw.fiscal_printer or False,1038 'fiscal_printer': inv_brw.fiscal_printer or False,
1043 'z_report': inv_brw.z_report or False,1039 'z_report': inv_brw.z_report or False,
1044 'custom_statement': inv_brw.customs_form_id.name or False,1040 'custom_statement': inv_brw.customs_form_id.name or False,
@@ -1068,7 +1064,7 @@
1068 values = common_values.copy()1064 values = common_values.copy()
1069 values['partner_name'] = partner_brw.name or 'N/A'1065 values['partner_name'] = partner_brw.name or 'N/A'
1070 values['partner_vat'] = partner_brw.vat \1066 values['partner_vat'] = partner_brw.vat \
1071 and partner_brw.vat[2:] or 'N/A'1067 and partner_brw.vat[2:] or 'N/A'
1072 values['total_with_iva'] = \1068 values['total_with_iva'] = \
1073 self.get_cfl_sum(cr, uid, cf_brw.id, partner_brw.id,1069 self.get_cfl_sum(cr, uid, cf_brw.id, partner_brw.id,
1074 context=context)1070 context=context)
@@ -1094,14 +1090,14 @@
1094 @param cf_id: customs form id1090 @param cf_id: customs form id
1095 @param partner_id: partner id1091 @param partner_id: partner id
1096 """1092 """
1097 #KEEP AN EYE ON HERE, No check has been made on accounting partner1093 # KEEP AN EYE ON HERE, No check has been made on accounting partner
1098 context = context or {}1094 context = context or {}
1099 cf_obj = self.pool.get('customs.form')1095 cf_obj = self.pool.get('customs.form')
1100 cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids1096 cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids
1101 amount = sum([cfl_brw.amount1097 amount = sum([cfl_brw.amount
1102 for cfl_brw in cfl_brws1098 for cfl_brw in cfl_brws
1103 if cfl_brw.tax_code.partner_id.id == partner_id1099 if cfl_brw.tax_code.partner_id.id == partner_id
1104 and not cfl_brw.tax_code.vat_detail ])1100 and not cfl_brw.tax_code.vat_detail])
1105 return amount1101 return amount
11061102
1107 def get_grouped_consecutive_lines_ids(self, cr, uid, lines_ids, context=None):1103 def get_grouped_consecutive_lines_ids(self, cr, uid, lines_ids, context=None):
@@ -1131,15 +1127,15 @@
1131 group_list.append(line_brw)1127 group_list.append(line_brw)
1132 else:1128 else:
1133 if group_list:1129 if group_list:
1134 res.append( (group_list[0].invoice_number, group_list[-1].invoice_number, group_value, group_list) )1130 res.append((group_list[0].invoice_number, group_list[-1].invoice_number, group_value, group_list))
1135 group_value = line_brw.type1131 group_value = line_brw.type
1136 group_list = [line_brw]1132 group_list = [line_brw]
1137 else:1133 else:
1138 res.append( (line_brw.invoice_number, line_brw.invoice_number, group_value, [line_brw]) )1134 res.append((line_brw.invoice_number, line_brw.invoice_number, group_value, [line_brw]))
1139 group_value = False1135 group_value = False
11401136
1141 if group_list:1137 if group_list:
1142 res.append( (group_list[0].invoice_number, group_list[-1].invoice_number, group_value, group_list) )1138 res.append((group_list[0].invoice_number, group_list[-1].invoice_number, group_value, group_list))
11431139
1144 return res1140 return res
11451141
@@ -1157,35 +1153,35 @@
1157 #~ separating groups1153 #~ separating groups
1158 lines_brws = fb_brw.fbl_ids1154 lines_brws = fb_brw.fbl_ids
1159 order_dict = dict()1155 order_dict = dict()
1160 date_values = list(set([ line_brw.emission_date for line_brw in lines_brws ]))1156 date_values = list(set([line_brw.emission_date for line_brw in lines_brws]))
1161 date_values.sort()1157 date_values.sort()
1162 order_dict = {}.fromkeys(date_values)1158 order_dict = {}.fromkeys(date_values)
1163 for date in date_values:1159 for date in date_values:
1164 date_records = [ line_brw1160 date_records = [line_brw
1165 for line_brw in lines_brws1161 for line_brw in lines_brws
1166 if line_brw.emission_date == date ]1162 if line_brw.emission_date == date]
1167 printers_values = list(set( [ line_brw.fiscal_printer for line_brw in date_records ] ))1163 printers_values = list(set([line_brw.fiscal_printer for line_brw in date_records]))
1168 printers_values.sort()1164 printers_values.sort()
1169 order_dict[date] = {}.fromkeys(printers_values)1165 order_dict[date] = {}.fromkeys(printers_values)
1170 for printer in printers_values:1166 for printer in printers_values:
1171 printer_records = [ line_brw1167 printer_records = [line_brw
1172 for line_brw in date_records1168 for line_brw in date_records
1173 if line_brw.fiscal_printer == printer ]1169 if line_brw.fiscal_printer == printer]
1174 z_report_values = list(set( [ line_brw.z_report for line_brw in printer_records ] ))1170 z_report_values = list(set([line_brw.z_report for line_brw in printer_records]))
1175 z_report_values.sort()1171 z_report_values.sort()
1176 order_dict[date][printer] = {}.fromkeys(z_report_values)1172 order_dict[date][printer] = {}.fromkeys(z_report_values)
1177 for z_report in z_report_values:1173 for z_report in z_report_values:
1178 #~ this records needs to be order by invoice number1174 #~ this records needs to be order by invoice number
1179 z_records = \1175 z_records = \
1180 [ (line_brw.invoice_number, line_brw)1176 [(line_brw.invoice_number, line_brw)
1181 for line_brw in printer_records1177 for line_brw in printer_records
1182 if line_brw.z_report == z_report ]1178 if line_brw.z_report == z_report]
1183 z_records.sort()1179 z_records.sort()
1184 z_records = [ item[1] for item in z_records]1180 z_records = [item[1] for item in z_records]
1185 #~ group by type of line1181 #~ group by type of line
1186 order_dict[date][printer][z_report] = \1182 order_dict[date][printer][z_report] = \
1187 self.get_grouped_consecutive_lines_ids(1183 self.get_grouped_consecutive_lines_ids(
1188 cr, uid, [ item.id for item in z_records],1184 cr, uid, [item.id for item in z_records],
1189 context=context)1185 context=context)
11901186
1191 #~ import pprint1187 #~ import pprint
@@ -1216,14 +1212,14 @@
1216 elif line[0] != line[1] and len(line[3]) > 1:1212 elif line[0] != line[1] and len(line[3]) > 1:
1217 ntp_groups_list.append(1213 ntp_groups_list.append(
1218 (rank,1214 (rank,
1219 'Desde: '+line[0]+' ... Hasta: '+line[1],1215 'Desde: ' + line[0] + ' ... Hasta: ' + line[1],
1220 line[3]))1216 line[3]))
1221 else:1217 else:
1222 raise osv.except_osv(_("Error!"), _("This is a no valid line. Be sure you have two or more invoices with the same invoice number"))1218 raise osv.except_osv(_("Error!"), _("This is a no valid line. Be sure you have two or more invoices with the same invoice number"))
1223 elif line[2] != 'ntp':1219 elif line[2] != 'ntp':
1224 order_no_group_list.append(1220 order_no_group_list.append(
1225 (rank, line[3][0].id))1221 (rank, line[3][0].id))
1226 rank+= 11222 rank += 1
12271223
1228 #~ import pprint1224 #~ import pprint
1229 #~ print '\n ntp_no_group_list'1225 #~ print '\n ntp_no_group_list'
@@ -1233,11 +1229,11 @@
1233 #~ print '\n order_no_group_list'1229 #~ print '\n order_no_group_list'
1234 #~ pprint.pprint(order_no_group_list)1230 #~ pprint.pprint(order_no_group_list)
12351231
1236 #~ # rank lines that have nothing to do with ntp.1232 # ~ # rank lines that have nothing to do with ntp.
1237 for line in order_no_group_list:1233 for line in order_no_group_list:
1238 fbl_obj.write(cr, uid, line[1], {'rank': line[0]}, context=context)1234 fbl_obj.write(cr, uid, line[1], {'rank': line[0]}, context=context)
12391235
1240 #~ # rank ntp individual lines.1236 # ~ # rank ntp individual lines.
1241 for line in ntp_no_group_list:1237 for line in ntp_no_group_list:
1242 fbl_obj.write(1238 fbl_obj.write(
1243 cr, uid, line[1],1239 cr, uid, line[1],
@@ -1258,7 +1254,7 @@
1258 {'fb_id': False,1254 {'fb_id': False,
1259 'ntp_fb_id': fb_id,1255 'ntp_fb_id': fb_id,
1260 'parent_id': consolidate_line_id,1256 'parent_id': consolidate_line_id,
1261 'rank': -1 },1257 'rank': -1},
1262 context=context)1258 context=context)
12631259
1264 return True1260 return True
@@ -1278,8 +1274,8 @@
1278 'vat_general_base', 'vat_general_tax',1274 'vat_general_base', 'vat_general_tax',
1279 'vat_additional_base', 'vat_additional_tax']1275 'vat_additional_base', 'vat_additional_tax']
12801276
1281 rank, invoice_number, child_brws = line_tuple1277 rank, invoice_number, child_brws = line_tuple
1282 child_ids = [ line_brw.id for line_brw in child_brws ]1278 child_ids = [line_brw.id for line_brw in child_brws]
1283 first_item_brw = fbl_obj.browse(cr, uid, child_brws[0].id,1279 first_item_brw = fbl_obj.browse(cr, uid, child_brws[0].id,
1284 context=context)1280 context=context)
1285 # fill common value1281 # fill common value
@@ -1299,7 +1295,7 @@
1299 # fill totalization values1295 # fill totalization values
1300 for col in float_colums:1296 for col in float_colums:
1301 values[col] = \1297 values[col] = \
1302 sum([ getattr(line_brw, col) for line_brw in child_brws ])1298 sum([getattr(line_brw, col) for line_brw in child_brws])
13031299
1304 return fbl_obj.create(cr, uid, values, context=context)1300 return fbl_obj.create(cr, uid, values, context=context)
13051301
@@ -1321,7 +1317,7 @@
1321 for fbl in self.browse(cr, uid, fb_id, context=context).fbl_ids:1317 for fbl in self.browse(cr, uid, fb_id, context=context).fbl_ids:
1322 if fbl.invoice_id:1318 if fbl.invoice_id:
1323 sign = 1 if fbl.doc_type != 'N/CR' else -11319 sign = 1 if fbl.doc_type != 'N/CR' else -1
1324 tax_lines = fbl.type in ['im','ex'] \1320 tax_lines = fbl.type in ['im', 'ex'] \
1325 and fbl.invoice_id.imex_tax_line \1321 and fbl.invoice_id.imex_tax_line \
1326 or fbl.invoice_id.tax_line1322 or fbl.invoice_id.tax_line
1327 for ait in tax_lines:1323 for ait in tax_lines:
@@ -1331,20 +1327,20 @@
1331 tax_sum[fbl.type][ait.tax_id.appl_type] += \1327 tax_sum[fbl.type][ait.tax_id.appl_type] += \
1332 ait.tax_amount * sign1328 ait.tax_amount * sign
1333 else:1329 else:
1334 raise osv.except_osv(_('Error!'),_('You must assign the Aliquot Type to: %s')%(ait.tax_id.name))1330 raise osv.except_osv(_('Error!'), _('You must assign the Aliquot Type to: %s') % (ait.tax_id.name))
1335 elif fbl.cf_id:1331 elif fbl.cf_id:
1336 if fbl.type != 'do':1332 if fbl.type != 'do':
1337 raise osv.except_osv(_('Programing Error!'),1333 raise osv.except_osv(_('Programing Error!'),
1338 _("Customs form lines are domestic transactions"))1334 _("Customs form lines are domestic transactions"))
1339 base_sum['do']['sdcf'] += fbl.vat_sdcf1335 base_sum['do']['sdcf'] += fbl.vat_sdcf
13401336
1341 data = [ (0, 0, {'tax_type': ttype, 'op_type': optype,1337 data = [(0, 0, {'tax_type': ttype, 'op_type': optype,
1342 'base_amount_sum': base_sum[optype][ttype],1338 'base_amount_sum': base_sum[optype][ttype],
1343 'tax_amount_sum': tax_sum[optype][ttype]1339 'tax_amount_sum': tax_sum[optype][ttype]
1344 })1340 })
1345 for ttype in tax_types1341 for ttype in tax_types
1346 for optype in op_types1342 for optype in op_types
1347 ]1343 ]
1348 return data and self.write(cr, uid, fb_id, {'fbts_ids': data},1344 return data and self.write(cr, uid, fb_id, {'fbts_ids': data},
1349 context=context)1345 context=context)
13501346
@@ -1361,9 +1357,9 @@
1361 for fbl_brw in self.browse(cr, uid, fb_id, context=context).fbl_ids:1357 for fbl_brw in self.browse(cr, uid, fb_id, context=context).fbl_ids:
1362 sign = 1 if fbl_brw.doc_type != 'N/CR' else -11358 sign = 1 if fbl_brw.doc_type != 'N/CR' else -1
1363 if fbl_brw.invoice_id:1359 if fbl_brw.invoice_id:
1364 taxes = fbl_brw.type in ['im','ex'] \1360 taxes = fbl_brw.type in ['im', 'ex'] \
1365 and fbl_brw.invoice_id.imex_tax_line \1361 and fbl_brw.invoice_id.imex_tax_line \
1366 or fbl_brw.invoice_id.tax_line1362 or fbl_brw.invoice_id.tax_line
1367 for ait in taxes:1363 for ait in taxes:
1368 if ait.tax_id:1364 if ait.tax_id:
1369 base_amount += ait.base_amount * sign1365 base_amount += ait.base_amount * sign
@@ -1408,7 +1404,7 @@
1408 'ntp_additional_vat_tax_sum',1404 'ntp_additional_vat_tax_sum',
1409 'ntp_reduced_vat_base_sum',1405 'ntp_reduced_vat_base_sum',
1410 'ntp_reduced_vat_tax_sum',1406 'ntp_reduced_vat_tax_sum',
1411 ]1407 ]
1412 for field_name in vat_fields:1408 for field_name in vat_fields:
1413 data[field_name] = \1409 data[field_name] = \
1414 self.update_vat_fields(cr, uid, fb_id, field_name,1410 self.update_vat_fields(cr, uid, fb_id, field_name,
@@ -1418,14 +1414,14 @@
1418 fb_brw = self.browse(cr, uid, fb_id, context=context)1414 fb_brw = self.browse(cr, uid, fb_id, context=context)
14191415
1420 data['do_sdcf_and_exempt_sum'] = fb_brw.type == 'sale' \1416 data['do_sdcf_and_exempt_sum'] = fb_brw.type == 'sale' \
1421 and ( data['tp_exempt_vat_sum'] + data['tp_sdcf_vat_sum'] + \1417 and (data['tp_exempt_vat_sum'] + data['tp_sdcf_vat_sum'] +
1422 data['ntp_exempt_vat_sum'] + data['ntp_sdcf_vat_sum'] ) \1418 data['ntp_exempt_vat_sum'] + data['ntp_sdcf_vat_sum'] ) \
1423 or ( data['do_exempt_vat_sum'] + data['do_sdcf_vat_sum'] )1419 or (data['do_exempt_vat_sum'] + data['do_sdcf_vat_sum'])
14241420
1425 for optype in ['imex', 'do', 'tp', 'ntp']:1421 for optype in ['imex', 'do', 'tp', 'ntp']:
1426 data[optype + '_vat_base_sum'] = \1422 data[optype + '_vat_base_sum'] = \
1427 sum( [ data[optype + '_' + ttax + "_vat_base_sum"]1423 sum([data[optype + '_' + ttax + "_vat_base_sum"]
1428 for ttax in ["general", "additional", "reduced"] ] )1424 for ttax in ["general", "additional", "reduced"]])
14291425
1430 data['imex_vat_base_sum'] += \1426 data['imex_vat_base_sum'] += \
1431 data['imex_exempt_vat_sum'] + data['imex_sdcf_vat_sum']1427 data['imex_exempt_vat_sum'] + data['imex_sdcf_vat_sum']
@@ -1439,14 +1435,14 @@
1439 for ttax in ["general", "additional", "reduced"]:1435 for ttax in ["general", "additional", "reduced"]:
1440 for amttype in ["base", "tax"]:1436 for amttype in ["base", "tax"]:
1441 data['do_' + ttax + '_vat_' + amttype + '_sum'] = \1437 data['do_' + ttax + '_vat_' + amttype + '_sum'] = \
1442 sum( [ data[ optype + "_" + ttax + "_vat_" + amttype + "_sum"]1438 sum([data[optype + "_" + ttax + "_vat_" + amttype + "_sum"]
1443 for optype in ["ntp", "tp"]1439 for optype in ["ntp", "tp"]
1444 ] )1440 ])
1445 for ttax in ["exempt", "sdcf"]:1441 for ttax in ["exempt", "sdcf"]:
1446 data['do_' + ttax + '_vat_sum'] = \1442 data['do_' + ttax + '_vat_sum'] = \
1447 sum( [ data[ optype + "_" + ttax + "_vat_sum"]1443 sum([data[optype + "_" + ttax + "_vat_sum"]
1448 for optype in ["ntp", "tp"]1444 for optype in ["ntp", "tp"]
1449 ] )1445 ])
14501446
1451 return self.write(cr, uid, fb_id, data, context=context)1447 return self.write(cr, uid, fb_id, data, context=context)
14521448
@@ -1534,9 +1530,9 @@
1534 fbl.invoice_id.date_invoice)1530 fbl.invoice_id.date_invoice)
1535 sign = 1 if fbl.doc_type != 'N/CR' else -11531 sign = 1 if fbl.doc_type != 'N/CR' else -1
1536 amount_field_data = \1532 amount_field_data = \
1537 { 'total_with_iva': f_xc(fbl.invoice_id.amount_untaxed) * sign,1533 {'total_with_iva': f_xc(fbl.invoice_id.amount_untaxed) * sign,
1538 'vat_sdcf': 0.0, 'vat_exempt': 0.0 }1534 'vat_sdcf': 0.0, 'vat_exempt': 0.0}
1539 taxes = fbl.type in ['im','ex'] \1535 taxes = fbl.type in ['im', 'ex'] \
1540 and fbl.invoice_id.imex_tax_line \1536 and fbl.invoice_id.imex_tax_line \
1541 or fbl.invoice_id.tax_line1537 or fbl.invoice_id.tax_line
1542 for ait in taxes:1538 for ait in taxes:
@@ -1683,7 +1679,7 @@
1683 'ntp_additional_vat_tax_sum',1679 'ntp_additional_vat_tax_sum',
1684 'ntp_reduced_vat_base_sum',1680 'ntp_reduced_vat_base_sum',
1685 'ntp_reduced_vat_tax_sum',1681 'ntp_reduced_vat_tax_sum',
1686 ]1682 ]
16871683
1688 return self.write(cr, uid, fb_id, {}.fromkeys(vat_fields, 0.0),1684 return self.write(cr, uid, fb_id, {}.fromkeys(vat_fields, 0.0),
1689 context=context)1685 context=context)
@@ -1800,7 +1796,7 @@
1800 inv_obj = self.pool.get('account.invoice')1796 inv_obj = self.pool.get('account.invoice')
1801 rp_obj = self.pool.get('res.partner')1797 rp_obj = self.pool.get('res.partner')
1802 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)1798 inv_brw = inv_obj.browse(cr, uid, inv_id, context=context)
1803 rp_id = rp_obj._find_accounting_partner(inv_brw.partner_id)1799 rp_id = rp_obj._find_accounting_partner(inv_brw.partner_id)
1804 rp_brw = rp_obj.browse(cr, uid, rp_id, context=context)1800 rp_brw = rp_obj.browse(cr, uid, rp_id, context=context)
1805 fb_brw = self.browse(cr, uid, fb_id, context=context)1801 fb_brw = self.browse(cr, uid, fb_id, context=context)
1806 if inv_brw.customs_form_id:1802 if inv_brw.customs_form_id:
@@ -1820,7 +1816,7 @@
1820 raise osv.except_osv("Invalid Procedure!!",1816 raise osv.except_osv("Invalid Procedure!!",
1821 "Your book needs to be in cancel state to be deleted.")1817 "Your book needs to be in cancel state to be deleted.")
1822 else:1818 else:
1823 super(fiscal_book,self).unlink(cr, uid, ids, context=context)1819 super(fiscal_book, self).unlink(cr, uid, ids, context=context)
1824 return True1820 return True
18251821
18261822
@@ -1848,7 +1844,6 @@
1848 #~ TODO: for all taxes realted? only a tax type group?1844 #~ TODO: for all taxes realted? only a tax type group?
1849 context = context or {}1845 context = context or {}
1850 res = {}.fromkeys(ids, 0.0)1846 res = {}.fromkeys(ids, 0.0)
1851 awilt_obj = self.pool.get("account.wh.iva.line.tax")
1852 for fbl_brw in self.browse(cr, uid, ids, context=context):1847 for fbl_brw in self.browse(cr, uid, ids, context=context):
1853 if fbl_brw.iwdl_id:1848 if fbl_brw.iwdl_id:
1854 sign = 1 if fbl_brw.doc_type != 'AJST' else -11849 sign = 1 if fbl_brw.doc_type != 'AJST' else -1
@@ -1861,12 +1856,12 @@
1861 for item in self.browse(cr, uid, ids, context=context):1856 for item in self.browse(cr, uid, ids, context=context):
1862 res[item.id] = {1857 res[item.id] = {
1863 'vat_reduced_rate': item.vat_reduced_base and1858 'vat_reduced_rate': item.vat_reduced_base and
1864 item.vat_reduced_tax * 100 / item.vat_reduced_base,1859 item.vat_reduced_tax * 100 / item.vat_reduced_base,
1865 'vat_general_rate': item.vat_general_base and1860 'vat_general_rate': item.vat_general_base and
1866 item.vat_general_tax * 100 / item.vat_general_base,1861 item.vat_general_tax * 100 / item.vat_general_base,
1867 'vat_additional_rate': item.vat_additional_base and1862 'vat_additional_rate': item.vat_additional_base and
1868 item.vat_additional_tax * 100 / item.vat_additional_base,1863 item.vat_additional_tax * 100 / item.vat_additional_base,
1869 }1864 }
1870 return res1865 return res
18711866
1872 _description = "Venezuela's Sale & Purchase Fiscal Book Lines"1867 _description = "Venezuela's Sale & Purchase Fiscal Book Lines"
@@ -1878,25 +1873,25 @@
1878 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',1873 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
1879 help='Fiscal Book that owns this book line', ondelete='cascade'),1874 help='Fiscal Book that owns this book line', ondelete='cascade'),
1880 'ntp_fb_id': fields.many2one("fiscal.book", "Non-Tax Payer Detail",1875 'ntp_fb_id': fields.many2one("fiscal.book", "Non-Tax Payer Detail",
1881 help="Fiscal Book that owns this book line" \1876 help="Fiscal Book that owns this book line"
1882 " This Book is only for Non-Tax Payer lines"),1877 " This Book is only for Non-Tax Payer lines"),
1883 'fbt_ids': fields.one2many('fiscal.book.taxes', 'fbl_id',1878 'fbt_ids': fields.one2many('fiscal.book.taxes', 'fbl_id',
1884 string='Tax Lines', help="Tax Lines being" \1879 string='Tax Lines', help="Tax Lines being"
1885 " recorded in a Fiscal Book"),1880 " recorded in a Fiscal Book"),
1886 'invoice_id': fields.many2one('account.invoice', 'Invoice',1881 'invoice_id': fields.many2one('account.invoice', 'Invoice',
1887 help="Invoice related to this book" \1882 help="Invoice related to this book"
1888 " line"),1883 " line"),
1889 'iwdl_id': fields.many2one('account.wh.iva.line', 'Vat Withholding',1884 'iwdl_id': fields.many2one('account.wh.iva.line', 'Vat Withholding',
1890 help="Withholding iva line related to" \1885 help="Withholding iva line related to"
1891 " this book line"),1886 " this book line"),
1892 'cf_id': fields.many2one('customs.form', 'Customs Form',1887 'cf_id': fields.many2one('customs.form', 'Customs Form',
1893 help="Customs Form being recorded to this" \1888 help="Customs Form being recorded to this"
1894 " book line"),1889 " book line"),
1895 'parent_id': fields.many2one(1890 'parent_id': fields.many2one(
1896 "fiscal.book.line",1891 "fiscal.book.line",
1897 string="Consolidated Line",1892 string="Consolidated Line",
1898 ondelete='cascade',1893 ondelete='cascade',
1899 help="Non-Tax Payer Consolidated Line. Indicate the id of the" \1894 help="Non-Tax Payer Consolidated Line. Indicate the id of the"
1900 " consolidated line where this Non-Tax Payer line belongs"),1895 " consolidated line where this Non-Tax Payer line belongs"),
1901 'parent_left': fields.integer('Left Parent', select=1),1896 'parent_left': fields.integer('Left Parent', select=1),
1902 'parent_right': fields.integer('Right Parent', select=1),1897 'parent_right': fields.integer('Right Parent', select=1),
@@ -1913,7 +1908,7 @@
1913 help='Invoice Document Date / Wh IVA Line Voucher Date'),1908 help='Invoice Document Date / Wh IVA Line Voucher Date'),
1914 'accounting_date': fields.date(1909 'accounting_date': fields.date(
1915 string='Accounting Date',1910 string='Accounting Date',
1916 help="The day of the accounting record [(invoice, date_invoice)," \1911 help="The day of the accounting record [(invoice, date_invoice),"
1917 " (wh iva line, date_ret)]"),1912 " (wh iva line, date_ret)]"),
1918 'doc_type': fields.char('Doc. Type', size=8, help='Document Type'),1913 'doc_type': fields.char('Doc. Type', size=8, help='Document Type'),
1919 'partner_name': fields.char(size=128, string='Partner Name', help=''),1914 'partner_name': fields.char(size=128, string='Partner Name', help=''),
@@ -1921,8 +1916,8 @@
1921 'affected_invoice': fields.char(1916 'affected_invoice': fields.char(
1922 string='Affected Invoice',1917 string='Affected Invoice',
1923 size=64,1918 size=64,
1924 help="For an invoice line type means parent invoice for a Debit" \1919 help="For an invoice line type means parent invoice for a Debit"
1925 " or Credit Note. For an withholding line type means the invoice" \1920 " or Credit Note. For an withholding line type means the invoice"
1926 " number related to the withholding"),1921 " number related to the withholding"),
1927 #~ Apply for wh iva lines1922 #~ Apply for wh iva lines
1928 'get_wh_vat': fields.function(_get_wh_vat,1923 'get_wh_vat': fields.function(_get_wh_vat,
@@ -1939,16 +1934,16 @@
1939 _get_based_tax_debit,1934 _get_based_tax_debit,
1940 type="float", method=True, store=True,1935 type="float", method=True, store=True,
1941 string="Based Tax Debit",1936 string="Based Tax Debit",
1942 help="Sum of all tax amount for the taxes realeted to the wh iva" \1937 help="Sum of all tax amount for the taxes realeted to the wh iva"
1943 " line."),1938 " line."),
19441939
1945 #~ Apply for invoice lines1940 #~ Apply for invoice lines
1946 'ctrl_number': fields.char(string='Invoice Control number', size=64,1941 'ctrl_number': fields.char(string='Invoice Control number', size=64,
1947 help=''),1942 help=''),
1948 'invoice_number': fields.char(string='Invoice number', size=64,1943 'invoice_number': fields.char(string='Invoice number', size=64,
1949 help="Invoice Number. In case of use" \1944 help="Invoice Number. In case of use"
1950 " of fiscal printer this field will" \1945 " of fiscal printer this field will"
1951 " store the invoice number generate" \1946 " store the invoice number generate"
1952 " by the fiscal printer machine"),1947 " by the fiscal printer machine"),
1953 'imex_date': fields.date(string='Imex Date',1948 'imex_date': fields.date(string='Imex Date',
1954 help='Invoice Imports/Exports Date'),1949 help='Invoice Imports/Exports Date'),
@@ -1964,9 +1959,9 @@
1964 ('ex', 'Exports'),1959 ('ex', 'Exports'),
1965 ('tp', 'Tax Payer'),1960 ('tp', 'Tax Payer'),
1966 ('ntp', 'Non-Tax Payer')],1961 ('ntp', 'Non-Tax Payer')],
1967 string = 'Transaction Type', required=True,1962 string='Transaction Type', required=True,
1968 help="Book line transtaction type:" \1963 help="Book line transtaction type:"
1969 " - Purchase: Import or Domestic." \1964 " - Purchase: Import or Domestic."
1970 " - Sales: Expertation, Tax Payer, Non-Tax Payer."),1965 " - Sales: Expertation, Tax Payer, Non-Tax Payer."),
1971 'void_form': fields.char(string='Transaction type', size=192,1966 'void_form': fields.char(string='Transaction type', size=192,
1972 help="Operation Type"),1967 help="Operation Type"),
@@ -1976,25 +1971,25 @@
1976 'custom_statement': fields.char(string="Custom Statement",1971 'custom_statement': fields.char(string="Custom Statement",
1977 size=192, help=""),1972 size=192, help=""),
1978 #~ -- taxes fields1973 #~ -- taxes fields
1979 'total_with_iva': fields.float('Total with IVA', help="Sub Total of" \1974 'total_with_iva': fields.float('Total with IVA', help="Sub Total of"
1980 " the invoice (untaxed amount) plus" \1975 " the invoice (untaxed amount) plus"
1981 " all tax amount of the related taxes"),1976 " all tax amount of the related taxes"),
1982 'vat_sdcf': fields.float("SDCF", help="Not entitled to tax credit" \1977 'vat_sdcf': fields.float("SDCF", help="Not entitled to tax credit"
1983 " (The field name correspond to the spanih" \1978 " (The field name correspond to the spanih"
1984 " acronym for 'Sin Derecho a Credito Fiscal')"),1979 " acronym for 'Sin Derecho a Credito Fiscal')"),
1985 'vat_exempt': fields.float("Exempt", help="Exempt is a Tax with 0" \1980 'vat_exempt': fields.float("Exempt", help="Exempt is a Tax with 0"
1986 " tax percentage"),1981 " tax percentage"),
1987 'vat_reduced_base': fields.float("RED BASE", help="Vat Reduced Base" \1982 'vat_reduced_base': fields.float("RED BASE", help="Vat Reduced Base"
1988 " Amount"),1983 " Amount"),
1989 'vat_reduced_tax': fields.float("RED TAX", help="Vat Reduced Tax" \1984 'vat_reduced_tax': fields.float("RED TAX", help="Vat Reduced Tax"
1990 " Amount"),1985 " Amount"),
1991 'vat_general_base': fields.float("GRAL BASE",help="Vat General Base" \1986 'vat_general_base': fields.float("GRAL BASE", help="Vat General Base"
1992 " Amount"),1987 " Amount"),
1993 'vat_general_tax': fields.float("GRAL TAX", help="Vat General Tax" \1988 'vat_general_tax': fields.float("GRAL TAX", help="Vat General Tax"
1994 " Amount"),1989 " Amount"),
1995 'vat_additional_base': fields.float("ADD BASE", help="Vat Generald" \1990 'vat_additional_base': fields.float("ADD BASE", help="Vat Generald"
1996 " plus Additional Base Amount"),1991 " plus Additional Base Amount"),
1997 'vat_additional_tax': fields.float("ADD TAX", help="Vat General plus" \1992 'vat_additional_tax': fields.float("ADD TAX", help="Vat General plus"
1998 " Additional Tax Amount"),1993 " Additional Tax Amount"),
1999 'vat_reduced_rate': fields.function(1994 'vat_reduced_rate': fields.function(
2000 _compute_vat_rates, method=True, type='float',1995 _compute_vat_rates, method=True, type='float',
@@ -2012,7 +2007,8 @@
20122007
2013 _defaults = {2008 _defaults = {
2014 'rank': 0,2009 'rank': 0,
2015 }2010 }
2011
20162012
2017class fiscal_book_taxes(orm.Model):2013class fiscal_book_taxes(orm.Model):
20182014
@@ -2065,14 +2061,15 @@
2065 ('ex', 'Exports'),2061 ('ex', 'Exports'),
2066 ('tp', 'Tax Payer'),2062 ('tp', 'Tax Payer'),
2067 ('ntp', 'Non-Tax Payer')],2063 ('ntp', 'Non-Tax Payer')],
2068 string = 'Operation Type',2064 string='Operation Type',
2069 help="Operation Type:" \2065 help="Operation Type:"
2070 " - Purchase: Import or Domestic." \2066 " - Purchase: Import or Domestic."
2071 " - Sales: Expertation, Tax Payer, Non-Tax Payer."),2067 " - Sales: Expertation, Tax Payer, Non-Tax Payer."),
2072 'base_amount_sum': fields.float('Taxable Amount Sum'),2068 'base_amount_sum': fields.float('Taxable Amount Sum'),
2073 'tax_amount_sum': fields.float('Taxed Amount Sum'),2069 'tax_amount_sum': fields.float('Taxed Amount Sum'),
2074 }2070 }
20752071
2072
2076class adjustment_book_line(orm.Model):2073class adjustment_book_line(orm.Model):
20772074
2078 _name = 'adjustment.book.line'2075 _name = 'adjustment.book.line'
20792076
=== modified file 'l10n_ve_fiscal_book/model/invoice.py'
--- l10n_ve_fiscal_book/model/invoice.py 2014-07-31 18:26:14 +0000
+++ l10n_ve_fiscal_book/model/invoice.py 2014-10-11 00:06:17 +0000
@@ -32,10 +32,10 @@
3232
33 _columns = {33 _columns = {
34 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',34 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
35 help='Fiscal Book where this line is ' \35 help='Fiscal Book where this line is '
36 'related to'),36 'related to'),
37 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book',37 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
38 help='Fiscal Book where this invoice ' \38 help='Fiscal Book where this invoice '
39 'needs to be add'),39 'needs to be add'),
40 }40 }
4141
4242
=== modified file 'l10n_ve_fiscal_book/model/wh_iva.py'
--- l10n_ve_fiscal_book/model/wh_iva.py 2013-04-30 13:53:01 +0000
+++ l10n_ve_fiscal_book/model/wh_iva.py 2014-10-11 00:06:17 +0000
@@ -23,13 +23,14 @@
23# You should have received a copy of the GNU Affero General Public License23# You should have received a copy of the GNU Affero General Public License
24# along with this program. If not, see <http://www.gnu.org/licenses/>.24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25##############################################################################25##############################################################################
26from openerp.osv import osv, orm, fields26from openerp.osv import fields
27from openerp.tools.translate import _27from openerp.osv import orm
28
2829
29class account_wh_iva_line(orm.Model):30class account_wh_iva_line(orm.Model):
30 _inherit= "account.wh.iva.line"31 _inherit = "account.wh.iva.line"
31 _columns = {32 _columns = {
32 'fb_id':fields.many2one('fiscal.book','Fiscal Book',33 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book',
33 help='Fiscal Book where this line is related to'),34 help='Fiscal Book where this line is related to'),
34 }35 }
3536
@@ -41,7 +42,6 @@
41 inv_obj = self.pool.get('account.invoice')42 inv_obj = self.pool.get('account.invoice')
42 inv = inv_obj.browse(cr, uid, inv_id, context=context)43 inv = inv_obj.browse(cr, uid, inv_id, context=context)
43 if inv.wh_iva and inv.wh_iva_id:44 if inv.wh_iva and inv.wh_iva_id:
44 awil_ids = self.search(cr, uid, ids, [('invoice_id' , '=', inv.id)], context=context)45 awil_ids = self.search(cr, uid, ids, [('invoice_id', '=', inv.id)], context=context)
45 self.write(cr, uid, awil_ids, {'fb_id' : fb_id }, context=context)46 self.write(cr, uid, awil_ids, {'fb_id': fb_id}, context=context)
46 return True47 return True
47
4848
=== modified file 'l10n_ve_fiscal_book/wizard/__init__.py'
--- l10n_ve_fiscal_book/wizard/__init__.py 2014-09-19 14:57:59 +0000
+++ l10n_ve_fiscal_book/wizard/__init__.py 2014-10-11 00:06:17 +0000
@@ -3,7 +3,7 @@
3#3#
4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.4# Copyright (c) 2010 Vauxoo C.A. (http://openerp.com.ve/) All Rights Reserved.
5# Javier Duran <javier@vauxoo.com>5# Javier Duran <javier@vauxoo.com>
6# 6#
7#7#
8# WARNING: This program as such is intended to be used by professional8# WARNING: This program as such is intended to be used by professional
9# programmers who take the whole responsability of assessing all potential9# programmers who take the whole responsability of assessing all potential
@@ -28,5 +28,5 @@
28#28#
29##############################################################################29##############################################################################
3030
31import fiscal_book_wizard31from . import fiscal_book_wizard
32import change_invoice_sin_cred32from . import change_invoice_sin_cred
3333
=== modified file 'l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py'
--- l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py 2014-09-19 16:14:51 +0000
+++ l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py 2014-10-11 00:06:17 +0000
@@ -25,7 +25,6 @@
2525
26from openerp.osv import osv, fields26from openerp.osv import osv, fields
27from openerp.tools.translate import _27from openerp.tools.translate import _
28import decimal_precision as dp
2928
3029
31class change_invoice_sin_credwizard(osv.TransientModel):30class change_invoice_sin_credwizard(osv.TransientModel):
@@ -47,7 +46,7 @@
47 def set_sin_cred(self, cr, uid, ids, context=None):46 def set_sin_cred(self, cr, uid, ids, context=None):
48 """47 """
49 Change the sin cred field in the invoice48 Change the sin cred field in the invoice
50 @return 49 @return
51 """50 """
52 context = context or {}51 context = context or {}
53 ids = isinstance(ids, (int, long)) and [ids] or ids52 ids = isinstance(ids, (int, long)) and [ids] or ids
5453
=== modified file 'l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py'
--- l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2014-10-07 22:02:14 +0000
+++ l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2014-10-11 00:06:17 +0000
@@ -25,14 +25,13 @@
25# along with this program; if not, write to the Free Software25# along with this program; if not, write to the Free Software
26# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.26# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27###############################################################################27###############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields
30import sys
31from openerp.tools.translate import _29from openerp.tools.translate import _
32import time30import time
3331
3432
35class fiscal_book_wizard(osv.osv_memory):33class fiscal_book_wizard(osv.osv_memory):
34
36 """35 """
37 Sales book wizard implemented using the osv_memory wizard system36 Sales book wizard implemented using the osv_memory wizard system
38 """37 """
@@ -44,7 +43,7 @@
44 ids = self.pool.get('account.period').search(43 ids = self.pool.get('account.period').search(
45 cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)])44 cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)])
46 if not ids:45 if not ids:
47 raise osv.except_osv(_('Error !'), _('No period defined for this' \46 raise osv.except_osv(_('Error !'), _('No period defined for this'
48 ' date !\nPlease create a fiscal year.'))47 ' date !\nPlease create a fiscal year.'))
49 return ids48 return ids
5049
@@ -88,7 +87,7 @@
88 invoice = [i for i in inv_browse if i.nro_ctrl == control][0]87 invoice = [i for i in inv_browse if i.nro_ctrl == control][0]
89 amount = (invoice.amount_tax * invoice.p_ret) / 10088 amount = (invoice.amount_tax * invoice.p_ret) / 100
90 rp_obj = self.pool.get('res.partner')89 rp_obj = self.pool.get('res.partner')
91 rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id,90 rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id,
92 return (invoice.date_invoice,91 return (invoice.date_invoice,
93 invoice.date_document,92 invoice.date_document,
94 rp_brw.vat,93 rp_brw.vat,
@@ -151,17 +150,17 @@
151150
152 fiscal_book_obj = self.pool.get('fiscal.book')151 fiscal_book_obj = self.pool.get('fiscal.book')
153 fiscal_book_o = fiscal_book_obj.search(cr, uid, [('id', '=', context['active_id'])])152 fiscal_book_o = fiscal_book_obj.search(cr, uid, [('id', '=', context['active_id'])])
154 fiscal_book_o = fiscal_book_obj.browse(cr, uid, fiscal_book_o[0])153 fiscal_book_o = fiscal_book_obj.browse(cr, uid, fiscal_book_o[0])
155 res = super(fiscal_book_wizard, self).default_get(cr, uid, fields, context=context)154 res = super(fiscal_book_wizard, self).default_get(cr, uid, fields, context=context)
156 res.update({'type': fiscal_book_o.type})155 res.update({'type': fiscal_book_o.type})
157 res.update({'date_start': fiscal_book_o.period_id and fiscal_book_o.period_id.date_start or ''})156 res.update({'date_start': fiscal_book_o.period_id and fiscal_book_o.period_id.date_start or ''})
158 res.update({'date_end': fiscal_book_o.period_id and fiscal_book_o.period_id.date_stop or ''})157 res.update({'date_end': fiscal_book_o.period_id and fiscal_book_o.period_id.date_stop or ''})
159 if fiscal_book_o.fortnight == 'first':158 if fiscal_book_o.fortnight == 'first':
160 date_obj = time.strptime(fiscal_book_o.period_id.date_stop,'%Y-%m-%d')159 date_obj = time.strptime(fiscal_book_o.period_id.date_stop, '%Y-%m-%d')
161 res.update({'date_end': "%0004d-%02d-15"%(date_obj.tm_year, date_obj.tm_mon)})160 res.update({'date_end': "%0004d-%02d-15" % (date_obj.tm_year, date_obj.tm_mon)})
162 elif fiscal_book_o.fortnight == 'second':161 elif fiscal_book_o.fortnight == 'second':
163 date_obj = time.strptime(fiscal_book_o.period_id.date_start,'%Y-%m-%d')162 date_obj = time.strptime(fiscal_book_o.period_id.date_start, '%Y-%m-%d')
164 res.update({'date_start': "%0004d-%02d-16"%(date_obj.tm_year, date_obj.tm_mon)})163 res.update({'date_start': "%0004d-%02d-16" % (date_obj.tm_year, date_obj.tm_mon)})
165 return res164 return res
166165
167 def check_report(self, cr, uid, ids, context=None):166 def check_report(self, cr, uid, ids, context=None):
@@ -190,14 +189,12 @@
190 "control_start": fields.integer("Control Start"),189 "control_start": fields.integer("Control Start"),
191 "control_end": fields.integer("Control End"),190 "control_end": fields.integer("Control End"),
192 "type": fields.selection([191 "type": fields.selection([
193 ("sale", _("Sale")),192 ("sale", _("Sale")),
194 ("purchase", _("Purchase")),193 ("purchase", _("Purchase")),
195 ], "Type", required=True,194 ], "Type", required=True,
196 ),195 ),
197 }196 }
198197
199
200
201 _defaults = {198 _defaults = {
202 'date_start': lambda *a: time.strftime('%Y-%m-%d'),199 'date_start': lambda *a: time.strftime('%Y-%m-%d'),
203 'date_end': lambda *a: time.strftime('%Y-%m-%d'),200 'date_end': lambda *a: time.strftime('%Y-%m-%d'),
204201
=== modified file 'l10n_ve_fiscal_requirements/__init__.py'
--- l10n_ve_fiscal_requirements/__init__.py 2012-11-29 21:05:06 +0000
+++ l10n_ve_fiscal_requirements/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -22,6 +22,6 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25import model 25from . import model
26import wizard26from . import wizard
27# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:27# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2828
=== modified file 'l10n_ve_fiscal_requirements/__openerp__.py'
--- l10n_ve_fiscal_requirements/__openerp__.py 2014-04-21 20:00:21 +0000
+++ l10n_ve_fiscal_requirements/__openerp__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -50,7 +50,7 @@
50create the corresponding journal and account.50create the corresponding journal and account.
51TODO : Include this on wizard configuration.51TODO : Include this on wizard configuration.
5252
53If you install this module with invoice data on the database, the concept_id will be 53If you install this module with invoice data on the database, the concept_id will be
54Empty for all those invoices, so, when you try to modify them you have to add a value on54Empty for all those invoices, so, when you try to modify them you have to add a value on
55that field55that field
5656
@@ -65,7 +65,7 @@
65 * Addons-vauxoo: lp:addons-vauxoo/7.065 * Addons-vauxoo: lp:addons-vauxoo/7.0
66""",66""",
67 "depends" : [67 "depends" : [
68 "account", 68 "account",
69 "base_vat",69 "base_vat",
70 "account_accountant",70 "account_accountant",
71 "account_voucher",71 "account_voucher",
7272
=== modified file 'l10n_ve_fiscal_requirements/installer.py'
--- l10n_ve_fiscal_requirements/installer.py 2013-02-13 19:39:18 +0000
+++ l10n_ve_fiscal_requirements/installer.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -23,45 +23,46 @@
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25from openerp.osv import osv, fields25from openerp.osv import osv, fields
26from openerp.tools.translate import _26
2727
28class fiscal_requirements_config(osv.osv_memory):28class fiscal_requirements_config(osv.osv_memory):
29
29 """30 """
30 Fiscal Requirements installer wizard31 Fiscal Requirements installer wizard
31 """32 """
32 _name = 'fiscal.requirements.config'33 _name = 'fiscal.requirements.config'
33 _inherit = 'res.config'34 _inherit = 'res.config'
34 _description= __doc__35 _description = __doc__
3536
36 def onchange_update_rif(self, cr, uid, ids, vat):37 def onchange_update_rif(self, cr, uid, ids, vat):
37 context = {'exec_wizard': True, 'vat': vat}38 context = {'exec_wizard': True, 'vat': vat}
38 39
39 partner_info = self.pool.get('seniat.url').update_rif(cr, uid, ids, context)40 partner_info = self.pool.get('seniat.url').update_rif(cr, uid, ids, context)
40 v = {'name': partner_info.get('name'), 'vat_subjected': partner_info.get('vat_subjected')}41 v = {'name': partner_info.get('name'), 'vat_subjected': partner_info.get('vat_subjected')}
41 return {'value': v}42 return {'value': v}
4243
43 def execute(self, cr, uid, ids, context=None):44 def execute(self, cr, uid, ids, context=None):
44 '''45 '''
45 In this method I will configure all needs for work out of the box with 46 In this method I will configure all needs for work out of the box with
46 fiscal requirement and Venezuela Laws47 fiscal requirement and Venezuela Laws
47 and update all your partners information.48 and update all your partners information.
48 '''49 '''
49 wiz_data = self.browse(cr, uid, ids[0])50 wiz_data = self.browse(cr, uid, ids[0])
50 partner = self.pool.get('res.users').browse(cr, uid, uid).company_id.partner_id51 partner = self.pool.get('res.users').browse(cr, uid, uid).company_id.partner_id
51 #Data on res partner address - Invoice52 # Data on res partner address - Invoice
52 partner and partner.type == 'invoice' and self.pool.get('res.partner').write(cr, uid,[partner.id], {53 partner and partner.type == 'invoice' and self.pool.get('res.partner').write(cr, uid, [partner.id], {
53 'street':wiz_data.add,54 'street': wiz_data.add,
54 'country_id':self.pool.get("res.country").search(cr,uid,[('code','=','VE')])[0],55 'country_id': self.pool.get("res.country").search(cr, uid, [('code', '=', 'VE')])[0],
55 'name': wiz_data.name,56 'name': wiz_data.name,
56 'vat': "VE%s" % wiz_data.vat.upper(),57 'vat': "VE%s" % wiz_data.vat.upper(),
57 'vat_subjected': wiz_data.vat_subjected,58 'vat_subjected': wiz_data.vat_subjected,
58 59
59 })60 })
6061
61 _columns = {62 _columns = {
62 'vat': fields.char('VAT', 16, required=True, help='Partner\'s VAT to update the other fields'),63 'vat': fields.char('VAT', 16, required=True, help='Partner\'s VAT to update the other fields'),
63 'name': fields.char('Name', 64, help="The commercial name of the company"),64 'name': fields.char('Name', 64, help="The commercial name of the company"),
64 'add':fields.char('Invoice Address',64,help='Put Here the address declared on your VAT information on SENIAT',required=True),65 'add': fields.char('Invoice Address', 64, help='Put Here the address declared on your VAT information on SENIAT', required=True),
65 'vat_subjected': fields.boolean("Apply VAT?"),66 'vat_subjected': fields.boolean("Apply VAT?"),
66 }67 }
67fiscal_requirements_config()68fiscal_requirements_config()
6869
=== modified file 'l10n_ve_fiscal_requirements/model/__init__.py'
--- l10n_ve_fiscal_requirements/model/__init__.py 2013-04-26 08:34:02 +0000
+++ l10n_ve_fiscal_requirements/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -22,12 +22,12 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25import res_company25from . import res_company
26import account 26from . import account
27import partner27from . import partner
28import invoice28from . import invoice
29import res_users29from . import res_users
30import seniat_url30from . import seniat_url
31import l10n_ut31from . import l10n_ut
32import account_tax32from . import account_tax
33# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:33# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3434
=== modified file 'l10n_ve_fiscal_requirements/model/account.py'
--- l10n_ve_fiscal_requirements/model/account.py 2013-11-17 22:53:12 +0000
+++ l10n_ve_fiscal_requirements/model/account.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -25,20 +25,21 @@
2525
26from openerp.osv import fields, osv26from openerp.osv import fields, osv
2727
28
28class account_journal(osv.osv):29class account_journal(osv.osv):
29 _inherit = 'account.journal'30 _inherit = 'account.journal'
3031
31 _columns = {32 _columns = {
32'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), 33 'type': fields.selection([('sale', 'Sale'), ('sale_refund', 'Sale Refund'),
33 ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), 34 ('purchase', 'Purchase'), ('purchase_refund', 'Purchase Refund'),
34 ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), 35 ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'),
35 ('situation', 'Opening/Closing Situation'),('sale_debit', 'Sale Debit'), 36 ('situation', 'Opening/Closing Situation'), ('sale_debit', 'Sale Debit'),
36 ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True,37 ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True,
37 help = "Select 'Sale' for customer invoices journals."\38 help="Select 'Sale' for customer invoices journals."
38 " Select 'Purchase' for supplier invoices journals."\39 " Select 'Purchase' for supplier invoices journals."
39 " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\40 " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."
40 " Select 'General' for miscellaneous operations journals."\41 " Select 'General' for miscellaneous operations journals."
41 " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\42 " Select 'Opening/Closing Situation' for entries generated for new fiscal years."
42 " Select 'Sale Debit' for customer debit note journals."\43 " Select 'Sale Debit' for customer debit note journals."
43 " Select 'Purchase Debit' for supplier debit note journals.")44 " Select 'Purchase Debit' for supplier debit note journals.")
44 }45 }
4546
=== modified file 'l10n_ve_fiscal_requirements/model/account_tax.py'
--- l10n_ve_fiscal_requirements/model/account_tax.py 2013-11-21 04:33:16 +0000
+++ l10n_ve_fiscal_requirements/model/account_tax.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -30,12 +30,12 @@
30 _inherit = 'account.tax'30 _inherit = 'account.tax'
31 _columns = {31 _columns = {
32 'appl_type': fields.selection(32 'appl_type': fields.selection(
33 [('exento', 'Exempt'), 33 [('exento', 'Exempt'),
34 ('sdcf', 'Not entitled to tax credit'), 34 ('sdcf', 'Not entitled to tax credit'),
35 ('general', 'General Aliquot'),35 ('general', 'General Aliquot'),
36 ('reducido', 'Reducted Aliquot'),36 ('reducido', 'Reducted Aliquot'),
37 ('adicional', 'General Aliquot + Additional')], 37 ('adicional', 'General Aliquot + Additional')],
38 'Aliquot Type', 38 'Aliquot Type',
39 required=False, 39 required=False,
40 help='Specify the aliquote type for the tax so it can be processed accrordly when the sale/purchase book is generatred'),40 help='Specify the aliquote type for the tax so it can be processed accrordly when the sale/purchase book is generatred'),
41 }41 }
4242
=== modified file 'l10n_ve_fiscal_requirements/model/invoice.py'
--- l10n_ve_fiscal_requirements/model/invoice.py 2014-09-19 16:34:33 +0000
+++ l10n_ve_fiscal_requirements/model/invoice.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -25,45 +25,49 @@
2525
26from openerp.osv import fields, osv26from openerp.osv import fields, osv
27from openerp.tools.translate import _27from openerp.tools.translate import _
28
29
28class account_invoice(osv.osv):30class account_invoice(osv.osv):
2931
30 def _get_journal(self, cr, uid, context=None):32 def _get_journal(self, cr, uid, context=None):
31 """ Return the journal which is 33 """ Return the journal which is
32 used in the current user's company, otherwise34 used in the current user's company, otherwise
33 it does not exist, return false35 it does not exist, return false
34 """36 """
35 37
36 context = context or {}38 context = context or {}
37 res = super(account_invoice, self)._get_journal(cr, uid, context=context)39 res = super(account_invoice, self)._get_journal(cr, uid, context=context)
38 if res: return res40 if res:
41 return res
39 type_inv = context.get('type', 'sale')42 type_inv = context.get('type', 'sale')
40 if type_inv in ('sale_debit', 'purchase_debit'):43 if type_inv in ('sale_debit', 'purchase_debit'):
41 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)44 user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
42 company_id = context.get('company_id', user.company_id.id)45 company_id = context.get('company_id', user.company_id.id)
43 journal_obj = self.pool.get('account.journal')46 journal_obj = self.pool.get('account.journal')
44 domain = [('company_id', '=', company_id),('type', '=',type_inv)]47 domain = [('company_id', '=', company_id), ('type', '=', type_inv)]
45 res = journal_obj.search(cr, uid, domain, limit=1)48 res = journal_obj.search(cr, uid, domain, limit=1)
46 return res and res[0] or False49 return res and res[0] or False
4750
48 def _unique_invoice_per_partner(self, cr, uid, ids, context=None):51 def _unique_invoice_per_partner(self, cr, uid, ids, context=None):
49 """ Return false when it is found 52 """ Return false when it is found
50 that the bill is not out_invoice or out_refund,53 that the bill is not out_invoice or out_refund,
51 and it is not unique to the partner.54 and it is not unique to the partner.
52 """55 """
53 56
54 if context is None: context={}57 if context is None:
58 context = {}
55 inv_brw = self.browse(cr, uid, ids, context=context)59 inv_brw = self.browse(cr, uid, ids, context=context)
56 ids_ivo = []60 ids_ivo = []
57 for inv in inv_brw:61 for inv in inv_brw:
58 ids_ivo.append(inv.id)62 ids_ivo.append(inv.id)
59 if inv.type in ('out_invoice','out_refund'):63 if inv.type in ('out_invoice', 'out_refund'):
60 return True64 return True
61 inv_ids = inv.nro_ctrl is not '' and inv.nro_ctrl is not False and inv.supplier_invoice_number is not False and self.search(cr,uid,65 inv_ids = inv.nro_ctrl is not '' and inv.nro_ctrl is not False and inv.supplier_invoice_number is not False and self.search(cr, uid,
62 ['|',('nro_ctrl','=',inv.nro_ctrl and inv.nro_ctrl.strip() ),('supplier_invoice_number','=',inv.supplier_invoice_number and inv.supplier_invoice_number.strip()),66 ['|', ('nro_ctrl', '=', inv.nro_ctrl and inv.nro_ctrl.strip()), ('supplier_invoice_number', '=', inv.supplier_invoice_number and inv.supplier_invoice_number.strip()),
63 ('type','=',inv.type),67 ('type', '=', inv.type),
64 ('partner_id','=',inv.partner_id.id)],68 ('partner_id', '=', inv.partner_id.id)],
65 context=context) or []69 context=context) or []
66 if [True for i in inv_ids if i not in ids_ivo ] and inv_ids:70 if [True for i in inv_ids if i not in ids_ivo] and inv_ids:
67 return False71 return False
68 return True72 return True
6973
@@ -73,36 +77,35 @@
73 """77 """
74 context = context or {}78 context = context or {}
75 res = True79 res = True
76 ru_brw = self.pool.get('res.users').browse(cr,uid,uid,context=context)80 ru_brw = self.pool.get('res.users').browse(cr, uid, uid, context=context)
77 rc_obj = self.pool.get('res.company')81 rc_obj = self.pool.get('res.company')
78 rc_brw = rc_obj.browse(cr, uid, ru_brw.company_id.id, context=context)82 rc_brw = rc_obj.browse(cr, uid, ru_brw.company_id.id, context=context)
79 83
80 if rc_brw.country_id and rc_brw.country_id.code == 'VE' and rc_brw.printer_fiscal:84 if rc_brw.country_id and rc_brw.country_id.code == 'VE' and rc_brw.printer_fiscal:
81 res = False85 res = False
82 return res86 return res
8387
84 _inherit = 'account.invoice'88 _inherit = 'account.invoice'
85 _columns = {89 _columns = {
86 'nro_ctrl': fields.char('Control Number', size=32, readonly=True, states={'draft':[('readonly',False)]}, help="Number used to manage pre-printed invoices, by law you will need to put here this number to be able to declarate on Fiscal reports correctly."),90 'nro_ctrl': fields.char('Control Number', size=32, readonly=True, states={'draft': [('readonly', False)]}, help="Number used to manage pre-printed invoices, by law you will need to put here this number to be able to declarate on Fiscal reports correctly."),
87 'sin_cred': fields.boolean('Exclude this document from fiscal book',91 'sin_cred': fields.boolean('Exclude this document from fiscal book',
88 readonly=False,92 readonly=False,
89 help="Set it true if the invoice is VAT excempt (Tax Exempt)"),93 help="Set it true if the invoice is VAT excempt (Tax Exempt)"),
90 'date_document': fields.date("Document Date", states={'draft':[('readonly',False)]}, help="Administrative date, generally is the date printed on invoice, this date is used to show in the Purchase Fiscal book", select=True),94 'date_document': fields.date("Document Date", states={'draft': [('readonly', False)]}, help="Administrative date, generally is the date printed on invoice, this date is used to show in the Purchase Fiscal book", select=True),
91 'invoice_printer' : fields.char('Fiscal printer invoice number', size=64, required=False,help="Fiscal printer invoice number, is the number of the invoice on the fiscal printer"),95 'invoice_printer': fields.char('Fiscal printer invoice number', size=64, required=False, help="Fiscal printer invoice number, is the number of the invoice on the fiscal printer"),
92 #TODO": maybe it must be a many2one to declared FiscalPrinter when FiscalV is ready96 # TODO": maybe it must be a many2one to declared FiscalPrinter when FiscalV is ready
93 'fiscal_printer' : fields.char('Fiscal printer number', size=64, required=False,help="Fiscal printer number, generally is the id number of the printer."),97 'fiscal_printer': fields.char('Fiscal printer number', size=64, required=False, help="Fiscal printer number, generally is the id number of the printer."),
94 'loc_req':fields.boolean('Required by Localization', help='This fields is for technical use'),98 'loc_req': fields.boolean('Required by Localization', help='This fields is for technical use'),
95 'z_report': fields.char(string='Report Z', size=64, help=""),99 'z_report': fields.char(string='Report Z', size=64, help=""),
96 }100 }
97101
98 _defaults ={102 _defaults = {
99 'loc_req': _get_loc_req103 'loc_req': _get_loc_req
100 }104 }
101
102105
103 _constraints = [106 _constraints = [
104 (_unique_invoice_per_partner, _('The Document you have been entering for this Partner has already been recorded'),['Control Number (nro_ctrl)','Reference (reference)']),107 (_unique_invoice_per_partner, _('The Document you have been entering for this Partner has already been recorded'), ['Control Number (nro_ctrl)', 'Reference (reference)']),
105 ]108 ]
106109
107 def copy(self, cr, uid, id, default={}, context=None):110 def copy(self, cr, uid, id, default={}, context=None):
108 """ Allows you to duplicate a record,111 """ Allows you to duplicate a record,
@@ -112,33 +115,34 @@
112 if context is None:115 if context is None:
113 context = {}116 context = {}
114 default.update({117 default.update({
115 'nro_ctrl':None,118 'nro_ctrl': None,
116 'supplier_invoice_number':None, 119 'supplier_invoice_number': None,
117 'sin_cred': False,120 'sin_cred': False,
118 # No cleaned in this copy because it is related to the previous121 # No cleaned in this copy because it is related to the previous
119 # document, if previous document says so this too122 # document, if previous document says so this too
120 'date_document': False,123 'date_document': False,
121 'invoice_printer' : '',124 'invoice_printer': '',
122 'fiscal_printer' : '',125 'fiscal_printer': '',
123 # No cleaned in this copy because it is related to the previous126 # No cleaned in this copy because it is related to the previous
124 # document, if previous document says so this too127 # document, if previous document says so this too
125 #'loc_req':False, 128 #'loc_req':False,
126 'z_report': '',129 'z_report': '',
127 })130 })
128 return super(account_invoice, self).copy(cr, uid, id, default, context)131 return super(account_invoice, self).copy(cr, uid, id, default, context)
129132
130 def write(self, cr, uid, ids, vals, context=None):133 def write(self, cr, uid, ids, vals, context=None):
131 context = context or {}134 context = context or {}
132 if vals.get('type') in ('out_invoice','out_refund') and \135 if vals.get('type') in ('out_invoice', 'out_refund') and \
133 vals.get('date_invoice') and not vals.get('date_document'):136 vals.get('date_invoice') and not vals.get('date_document'):
134 vals['date_document']=vals['date_invoice']137 vals['date_document'] = vals['date_invoice']
135 return super(account_invoice, self).write(cr, uid, ids, vals,138 return super(account_invoice, self).write(cr, uid, ids, vals,
136 context=context)139 context=context)
140
137141
138class account_invoice_tax(osv.osv):142class account_invoice_tax(osv.osv):
139 _inherit = 'account.invoice.tax'143 _inherit = 'account.invoice.tax'
140 _columns = {144 _columns = {
141 'tax_id': fields.many2one('account.tax', 'Tax', required=False, ondelete='set null', 145 'tax_id': fields.many2one('account.tax', 'Tax', required=False, ondelete='set null',
142 help="Tax relation to original tax, to be able to take off all data from invoices."),146 help="Tax relation to original tax, to be able to take off all data from invoices."),
143 }147 }
144148
145149
=== modified file 'l10n_ve_fiscal_requirements/model/l10n_ut.py'
--- l10n_ve_fiscal_requirements/model/l10n_ut.py 2014-09-24 04:18:40 +0000
+++ l10n_ve_fiscal_requirements/model/l10n_ut.py 2014-10-11 00:06:17 +0000
@@ -24,8 +24,6 @@
24# along with this program. If not, see <http://www.gnu.org/licenses/>.24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25##############################################################################25##############################################################################
26from openerp.osv import osv, fields26from openerp.osv import osv, fields
27from openerp.tools import config
28from openerp.tools.translate import _
29import time27import time
30from openerp.addons import decimal_precision as dp28from openerp.addons import decimal_precision as dp
3129
@@ -46,7 +44,7 @@
46 help="Amount of the tax unit in bs", required=True),44 help="Amount of the tax unit in bs", required=True),
47 'user_id': fields.many2one('res.users', 'Salesman',45 'user_id': fields.many2one('res.users', 'Salesman',
48 readonly=True, states={'draft': [('readonly', False)]},46 readonly=True, states={'draft': [('readonly', False)]},
49 help="Vendor user"),47 help="Vendor user"),
50 }48 }
51 _defaults = {49 _defaults = {
52 'name': lambda *a: None,50 'name': lambda *a: None,
5351
=== modified file 'l10n_ve_fiscal_requirements/model/partner.py'
--- l10n_ve_fiscal_requirements/model/partner.py 2014-09-04 19:22:17 +0000
+++ l10n_ve_fiscal_requirements/model/partner.py 2014-10-11 00:06:17 +0000
@@ -1,12 +1,12 @@
1# -*- coding: utf-8 -*-1# -*- coding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# 4#
5# Programmed by: Alexander Olivares <olivaresa@gmail.com>5# Programmed by: Alexander Olivares <olivaresa@gmail.com>
6#6#
7# This the script to connect with Seniat website 7# This the script to connect with Seniat website
8# for consult the rif asociated with a partner was taken from:8# for consult the rif asociated with a partner was taken from:
9# 9#
10# http://siv.cenditel.gob.ve/svn/sigesic/ramas/sigesic-1.1.x/sigesic/apps/comun/seniat.py10# http://siv.cenditel.gob.ve/svn/sigesic/ramas/sigesic-1.1.x/sigesic/apps/comun/seniat.py
11#11#
12# This script was modify by:12# This script was modify by:
@@ -38,6 +38,7 @@
38from openerp.addons import decimal_precision as dp38from openerp.addons import decimal_precision as dp
39import re39import re
4040
41
41class res_partner(osv.osv):42class res_partner(osv.osv):
42 _inherit = 'res.partner'43 _inherit = 'res.partner'
4344
@@ -47,14 +48,14 @@
47 context = context or {}48 context = context or {}
48 user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id49 user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
49 return user_company.partner_id and user_company.partner_id.country_id \50 return user_company.partner_id and user_company.partner_id.country_id \
50 and user_company.partner_id.country_id.code or 'XX'51 and user_company.partner_id.country_id.code or 'XX'
5152
52 def default_get(self, cr, uid, fields, context=None):53 def default_get(self, cr, uid, fields, context=None):
53 """ Load the country code of the user company to form to be created.54 """ Load the country code of the user company to form to be created.
54 """55 """
55 context = context or {}56 context = context or {}
56 res = super(res_partner, self).default_get(cr, uid, fields, context=context)57 res = super(res_partner, self).default_get(cr, uid, fields, context=context)
57 res.update({'uid_country': self._get_country_code(cr,uid,context=context)})58 res.update({'uid_country': self._get_country_code(cr, uid, context=context)})
58 return res59 return res
5960
60 def _get_uid_country(self, cr, uid, ids, field_name, args, context=None):61 def _get_uid_country(self, cr, uid, ids, field_name, args, context=None):
@@ -62,9 +63,9 @@
62 of the user company.63 of the user company.
63 """64 """
64 context = context or {}65 context = context or {}
65 res= {}.fromkeys(ids,self._get_country_code(cr,uid,context=context))66 res = {}.fromkeys(ids, self._get_country_code(cr, uid, context=context))
66 return res67 return res
67 68
68 _columns = {69 _columns = {
69 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),70 'seniat_updated': fields.boolean('Seniat Updated', help="This field indicates if partner was updated using SENIAT button"),
70 'uid_country': fields.function(_get_uid_country, type='char', string="uid_country", size=20, help="country code of the current company"),71 'uid_country': fields.function(_get_uid_country, type='char', string="uid_country", size=20, help="country code of the current company"),
@@ -72,57 +73,59 @@
72 string='Rate',73 string='Rate',
73 digits_compute=dp.get_precision('Withhold'),74 digits_compute=dp.get_precision('Withhold'),
74 help="Vat Withholding rate"),75 help="Vat Withholding rate"),
75 'wh_iva_agent': fields.boolean('Wh. Agent', 76 'wh_iva_agent': fields.boolean('Wh. Agent',
76 help="Indicate if the partner is a withholding vat agent"),77 help="Indicate if the partner is a withholding vat agent"),
77 }78 }
78 79
79 _default = {80 _default = {
80 'seniat_updated': False,81 'seniat_updated': False,
81 }82 }
8283
83 def name_search(self,cr,uid,name='',args=[],operator='ilike',context=None,limit=80):84 def name_search(self, cr, uid, name='', args=[], operator='ilike', context=None, limit=80):
84 """ Gets el id of the partner with the vat or the name and return the name85 """ Gets el id of the partner with the vat or the name and return the name
85 """86 """
86 if context is None: 87 if context is None:
87 context={}88 context = {}
88 ids= []89 ids = []
89 if len(name) >= 2:90 if len(name) >= 2:
90 ids = self.search(cr, uid, [('vat',operator,name)] + args, limit=limit, context=context)91 ids = self.search(cr, uid, [('vat', operator, name)] + args, limit=limit, context=context)
91 if not ids:92 if not ids:
92 ids = self.search(cr,uid,[('name',operator,name)] + args, limit=limit, context=context)93 ids = self.search(cr, uid, [('name', operator, name)] + args, limit=limit, context=context)
93 return self.name_get(cr,uid,ids,context=context)94 return self.name_get(cr, uid, ids, context=context)
94 95
95 '''96 '''
96 Required Invoice Address97 Required Invoice Address
97 '''98 '''
98 def _check_partner_invoice_addr(self,cr,uid,ids,context={}):99
100 def _check_partner_invoice_addr(self, cr, uid, ids, context={}):
99 """ Return true if the partner is a company of Venezuela and if the101 """ Return true if the partner is a company of Venezuela and if the
100 address is for billing.102 address is for billing.
101 """103 """
102 partner_obj = self.browse(cr,uid,ids[0])104 partner_obj = self.browse(cr, uid, ids[0])
103 if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id:105 if partner_obj.vat and partner_obj.vat[:2].upper() == 'VE' and not partner_obj.parent_id:
104 res = partner_obj.type == 'invoice'106 res = partner_obj.type == 'invoice'
105 if res:107 if res:
106 return True
107 else:
108 return False
109 else:
110 return True108 return True
109 else:
110 return False
111 else:
112 return True
111 return True113 return True
112114
113 def _check_vat_uniqueness(self, cr, uid, ids, context=None):115 def _check_vat_uniqueness(self, cr, uid, ids, context=None):
114 """ Check that the vat is unique in the level where the partner in the tree116 """ Check that the vat is unique in the level where the partner in the tree
115 """117 """
116 if context is None: context = {}118 if context is None:
117 119 context = {}
120
118 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id121 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
119 acc_part_brw = self._find_accounting_partner(user_company.partner_id)122 acc_part_brw = self._find_accounting_partner(user_company.partner_id)
120 123
121 #User must be of VE 124 # User must be of VE
122 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':125 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':
123 return True126 return True
124 127
125 for rp_brw in self.browse(cr, uid,ids):128 for rp_brw in self.browse(cr, uid, ids):
126 acc_part_brw = self._find_accounting_partner(rp_brw)129 acc_part_brw = self._find_accounting_partner(rp_brw)
127 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':130 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':
128 continue131 continue
@@ -131,39 +134,41 @@
131 if rp_brw.id == acc_part_brw.id and not acc_part_brw.vat:134 if rp_brw.id == acc_part_brw.id and not acc_part_brw.vat:
132 return False135 return False
133 elif rp_brw.id == acc_part_brw.id and acc_part_brw.vat:136 elif rp_brw.id == acc_part_brw.id and acc_part_brw.vat:
134 duplicates = self.search(cr, uid, [ ('vat', '=', rp_brw.vat), ('parent_id','=',False), ('id','!=',rp_brw.id) ])137 duplicates = self.search(cr, uid, [('vat', '=', rp_brw.vat), ('parent_id', '=', False), ('id', '!=', rp_brw.id)])
135 if duplicates: return False138 if duplicates:
139 return False
136 continue140 continue
137 return True 141 return True
138142
139 def _check_vat_mandatory(self, cr, uid, ids, context=None):143 def _check_vat_mandatory(self, cr, uid, ids, context=None):
140 """ This method will check the vat mandatoriness in partners144 """ This method will check the vat mandatoriness in partners
141 for those user logged on with a Venezuelan Company145 for those user logged on with a Venezuelan Company
142 146
143 The method will return True when:147 The method will return True when:
144 *) The user's company is not from Venezuela148 *) The user's company is not from Venezuela
145 *) The partner being created is the one for the a company being created [TODO]149 *) The partner being created is the one for the a company being created [TODO]
146 150
147 The method will return False when:151 The method will return False when:
148 *) The user's company is from Venezuela AND the vat field is empty AND:152 *) The user's company is from Venezuela AND the vat field is empty AND:
149 +) partner is_company=True AND parent_id is not NULL153 +) partner is_company=True AND parent_id is not NULL
150 +) partner with parent_id is NULL 154 +) partner with parent_id is NULL
151 +) partner with parent_id is NOT NULL AND type of address is invoice 155 +) partner with parent_id is NOT NULL AND type of address is invoice
152 """156 """
153 if context is None: context = {}157 if context is None:
158 context = {}
154 # Avoiding Egg-Chicken Syndrome159 # Avoiding Egg-Chicken Syndrome
155 # TODO: Refine this approach this is big exception160 # TODO: Refine this approach this is big exception
156 # One that can be handle by end user, I hope so!!!161 # One that can be handle by end user, I hope so!!!
157 if context.get('create_company',False):162 if context.get('create_company', False):
158 return True163 return True
159 164
160 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id165 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
161 acc_part_brw = self._find_accounting_partner(user_company.partner_id)166 acc_part_brw = self._find_accounting_partner(user_company.partner_id)
162 #Check if the user is not from a VE Company167 # Check if the user is not from a VE Company
163 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':168 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':
164 return True169 return True
165 170
166 for rp_brw in self.browse(cr, uid,ids):171 for rp_brw in self.browse(cr, uid, ids):
167 acc_part_brw = self._find_accounting_partner(rp_brw)172 acc_part_brw = self._find_accounting_partner(rp_brw)
168 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':173 if acc_part_brw.country_id and acc_part_brw.country_id.code != 'VE':
169 continue174 continue
@@ -176,11 +181,11 @@
176 def _validate(self, cr, uid, ids, context=None):181 def _validate(self, cr, uid, ids, context=None):
177 """ Validates the fields182 """ Validates the fields
178 """183 """
179 184
180 #In the original orm.py openerp does not allow using185 # In the original orm.py openerp does not allow using
181 #context within the constraint because we have to yield 186 # context within the constraint because we have to yield
182 # the same result always,187 # the same result always,
183 # we have overridden this behaviour 188 # we have overridden this behaviour
184 # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER189 # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER
185 context = context or {}190 context = context or {}
186 lng = context.get('lang')191 lng = context.get('lang')
@@ -203,7 +208,7 @@
203 else:208 else:
204 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)209 translated_msg = trans._get_source(cr, uid, self._name, 'constraint', lng, msg)
205 error_msgs.append(210 error_msgs.append(
206 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)211 _("Error occurred while validating the field(s) %s: %s") % (','.join(fields), translated_msg)
207 )212 )
208 self._invalids.update(fields)213 self._invalids.update(fields)
209 if error_msgs:214 if error_msgs:
@@ -216,34 +221,34 @@
216 (_check_vat_uniqueness, _("Error ! Partner's VAT must be a unique value or empty"), []),221 (_check_vat_uniqueness, _("Error ! Partner's VAT must be a unique value or empty"), []),
217 #~ (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),222 #~ (_check_partner_invoice_addr, _('Error ! The partner does not have an invoice address.'), []),
218 ]223 ]
219 224
220 def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None):225 def vat_change_fiscal_requirements(self, cr, uid, ids, value, context=None):
221 """ Checks the syntax of the vat226 """ Checks the syntax of the vat
222 """227 """
223 if context is None:228 if context is None:
224 context={}229 context = {}
225 if not value:230 if not value:
226 return super(res_partner,self).vat_change(cr, uid, ids, value, context=context)231 return super(res_partner, self).vat_change(cr, uid, ids, value, context=context)
227 res = self.search(cr, uid, [('vat', 'ilike', value)])232 res = self.search(cr, uid, [('vat', 'ilike', value)])
228 if res:233 if res:
229 rp = self.browse(cr, uid, res[0],context=context)234 rp = self.browse(cr, uid, res[0], context=context)
230 return {'warning': {235 return {'warning': {
231 'title':_('Vat Error !'),236 'title': _('Vat Error !'),
232 'message':_('The VAT [%s] looks like '%value + 237 'message': _('The VAT [%s] looks like ' % value +
233 '[%s] which is'%rp.vat.upper()+238 '[%s] which is' % rp.vat.upper() +
234 ' already being used by: %s'%rp.name.upper())239 ' already being used by: %s' % rp.name.upper())
235 }240 }
236 }241 }
237 else:242 else:
238 return super(res_partner,self).vat_change(cr, uid, ids, value, context=context)243 return super(res_partner, self).vat_change(cr, uid, ids, value, context=context)
239244
240 def check_vat_ve(self, vat, context = None):245 def check_vat_ve(self, vat, context=None):
241 """ Check Venezuelan VAT number, locally called RIF.246 """ Check Venezuelan VAT number, locally called RIF.
242 RIF: JXXXXXXXXX RIF VENEZOLAN IDENTIFICATION CARD: VXXXXXXXXX FOREIGN IDENTIFICATION CARD: EXXXXXXXXX247 RIF: JXXXXXXXXX RIF VENEZOLAN IDENTIFICATION CARD: VXXXXXXXXX FOREIGN IDENTIFICATION CARD: EXXXXXXXXX
243 """248 """
244249
245 if context is None:250 if context is None:
246 context={}251 context = {}
247 if re.search(r'^[VJEGP][0-9]{9}$', vat):252 if re.search(r'^[VJEGP][0-9]{9}$', vat):
248 return True253 return True
249 if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):254 if re.search(r'^([VE][0-9]{1,8}|[D][0-9]{9})$', vat):
@@ -255,10 +260,10 @@
255 Validate against VAT Information Exchange System (VIES)260 Validate against VAT Information Exchange System (VIES)
256 """261 """
257 if country_code.upper() != "VE":262 if country_code.upper() != "VE":
258 return super(res_partner, self).vies_vat_check(cr, uid, country_code, vat_number,context=context)263 return super(res_partner, self).vies_vat_check(cr, uid, country_code, vat_number, context=context)
259 else:264 else:
260 return super(res_partner, self).simple_vat_check(cr, uid, country_code, vat_number, context=context)265 return super(res_partner, self).simple_vat_check(cr, uid, country_code, vat_number, context=context)
261 266
262 def update_rif(self, cr, uid, ids, context=None):267 def update_rif(self, cr, uid, ids, context=None):
263 """ Load the rif and name of the partner from the database seniat268 """ Load the rif and name of the partner from the database seniat
264 """269 """
@@ -268,11 +273,12 @@
268 return su_obj.update_rif(cr, uid, ids, context=context)273 return su_obj.update_rif(cr, uid, ids, context=context)
269274
270 def button_check_vat(self, cr, uid, ids, context=None):275 def button_check_vat(self, cr, uid, ids, context=None):
271 """ Is called by the button that load information of the partner from database 276 """ Is called by the button that load information of the partner from database
272 SENIAT277 SENIAT
273 """278 """
274 if context is None: context = {}279 if context is None:
275 context.update({'update_fiscal_information':True})280 context = {}
281 context.update({'update_fiscal_information': True})
276 super(res_partner, self).check_vat(cr, uid, ids, context=context)282 super(res_partner, self).check_vat(cr, uid, ids, context=context)
277 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id283 user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id
278 if user_company.vat_check_vies:284 if user_company.vat_check_vies:
279285
=== modified file 'l10n_ve_fiscal_requirements/model/res_company.py'
--- l10n_ve_fiscal_requirements/model/res_company.py 2013-04-26 23:55:44 +0000
+++ l10n_ve_fiscal_requirements/model/res_company.py 2014-10-11 00:06:17 +0000
@@ -26,9 +26,6 @@
26##############################################################################26##############################################################################
2727
28from openerp.osv import fields, osv28from openerp.osv import fields, osv
29import openerp.tools
30from openerp.tools.translate import _
31from openerp.tools import config
3229
3330
34class res_company(osv.osv):31class res_company(osv.osv):
@@ -36,8 +33,8 @@
36 _columns = {33 _columns = {
37 'jour_id': fields.many2one('account.journal', 'Journal', required=False, help="Default journal for damaged invoices"),34 'jour_id': fields.many2one('account.journal', 'Journal', required=False, help="Default journal for damaged invoices"),
38 'acc_id': fields.many2one('account.account', 'Account', required=False, help="Default account used for invoices and lines from damaged invoices"),35 'acc_id': fields.many2one('account.account', 'Account', required=False, help="Default account used for invoices and lines from damaged invoices"),
39 'printer_fiscal' : fields.boolean('Manages fiscal printer', help='Indicates that the company can operate a fiscal printer'),36 'printer_fiscal': fields.boolean('Manages fiscal printer', help='Indicates that the company can operate a fiscal printer'),
40 }37 }
4138
42 def create(self, cr, uid, vals, context=None):39 def create(self, cr, uid, vals, context=None):
43 """ To create a new record,40 """ To create a new record,
4441
=== modified file 'l10n_ve_fiscal_requirements/model/res_users.py'
--- l10n_ve_fiscal_requirements/model/res_users.py 2013-04-10 17:33:44 +0000
+++ l10n_ve_fiscal_requirements/model/res_users.py 2014-10-11 00:06:17 +0000
@@ -26,30 +26,29 @@
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
2828
29from openerp.osv import fields, osv29from openerp.osv import osv
30import openerp.tools30
31from openerp.tools.translate import _
32from openerp.tools import config
3331
34class res_users(osv.osv):32class res_users(osv.osv):
35 _inherit = 'res.users'33 _inherit = 'res.users'
36 34
37 def create(self, cr, uid, vals, context=None):35 def create(self, cr, uid, vals, context=None):
38 """ To create a new record,36 """ To create a new record,
39 adds a Boolean field to true 37 adds a Boolean field to true
40 indicates that the partner is a company38 indicates that the partner is a company
41 """39 """
42 if context is None: context = {}40 if context is None:
43 context.update({'create_company':True})41 context = {}
42 context.update({'create_company': True})
44 return super(res_users, self).create(cr, uid, vals, context=context)43 return super(res_users, self).create(cr, uid, vals, context=context)
45 44
46 def write(self, cr, uid, ids, values, context=None):45 def write(self, cr, uid, ids, values, context=None):
47 """ To write a new record,46 """ To write a new record,
48 adds a Boolean field to true 47 adds a Boolean field to true
49 indicates that the partner is a company48 indicates that the partner is a company
50 """49 """
51 context = context or {}50 context = context or {}
52 context.update({'create_company':True})51 context.update({'create_company': True})
53 return super(res_users, self).write(cr, uid, ids, values, context=context)52 return super(res_users, self).write(cr, uid, ids, values, context=context)
5453
55res_users()54res_users()
5655
=== modified file 'l10n_ve_fiscal_requirements/model/seniat_url.py'
--- l10n_ve_fiscal_requirements/model/seniat_url.py 2013-12-17 02:32:33 +0000
+++ l10n_ve_fiscal_requirements/model/seniat_url.py 2014-10-11 00:06:17 +0000
@@ -23,9 +23,7 @@
23##########################################################################23##########################################################################
2424
25from openerp.osv import fields, osv25from openerp.osv import fields, osv
26import openerp.tools
27from openerp.tools.translate import _26from openerp.tools.translate import _
28from openerp.tools import config
29import urllib27import urllib
30from xml.dom.minidom import parseString28from xml.dom.minidom import parseString
31import re29import re
@@ -33,6 +31,7 @@
3331
3432
35class seniat_url(osv.osv):33class seniat_url(osv.osv):
34
36 """ OpenERP Model : seniat_url35 """ OpenERP Model : seniat_url
37 """36 """
38 _name = 'seniat.url'37 _name = 'seniat.url'
@@ -54,32 +53,32 @@
54 }53 }
5554
56 # Update Partner Information55 # Update Partner Information
57 56
58 def _get_valid_digit(self, cr, uid,vat, context=None):57 def _get_valid_digit(self, cr, uid, vat, context=None):
59 '''58 '''
60 @param vat: string59 @param vat: string
61 returns validating digit60 returns validating digit
62 '''61 '''
63 divisor = 1162 divisor = 11
64 vat_type = {'V':1, 'E':2, 'J':3, 'P':4, 'G':5} 63 vat_type = {'V': 1, 'E': 2, 'J': 3, 'P': 4, 'G': 5}
65 mapper = {1:3, 2:2, 3:7, 4:6, 5:5, 6:4, 7:3, 8:2}64 mapper = {1: 3, 2: 2, 3: 7, 4: 6, 5: 5, 6: 4, 7: 3, 8: 2}
66 valid_digit = None65 valid_digit = None
6766
68 vat_type = vat_type.get(vat[0].upper())67 vat_type = vat_type.get(vat[0].upper())
69 if vat_type:68 if vat_type:
70 sum = vat_type * 469 sum = vat_type * 4
71 for i in range(8):70 for i in range(8):
72 sum += int(vat[i+1]) * mapper[i+1]71 sum += int(vat[i + 1]) * mapper[i + 1]
7372
74 valid_digit = divisor - sum%divisor73 valid_digit = divisor - sum % divisor
75 if valid_digit >= 10:74 if valid_digit >= 10:
76 valid_digit = 075 valid_digit = 0
77 return valid_digit 76 return valid_digit
7877
79 def _validate_rif(self, cr, uid,vat, context=None):78 def _validate_rif(self, cr, uid, vat, context=None):
80 '''validates if the VE VAT NUMBER is right 79 '''validates if the VE VAT NUMBER is right
81 @param vat: string: Vat number to Check80 @param vat: string: Vat number to Check
82 returns vat when right otherwise returns False 81 returns vat when right otherwise returns False
8382
84 '''83 '''
85 if not vat:84 if not vat:
@@ -89,17 +88,17 @@
89 vat = vat[2:]88 vat = vat[2:]
9089
91 if re.search(r'^[VJEGP][0-9]{9}$', vat):90 if re.search(r'^[VJEGP][0-9]{9}$', vat):
92 valid_digit = self._get_valid_digit(cr, uid,vat,91 valid_digit = self._get_valid_digit(cr, uid, vat,
93 context=context)92 context=context)
94 if valid_digit is None:93 if valid_digit is None:
95 return False94 return False
96 if int(vat[9])==valid_digit:95 if int(vat[9]) == valid_digit:
97 return vat96 return vat
98 else:97 else:
99 self._print_error(_('Vat Error !'), _('Invalid VAT!'))98 self._print_error(_('Vat Error !'), _('Invalid VAT!'))
100 elif re.search(r'^([VE][0-9]{1,8})$', vat):99 elif re.search(r'^([VE][0-9]{1,8})$', vat):
101 vat = vat[0] + vat[1:].rjust(8, '0')100 vat = vat[0] + vat[1:].rjust(8, '0')
102 valid_digit = self._get_valid_digit(cr, uid,vat,101 valid_digit = self._get_valid_digit(cr, uid, vat,
103 context=context)102 context=context)
104 vat += str(valid_digit)103 vat += str(valid_digit)
105 return vat104 return vat
@@ -119,7 +118,6 @@
119 return r118 return r
120 except:119 except:
121 self.logger.warning("Url could not be loaded %s" % str_error)120 self.logger.warning("Url could not be loaded %s" % str_error)
122 pass
123 retries -= 1121 retries -= 1
124 return str_error122 return str_error
125123
@@ -169,7 +167,7 @@
169 else:167 else:
170 return False168 return False
171169
172 def _get_rif(self, cr, uid, vat, url1, url2, context=None):170 def _get_rif(self, cr, uid, vat, url1, url2, context=None):
173 """ Partner information transforms XML to string and returns.171 """ Partner information transforms XML to string and returns.
174 """172 """
175 if context is None:173 if context is None:
@@ -179,7 +177,7 @@
179 if not self._eval_seniat_data(xml_data, vat, context=context):177 if not self._eval_seniat_data(xml_data, vat, context=context):
180 dom = parseString(xml_data)178 dom = parseString(xml_data)
181 return self._parse_dom(cr, uid, dom, vat, url2, context=context)179 return self._parse_dom(cr, uid, dom, vat, url2, context=context)
182 180
183 def check_rif(self, cr, uid, vat, context=None):181 def check_rif(self, cr, uid, vat, context=None):
184 context = context or {}182 context = context or {}
185 return self._dom_giver(cr, uid, vat, context=context)183 return self._dom_giver(cr, uid, vat, context=context)
@@ -195,13 +193,12 @@
195 url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]193 url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0]
196 url1 = url_obj.name + '%s'194 url1 = url_obj.name + '%s'
197 url2 = url_obj.url_seniat + '%s'195 url2 = url_obj.url_seniat + '%s'
198 url3 = url_obj.url_seniat2 + '%s'196 vat = self._validate_rif(cr, uid, vat, context=None)
199 vat = self._validate_rif(cr, uid,vat,context=None)
200 if vat:197 if vat:
201 return self._get_rif(cr, uid, vat, url1, url2, context=context)198 return self._get_rif(cr, uid, vat, url1, url2, context=context)
202 else:199 else:
203 return False200 return False
204 201
205 def _update_partner(self, cr, uid, id, context=None):202 def _update_partner(self, cr, uid, id, context=None):
206 """ Indicates that the partner was updated with information provided by seniat203 """ Indicates that the partner was updated with information provided by seniat
207 """204 """
@@ -211,7 +208,6 @@
211 def update_rif(self, cr, uid, ids, context={}):208 def update_rif(self, cr, uid, ids, context={}):
212 """ Updates the partner info if it have a vat209 """ Updates the partner info if it have a vat
213 """210 """
214 aux = []
215 rp_obj = self.pool.get('res.partner')211 rp_obj = self.pool.get('res.partner')
216 if context.get('exec_wizard'):212 if context.get('exec_wizard'):
217 res = self._dom_giver(cr, uid, context['vat'], context=context)213 res = self._dom_giver(cr, uid, context['vat'], context=context)
218214
=== modified file 'l10n_ve_fiscal_requirements/wizard/__init__.py'
--- l10n_ve_fiscal_requirements/wizard/__init__.py 2014-01-20 13:03:50 +0000
+++ l10n_ve_fiscal_requirements/wizard/__init__.py 2014-10-11 00:06:17 +0000
@@ -23,11 +23,11 @@
23# You should have received a copy of the GNU Affero General Public License23# You should have received a copy of the GNU Affero General Public License
24# along with this program. If not, see <http://www.gnu.org/licenses/>.24# along with this program. If not, see <http://www.gnu.org/licenses/>.
25##############################################################################25##############################################################################
26import wizard_nro_ctrl26from . import wizard_nro_ctrl
27import wizard_invoice_nro_ctrl27from . import wizard_invoice_nro_ctrl
28import wizard_url_seniat28from . import wizard_url_seniat
29import wizard_update_name29from . import wizard_update_name
30import update_info_partner30from . import update_info_partner
31import account_invoice_refund31from . import account_invoice_refund
32import account_invoice_debit32from . import account_invoice_debit
33import search_info_partner_seniat33from . import search_info_partner_seniat
3434
=== modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py'
--- l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2013-05-10 17:56:25 +0000
+++ l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2014-10-11 00:06:17 +0000
@@ -25,6 +25,7 @@
25from openerp.tools.translate import _25from openerp.tools.translate import _
26from openerp import netsvc26from openerp import netsvc
2727
28
28class account_invoice_debit(osv.osv_memory):29class account_invoice_debit(osv.osv_memory):
2930
30 """Debits Note from Invoice"""31 """Debits Note from Invoice"""
@@ -32,11 +33,11 @@
32 _name = "account.invoice.debit"33 _name = "account.invoice.debit"
33 _description = "Invoice Debit Note"34 _description = "Invoice Debit Note"
34 _columns = {35 _columns = {
35 'date': fields.date('Operation date', help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'),36 'date': fields.date('Operation date', help='This date will be used as the invoice date for Refund Invoice and Period will be chosen accordingly!'),
36 'period': fields.many2one('account.period', 'Force period', help='Fiscal period to assign to the invoice. Keep empty to use the period of the current date.'),37 'period': fields.many2one('account.period', 'Force period', help='Fiscal period to assign to the invoice. Keep empty to use the period of the current date.'),
37 'journal_id': fields.many2one('account.journal', 'Debits Journal', help='You can select here the journal to use for the debit note that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),38 'journal_id': fields.many2one('account.journal', 'Debits Journal', help='You can select here the journal to use for the debit note that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),
38 'description': fields.char('Description', size=128, required=True, help='Name or reference of the invoice'),39 'description': fields.char('Description', size=128, required=True, help='Name or reference of the invoice'),
39 'comment': fields.text('Comment', required=True, help='Additional Information'),40 'comment': fields.text('Comment', required=True, help='Additional Information'),
40 }41 }
4142
42 def _get_journal(self, cr, uid, context=None):43 def _get_journal(self, cr, uid, context=None):
@@ -49,11 +50,11 @@
49 company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id50 company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id
50 company_id = context.get('company_id', company_id)51 company_id = context.get('company_id', company_id)
51 if context.get('type', False) in ('out_invoice', 'out_refund'):52 if context.get('type', False) in ('out_invoice', 'out_refund'):
52 journal = obj_journal.search(cr, uid, [('type', '=', 'sale_debit'),('company_id','=',company_id)])53 journal = obj_journal.search(cr, uid, [('type', '=', 'sale_debit'), ('company_id', '=', company_id)])
53 elif context.get('type', False) in ('in_invoice', 'in_refund'):54 elif context.get('type', False) in ('in_invoice', 'in_refund'):
54 journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_debit'),('company_id','=',company_id)])55 journal = obj_journal.search(cr, uid, [('type', '=', 'purchase_debit'), ('company_id', '=', company_id)])
55 if not journal:56 if not journal:
56 raise osv.except_osv(_('No Debit Journal !'),_("You must define a debit journal")) 57 raise osv.except_osv(_('No Debit Journal !'), _("You must define a debit journal"))
57 return journal[0]58 return journal[0]
5859
59 _defaults = {60 _defaults = {
@@ -63,14 +64,14 @@
63 }64 }
6465
65 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):66 def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
66 """ Change fields position in the view 67 """ Change fields position in the view
67 """68 """
68 if context is None:69 if context is None:
69 context = {}70 context = {}
70 71
71 journal_obj = self.pool.get('account.journal')72 journal_obj = self.pool.get('account.journal')
72 res = super(account_invoice_debit,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)73 res = super(account_invoice_debit, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
73 #Debit note only from customer o purchase invoice74 # Debit note only from customer o purchase invoice
74 #type = context.get('journal_type', 'sale_refund')75 #type = context.get('journal_type', 'sale_refund')
75 type = context.get('journal_type', 'sale')76 type = context.get('journal_type', 'sale')
76 if type in ('sale', 'sale_refund'):77 if type in ('sale', 'sale_refund'):
@@ -81,7 +82,7 @@
81 company_id = context.get('company_id', company_id)82 company_id = context.get('company_id', company_id)
82 for field in res['fields']:83 for field in res['fields']:
83 if field == 'journal_id':84 if field == 'journal_id':
84 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type),('company_id','=',company_id)], context=context, limit=None, name_get_uid=1)85 journal_select = journal_obj._name_search(cr, uid, '', [('type', '=', type), ('company_id', '=', company_id)], context=context, limit=None, name_get_uid=1)
85 res['fields'][field]['selection'] = journal_select86 res['fields'][field]['selection'] = journal_select
86 return res87 return res
8788
@@ -93,7 +94,7 @@
93 nro_ref = ref94 nro_ref = ref
94 if inv.type == 'out_invoice':95 if inv.type == 'out_invoice':
95 nro_ref = inv.number96 nro_ref = inv.number
96 orig = 'FACT:' +(nro_ref or '') + '- DE FECHA:' + (inv.date_invoice or '') + (' TOTAL:' + str(inv.amount_total) or '')97 orig = 'FACT:' + (nro_ref or '') + '- DE FECHA:' + (inv.date_invoice or '') + (' TOTAL:' + str(inv.amount_total) or '')
97 return orig98 return orig
9899
99 def compute_debit(self, cr, uid, ids, context=None):100 def compute_debit(self, cr, uid, ids, context=None):
@@ -103,29 +104,23 @@
103 @param ids: The account invoice refund’s ID or list of IDs104 @param ids: The account invoice refund’s ID or list of IDs
104 """105 """
105 inv_obj = self.pool.get('account.invoice')106 inv_obj = self.pool.get('account.invoice')
106 reconcile_obj = self.pool.get('account.move.reconcile')
107 account_m_line_obj = self.pool.get('account.move.line')
108 mod_obj = self.pool.get('ir.model.data')107 mod_obj = self.pool.get('ir.model.data')
109 act_obj = self.pool.get('ir.actions.act_window')108 act_obj = self.pool.get('ir.actions.act_window')
110 wf_service = netsvc.LocalService('workflow')
111 inv_tax_obj = self.pool.get('account.invoice.tax')
112 inv_line_obj = self.pool.get('account.invoice.line')
113 res_users_obj = self.pool.get('res.users')
114 if context is None:109 if context is None:
115 context = {}110 context = {}
116111
117 form = self.browse(cr, uid, ids[0], context = context)112 form = self.browse(cr, uid, ids[0], context=context)
118 created_inv = []113 created_inv = []
119 date = False114 date = False
120 period = False115 period = False
121 description = False116 description = False
122117
123 journal_id = form.journal_id and form.journal_id.id or False118 journal_id = form.journal_id and form.journal_id.id or False
124 inv = inv_obj.browse(cr, uid, context.get('active_ids')[0], context=context)119 inv = inv_obj.browse(cr, uid, context.get('active_ids')[0], context=context)
125 #~ TODOK: no seria mejor ids=context.get(active_id)120 #~ TODOK: no seria mejor ids=context.get(active_id)
126121
127 company_id = inv.company_id.id122 company_id = inv.company_id.id
128 context.update({'company_id':company_id})123 context.update({'company_id': company_id})
129124
130 if inv.state in ['draft', 'proforma2', 'cancel']:125 if inv.state in ['draft', 'proforma2', 'cancel']:
131 raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))126 raise osv.except_osv(_('Error !'), _('Can not create a debit note from draft/proforma/cancel invoice.'))
@@ -134,18 +129,18 @@
134 if inv.type not in ['in_invoice', 'out_invoice']:129 if inv.type not in ['in_invoice', 'out_invoice']:
135 raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))130 raise osv.except_osv(_('Error !'), _('Can not make a debit note on a refund invoice.'))
136131
137 #Check for the form fields132 # Check for the form fields
138133
139 if form.period:134 if form.period:
140 period = form.period.id135 period = form.period.id
141 else:136 else:
142 #Take period from the current date137 # Take period from the current date
143 period = self.pool.get('account.period').find(cr, uid, context=context)138 period = self.pool.get('account.period').find(cr, uid, context=context)
144 period = period and period[0] or False139 period = period and period[0] or False
145 if not period:140 if not period:
146 raise osv.except_osv(_('No Pediod Defined'), \141 raise osv.except_osv(_('No Pediod Defined'),
147 _('You have been left empty the period field that automatically fill with the current period. However there is not period defined for the current company. Please check in Accounting/Configuration/Periods'))142 _('You have been left empty the period field that automatically fill with the current period. However there is not period defined for the current company. Please check in Accounting/Configuration/Periods'))
148 self.write(cr, uid, ids, {'period': period }, context=context) 143 self.write(cr, uid, ids, {'period': period}, context=context)
149144
150 if not journal_id:145 if not journal_id:
151 journal_id = inv.journal_id.id146 journal_id = inv.journal_id.id
@@ -153,7 +148,7 @@
153 if form.date:148 if form.date:
154 date = form.date149 date = form.date
155 else:150 else:
156 #Take current date151 # Take current date
157 #date = inv.date_invoice152 #date = inv.date_invoice
158 date = time.strftime('%Y-%m-%d')153 date = time.strftime('%Y-%m-%d')
159 if form.description:154 if form.description:
@@ -161,7 +156,7 @@
161 else:156 else:
162 description = inv.name157 description = inv.name
163158
164 #we get original data of invoice to create a new invoice that is the copy of the original159 # we get original data of invoice to create a new invoice that is the copy of the original
165 invoice = inv_obj.read(cr, uid, [inv.id],160 invoice = inv_obj.read(cr, uid, [inv.id],
166 ['name', 'type', 'number', 'supplier_invoice_number',161 ['name', 'type', 'number', 'supplier_invoice_number',
167 'comment', 'date_due', 'partner_id',162 'comment', 'date_due', 'partner_id',
@@ -173,7 +168,7 @@
173 del invoice['id']168 del invoice['id']
174 invoice_lines = []169 invoice_lines = []
175 tax_lines = []170 tax_lines = []
176 #Add origin, parent and comment values171 # Add origin, parent and comment values
177 orig = self._get_orig(cr, uid, inv, invoice['supplier_invoice_number'], context)172 orig = self._get_orig(cr, uid, inv, invoice['supplier_invoice_number'], context)
178 invoice.update({173 invoice.update({
179 'type': inv.type,174 'type': inv.type,
@@ -183,16 +178,16 @@
183 'invoice_line': invoice_lines,178 'invoice_line': invoice_lines,
184 'tax_line': tax_lines,179 'tax_line': tax_lines,
185 'period_id': period,180 'period_id': period,
186 'parent_id':inv.id,181 'parent_id': inv.id,
187 'name': description,182 'name': description,
188 'origin': orig,183 'origin': orig,
189 'comment':form.comment,184 'comment': form.comment,
190 'journal_id':journal_id185 'journal_id': journal_id
191 })186 })
192 #take the id part of the tuple returned for many2one fields187 # take the id part of the tuple returned for many2one fields
193 for field in ('partner_id',188 for field in ('partner_id',
194 'account_id', 'currency_id', 'payment_term'):189 'account_id', 'currency_id', 'payment_term'):
195 invoice[field] = invoice[field] and invoice[field][0]190 invoice[field] = invoice[field] and invoice[field][0]
196 # create the new invoice191 # create the new invoice
197 inv_id = inv_obj.create(cr, uid, invoice, {})192 inv_id = inv_obj.create(cr, uid, invoice, {})
198 # we compute due date193 # we compute due date
@@ -201,12 +196,12 @@
201 if 'value' in data and data['value']:196 if 'value' in data and data['value']:
202 inv_obj.write(cr, uid, [inv_id], data['value'])197 inv_obj.write(cr, uid, [inv_id], data['value'])
203 created_inv.append(inv_id)198 created_inv.append(inv_id)
204 #we get the view id199 # we get the view id
205 if inv.type in ('out_invoice', 'out_refund'):200 if inv.type in ('out_invoice', 'out_refund'):
206 xml_id = 'action_sale_debit_tree'201 xml_id = 'action_sale_debit_tree'
207 else:202 else:
208 xml_id = 'action_purchase_debit_tree'203 xml_id = 'action_purchase_debit_tree'
209 #we get the model204 # we get the model
210 result = mod_obj.get_object_reference(cr, uid, 'l10n_ve_fiscal_requirements', xml_id)205 result = mod_obj.get_object_reference(cr, uid, 'l10n_ve_fiscal_requirements', xml_id)
211 id = result and result[1] or False206 id = result and result[1] or False
212 # we read the act window207 # we read the act window
213208
=== modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py'
--- l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2014-01-13 19:38:55 +0000
+++ l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2014-10-11 00:06:17 +0000
@@ -25,11 +25,13 @@
25from openerp.tools.translate import _25from openerp.tools.translate import _
26from openerp import netsvc26from openerp import netsvc
2727
28
28class account_invoice_refund(osv.osv_memory):29class account_invoice_refund(osv.osv_memory):
30
29 """Refunds invoice"""31 """Refunds invoice"""
3032
31 _inherit = 'account.invoice.refund'33 _inherit = 'account.invoice.refund'
32 34
33 def default_get(self, cr, uid, fields, context=None):35 def default_get(self, cr, uid, fields, context=None):
34 """ Get default values36 """ Get default values
35 @param fields: List of fields for default value37 @param fields: List of fields for default value
@@ -40,12 +42,12 @@
40 if context.get('active_id'):42 if context.get('active_id'):
41 code = datetime.datetime.today().strftime('%m/%Y')43 code = datetime.datetime.today().strftime('%m/%Y')
42 period_obj = self.pool.get('account.period')44 period_obj = self.pool.get('account.period')
43 period_ids = period_obj.search(cr,uid,[('code','=',code)],context=context)45 period_ids = period_obj.search(cr, uid, [('code', '=', code)], context=context)
44 period_id = period_ids and period_ids[0]46 period_id = period_ids and period_ids[0]
45 47
46 res.update({'period': period_id})48 res.update({'period': period_id})
47 return res49 return res
48 50
49 def _get_loc_req(self, cr, uid, context=None):51 def _get_loc_req(self, cr, uid, context=None):
50 """Get if a field is required or not by a Localization52 """Get if a field is required or not by a Localization
51 @param uid: Integer value of the user53 @param uid: Integer value of the user
@@ -56,18 +58,17 @@
56 u = self.pool.get('res.users').browse(cr, uid, uid, context=context)58 u = self.pool.get('res.users').browse(cr, uid, uid, context=context)
57 rc_brw = rc_obj.browse(cr, uid, u.company_id.id, context=context)59 rc_brw = rc_obj.browse(cr, uid, u.company_id.id, context=context)
58 if rc_brw.country_id and rc_brw.country_id.code == 'VE':60 if rc_brw.country_id and rc_brw.country_id.code == 'VE':
59 res= True61 res = True
60 return res62 return res
61 63
62
63 _columns = {64 _columns = {
64 'nro_ctrl': fields.char('Control Number', size=32, help="Code used for intern invoice control"), 65 'nro_ctrl': fields.char('Control Number', size=32, help="Code used for intern invoice control"),
65 'loc_req':fields.boolean('Required by Localization', help='This fields is for technical use'), 66 'loc_req': fields.boolean('Required by Localization', help='This fields is for technical use'),
66 }67 }
6768
68 _defaults ={69 _defaults = {
69 'loc_req': _get_loc_req70 'loc_req': _get_loc_req
70 }71 }
7172
72 def _get_journal(self, cr, uid, context=None):73 def _get_journal(self, cr, uid, context=None):
73 """ Return journal depending of the invoice type74 """ Return journal depending of the invoice type
@@ -86,9 +87,9 @@
86 """87 """
87 if context is None:88 if context is None:
88 context = {}89 context = {}
89 90
90 journal_obj = self.pool.get('account.journal')91 journal_obj = self.pool.get('account.journal')
91 res = super(account_invoice_refund,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)92 res = super(account_invoice_refund, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
92 type = context.get('journal_type', 'sale_refund')93 type = context.get('journal_type', 'sale_refund')
93 if type in ('sale', 'sale_refund'):94 if type in ('sale', 'sale_refund'):
94 type = 'sale_refund'95 type = 'sale_refund'
@@ -106,48 +107,47 @@
106 nro_ref = ref107 nro_ref = ref
107 if inv.type == 'out_invoice':108 if inv.type == 'out_invoice':
108 nro_ref = inv.number109 nro_ref = inv.number
109 orig = 'Devolucion FACT:' +(nro_ref or '') + '- DE FECHA:' + (inv.date_invoice or '') + (' TOTAL:' + str(inv.amount_total) or '')110 orig = 'Devolucion FACT:' + (nro_ref or '') + '- DE FECHA:' + (inv.date_invoice or '') + (' TOTAL:' + str(inv.amount_total) or '')
110 return orig111 return orig
111112
112 113 def cn_iva_validate(self, cr, uid, invoice, context=None):
113 def cn_iva_validate(self, cr, uid,invoice,context=None):
114 """ Validates if retentions have been changes to move the state confirmed and done114 """ Validates if retentions have been changes to move the state confirmed and done
115 """115 """
116 if context is None:116 if context is None:
117 context={}117 context = {}
118 ret_iva_id=False118 ret_iva_id = False
119 ret_islr_id=False119 ret_islr_id = False
120 im_obj=self.pool.get('ir.model')120 im_obj = self.pool.get('ir.model')
121 res = im_obj.browse(cr,uid,im_obj.search(cr, uid, [('model', '=','account.invoice')], context=context),context=context)[0].field_id121 res = im_obj.browse(cr, uid, im_obj.search(cr, uid, [('model', '=', 'account.invoice')], context=context), context=context)[0].field_id
122 for i in res:122 for i in res:
123 if i.name == 'wh_iva_id':123 if i.name == 'wh_iva_id':
124 if invoice.wh_iva_id: 124 if invoice.wh_iva_id:
125 ret_iva_id = invoice.wh_iva_id.id125 ret_iva_id = invoice.wh_iva_id.id
126 if i.name == 'islr_wh_doc_id':126 if i.name == 'islr_wh_doc_id':
127 if invoice.islr_wh_doc_id:127 if invoice.islr_wh_doc_id:
128 ret_islr_id = invoice.islr_wh_doc_id.id128 ret_islr_id = invoice.islr_wh_doc_id.id
129 129
130 awi_obj=self.pool.get('account.wh.iva')130 awi_obj = self.pool.get('account.wh.iva')
131 iwd_obj=self.pool.get('islr.wh.doc')131 iwd_obj = self.pool.get('islr.wh.doc')
132 wf_service = netsvc.LocalService("workflow")132 wf_service = netsvc.LocalService("workflow")
133 133
134 if ret_iva_id:134 if ret_iva_id:
135 awi_obj.compute_amount_wh(cr,uid,[ret_iva_id],context=context)135 awi_obj.compute_amount_wh(cr, uid, [ret_iva_id], context=context)
136 wf_service.trg_validate(uid, 'account.wh.iva', ret_iva_id, 'wh_iva_confirmed', cr)136 wf_service.trg_validate(uid, 'account.wh.iva', ret_iva_id, 'wh_iva_confirmed', cr)
137 wf_service.trg_validate(uid, 'account.wh.iva', ret_iva_id, 'wh_iva_done', cr)137 wf_service.trg_validate(uid, 'account.wh.iva', ret_iva_id, 'wh_iva_done', cr)
138 138
139 if ret_islr_id:139 if ret_islr_id:
140 iwd_obj.action_confirm1(cr,uid,[ret_islr_id],context=context)140 iwd_obj.action_confirm1(cr, uid, [ret_islr_id], context=context)
141 wf_service.trg_validate(uid, 'islr.wh.doc', ret_islr_id, 'act_done', cr)141 wf_service.trg_validate(uid, 'islr.wh.doc', ret_islr_id, 'act_done', cr)
142 142
143 return True143 return True
144144
145 def compute_refund(self, cr, uid, ids, mode='refund', context=None):145 def compute_refund(self, cr, uid, ids, mode='refund', context=None):
146 """ 146 """
147 @param ids: the account invoice refund’s ID or list of IDs147 @param ids: the account invoice refund’s ID or list of IDs
148 """148 """
149 wzd_brw = self.browse(cr,uid,ids[0],context=context)149 wzd_brw = self.browse(cr, uid, ids[0], context=context)
150 brw = self.browse(cr,uid,ids[0],context=context)150 brw = self.browse(cr, uid, ids[0], context=context)
151 inv_obj = self.pool.get('account.invoice')151 inv_obj = self.pool.get('account.invoice')
152 reconcile_obj = self.pool.get('account.move.reconcile')152 reconcile_obj = self.pool.get('account.move.reconcile')
153 account_m_line_obj = self.pool.get('account.move.line')153 account_m_line_obj = self.pool.get('account.move.line')
@@ -159,7 +159,7 @@
159 res_users_obj = self.pool.get('res.users')159 res_users_obj = self.pool.get('res.users')
160 if context is None:160 if context is None:
161 context = {}161 context = {}
162 for form in self.read(cr, uid, ids, context=context):162 for form in self.read(cr, uid, ids, context=context):
163 created_inv = []163 created_inv = []
164 date = False164 date = False
165 period = False165 period = False
@@ -174,65 +174,65 @@
174 raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))174 raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode))
175 period = form.get('period') and form.get('period')[0] or False175 period = form.get('period') and form.get('period')[0] or False
176 if not period:176 if not period:
177 #Take period from the current date177 # Take period from the current date
178 period = self.pool.get('account.period').find(cr, uid, context=context)178 period = self.pool.get('account.period').find(cr, uid, context=context)
179 period = period and period[0] or False179 period = period and period[0] or False
180 if not period:180 if not period:
181 raise osv.except_osv(_('No Pediod Defined'), \181 raise osv.except_osv(_('No Pediod Defined'),
182 _('You have been left empty the period field that automatically fill with the current period. However there is not period defined for the current company. Please check in Accounting/Configuration/Periods'))182 _('You have been left empty the period field that automatically fill with the current period. However there is not period defined for the current company. Please check in Accounting/Configuration/Periods'))
183 self.write(cr, uid, ids, {'period': period }, context=context)183 self.write(cr, uid, ids, {'period': period}, context=context)
184184
185 if not journal_brw:185 if not journal_brw:
186 journal_id = inv.journal_id.id186 journal_id = inv.journal_id.id
187 else:187 else:
188 journal_id=journal_brw[0]188 journal_id = journal_brw[0]
189189
190 if form['date']:190 if form['date']:
191 date = form['date']191 date = form['date']
192 if not form['period']:192 if not form['period']:
193 cr.execute("select name from ir_model_fields \193 cr.execute("select name from ir_model_fields \
194 where model = 'account.period' \194 where model = 'account.period' \
195 and name = 'company_id'")195 and name = 'company_id'")
196 result_query = cr.fetchone()196 result_query = cr.fetchone()
197 if result_query:197 if result_query:
198 cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \198 cr.execute("""select p.id from account_fiscalyear y, account_period p where y.id=p.fiscalyear_id \
199 and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))199 and date(%s) between p.date_start AND p.date_stop and y.company_id = %s limit 1""", (date, company.id,))
200 else:200 else:
201 cr.execute("""SELECT id201 cr.execute("""SELECT id
202 from account_period where date(%s)202 from account_period where date(%s)
203 between date_start AND date_stop \203 between date_start AND date_stop \
204 limit 1 """, (date,))204 limit 1 """, (date,))
205 res = cr.fetchone()205 res = cr.fetchone()
206 if res:206 if res:
207 period = res[0]207 period = res[0]
208 else:208 else:
209 #Take current date209 # Take current date
210 #date = inv.date_invoice210 #date = inv.date_invoice
211 date = time.strftime('%Y-%m-%d')211 date = time.strftime('%Y-%m-%d')
212 if form['description']:212 if form['description']:
213 description = form['description']213 description = form['description']
214 else:214 else:
215 description = inv.name215 description = inv.name
216 216
217 if inv.type in ('in_invoice','in_refund'):217 if inv.type in ('in_invoice', 'in_refund'):
218 if form['nro_ctrl']:218 if form['nro_ctrl']:
219 nroctrl = form['nro_ctrl']219 nroctrl = form['nro_ctrl']
220 else:220 else:
221 raise osv.except_osv(_('Control Number !'), \221 raise osv.except_osv(_('Control Number !'),
222 _('Missing Control Number on Invoice Refund!'))222 _('Missing Control Number on Invoice Refund!'))
223223
224 if not period:224 if not period:
225 raise osv.except_osv(_('Data Insufficient !'), \225 raise osv.except_osv(_('Data Insufficient !'),
226 _('No Period found on Invoice!'))226 _('No Period found on Invoice!'))
227 227
228 refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description, journal_id)228 refund_id = inv_obj.refund(cr, uid, [inv.id], date, period, description, journal_id)
229 229
230 refund = inv_obj.browse(cr, uid, refund_id[0], context=context)230 refund = inv_obj.browse(cr, uid, refund_id[0], context=context)
231 #Add parent invoice231 # Add parent invoice
232 cr.execute("update account_invoice set date_due='%s',nro_ctrl='%s', check_total='%s', \232 cr.execute("update account_invoice set date_due='%s',nro_ctrl='%s', check_total='%s', \
233 parent_id=%s where id =%s"%(date,nroctrl,inv.check_total,inv.id,refund.id))233 parent_id=%s where id =%s" % (date, nroctrl, inv.check_total, inv.id, refund.id))
234 inv_obj.button_compute(cr, uid, refund_id)234 inv_obj.button_compute(cr, uid, refund_id)
235 235
236 created_inv.append(refund_id[0])236 created_inv.append(refund_id[0])
237 if mode in ('cancel', 'modify'):237 if mode in ('cancel', 'modify'):
238 movelines = inv.move_id.line_id238 movelines = inv.move_id.line_id
@@ -242,21 +242,21 @@
242 to_reconcile_ids[line.account_id.id] = [line.id]242 to_reconcile_ids[line.account_id.id] = [line.id]
243 if type(line.reconcile_id) != osv.orm.browse_null:243 if type(line.reconcile_id) != osv.orm.browse_null:
244 reconcile_obj.unlink(cr, uid, line.reconcile_id.id)244 reconcile_obj.unlink(cr, uid, line.reconcile_id.id)
245 wf_service.trg_validate(uid, 'account.invoice', \245 wf_service.trg_validate(uid, 'account.invoice',
246 refund.id, 'invoice_open', cr)246 refund.id, 'invoice_open', cr)
247 247
248 refund = inv_obj.browse(cr, uid, refund_id[0], context=context)248 refund = inv_obj.browse(cr, uid, refund_id[0], context=context)
249 self.cn_iva_validate(cr,uid,refund,context=context)249 self.cn_iva_validate(cr, uid, refund, context=context)
250 250
251 for tmpline in refund.move_id.line_id:251 for tmpline in refund.move_id.line_id:
252 if tmpline.account_id.id == inv.account_id.id:252 if tmpline.account_id.id == inv.account_id.id:
253 to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)253 to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
254 for account in to_reconcile_ids:254 for account in to_reconcile_ids:
255 account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],255 account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
256 writeoff_period_id=period,256 writeoff_period_id=period,
257 writeoff_journal_id = inv.journal_id.id,257 writeoff_journal_id=inv.journal_id.id,
258 writeoff_acc_id=inv.account_id.id258 writeoff_acc_id=inv.account_id.id
259 )259 )
260 if mode == 'modify':260 if mode == 'modify':
261 invoice = inv_obj.read(cr, uid, [inv.id],261 invoice = inv_obj.read(cr, uid, [inv.id],
262 ['name', 'type', 'number', 'supplier_invoice_number',262 ['name', 'type', 'number', 'supplier_invoice_number',
@@ -272,7 +272,7 @@
272 invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)272 invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
273 tax_lines = inv_tax_obj.browse(cr, uid, invoice['tax_line'], context=context)273 tax_lines = inv_tax_obj.browse(cr, uid, invoice['tax_line'], context=context)
274 tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)274 tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
275 #Add origin value275 # Add origin value
276 orig = self._get_orig(cr, uid, inv, invoice['supplier_invoice_number'], context)276 orig = self._get_orig(cr, uid, inv, invoice['supplier_invoice_number'], context)
277 invoice.update({277 invoice.update({
278 'type': inv.type,278 'type': inv.type,
@@ -284,26 +284,26 @@
284 'period_id': period,284 'period_id': period,
285 'name': description,285 'name': description,
286 'origin': orig,286 'origin': orig,
287 287
288 })288 })
289 for field in ( 'partner_id',289 for field in ('partner_id',
290 'account_id', 'currency_id', 'payment_term', 'journal_id'):290 'account_id', 'currency_id', 'payment_term', 'journal_id'):
291 invoice[field] = invoice[field] and invoice[field][0]291 invoice[field] = invoice[field] and invoice[field][0]
292 inv_id = inv_obj.create(cr, uid, invoice, {})292 inv_id = inv_obj.create(cr, uid, invoice, {})
293 if inv.payment_term.id:293 if inv.payment_term.id:
294 data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)294 data = inv_obj.onchange_payment_term_date_invoice(cr, uid, [inv_id], inv.payment_term.id, date)
295 if 'value' in data and data['value']:295 if 'value' in data and data['value']:
296 inv_obj.write(cr, uid, [inv_id], data['value'])296 inv_obj.write(cr, uid, [inv_id], data['value'])
297 created_inv.append(inv_id)297 created_inv.append(inv_id)
298 298
299 new_inv_brw = inv_obj.browse(cr,uid,created_inv[1],context=context)299 new_inv_brw = inv_obj.browse(cr, uid, created_inv[1], context=context)
300 inv_obj.write(cr,uid,created_inv[0],{'name':wzd_brw.description,'origin':new_inv_brw.origin},context=context)300 inv_obj.write(cr, uid, created_inv[0], {'name': wzd_brw.description, 'origin': new_inv_brw.origin}, context=context)
301 inv_obj.write(cr,uid,created_inv[1],{'origin':inv.origin,'name':wzd_brw.description},context=context)301 inv_obj.write(cr, uid, created_inv[1], {'origin': inv.origin, 'name': wzd_brw.description}, context=context)
302 if inv.type in ('out_invoice', 'out_refund'):302 if inv.type in ('out_invoice', 'out_refund'):
303 xml_id = 'action_invoice_tree3'303 xml_id = 'action_invoice_tree3'
304 #~ if hasattr(inv, 'sale_ids'):304 #~ if hasattr(inv, 'sale_ids'):
305 #~ for i in inv.sale_ids:305 #~ for i in inv.sale_ids:
306 #~ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (i.id, refund_id[0]))306 #~ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (i.id, refund_id[0]))
307 else:307 else:
308 xml_id = 'action_invoice_tree4'308 xml_id = 'action_invoice_tree4'
309 result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)309 result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
@@ -312,14 +312,14 @@
312 invoice_domain = eval(result['domain'])312 invoice_domain = eval(result['domain'])
313 invoice_domain.append(('id', 'in', created_inv))313 invoice_domain.append(('id', 'in', created_inv))
314 result['domain'] = invoice_domain314 result['domain'] = invoice_domain
315 315
316 if wzd_brw.filter_refund == 'cancel':316 if wzd_brw.filter_refund == 'cancel':
317 orig = self._get_orig(cr, uid, inv, inv.supplier_invoice_number, context)317 orig = self._get_orig(cr, uid, inv, inv.supplier_invoice_number, context)
318 inv_obj.write(cr,uid,created_inv[0],{'origin':orig,'name':wzd_brw.description},context=context)318 inv_obj.write(cr, uid, created_inv[0], {'origin': orig, 'name': wzd_brw.description}, context=context)
319 319
320 if wzd_brw.filter_refund == 'refund':320 if wzd_brw.filter_refund == 'refund':
321 orig = self._get_orig(cr, uid, inv, inv.supplier_invoice_number, context)321 orig = self._get_orig(cr, uid, inv, inv.supplier_invoice_number, context)
322 inv_obj.write(cr,uid,created_inv[0],{'origin':inv.origin,'name':wzd_brw.description},context=context)322 inv_obj.write(cr, uid, created_inv[0], {'origin': inv.origin, 'name': wzd_brw.description}, context=context)
323 return result323 return result
324324
325 def validate_total_payment_inv(self, cr, uid, ids, context=None):325 def validate_total_payment_inv(self, cr, uid, ids, context=None):
@@ -339,7 +339,7 @@
339339
340 return: True: if invoice is does not have wh's or it does have and those ones are validated.340 return: True: if invoice is does not have wh's or it does have and those ones are validated.
341 False: if invoice is does have and those wh's are not yet validated.341 False: if invoice is does have and those wh's are not yet validated.
342 342
343 in the meantime this function is DUMMY,343 in the meantime this function is DUMMY,
344 and the developer should use it to override and get advantage of it.344 and the developer should use it to override and get advantage of it.
345 """345 """
@@ -359,16 +359,16 @@
359 mid = []359 mid = []
360 if self.validate_total_payment_inv(cr, uid, invoiceids, context=context):360 if self.validate_total_payment_inv(cr, uid, invoiceids, context=context):
361 for inv in inv_obj.browse(cr, uid, invoiceids, context=context):361 for inv in inv_obj.browse(cr, uid, invoiceids, context=context):
362 movelineids = inv_obj.move_line_id_payment_get(cr, uid,[inv.id])362 movelineids = inv_obj.move_line_id_payment_get(cr, uid, [inv.id])
363 for moveline in moveline_obj.browse(cr, uid, movelineids,context=context):363 for moveline in moveline_obj.browse(cr, uid, movelineids, context=context):
364 if moveline.reconcile_id:364 if moveline.reconcile_id:
365 rec += [moveline.reconcile_id.id]365 rec += [moveline.reconcile_id.id]
366 if moveline.reconcile_partial_id:366 if moveline.reconcile_partial_id:
367 rec += [moveline.reconcile_partial_id.id]367 rec += [moveline.reconcile_partial_id.id]
368 movelines = moveline_obj.search(cr, uid, [('|'),('reconcile_id','in',rec),('reconcile_partial_id','in',rec)],context=context)368 movelines = moveline_obj.search(cr, uid, [('|'), ('reconcile_id', 'in', rec), ('reconcile_partial_id', 'in', rec)], context=context)
369 for mids in moveline_obj.browse(cr, uid, movelines, context=context):369 for mids in moveline_obj.browse(cr, uid, movelines, context=context):
370 mid +=[mids.move_id.id]370 mid += [mids.move_id.id]
371 voucherids = voucher_pool.search(cr, uid,[('move_id','in',mid)])371 voucherids = voucher_pool.search(cr, uid, [('move_id', 'in', mid)])
372 if voucherids:372 if voucherids:
373 voucher_pool.cancel_voucher(cr, uid, voucherids, context=context)373 voucher_pool.cancel_voucher(cr, uid, voucherids, context=context)
374 else:374 else:
@@ -382,17 +382,17 @@
382 context = {}382 context = {}
383 inv_obj = self.pool.get('account.invoice')383 inv_obj = self.pool.get('account.invoice')
384 period_obj = self.pool.get('account.period')384 period_obj = self.pool.get('account.period')
385 wzr_brw = self.browse(cr,uid,ids,context=context)[0]385 wzr_brw = self.browse(cr, uid, ids, context=context)[0]
386 date = wzr_brw.date and wzr_brw.date.split('-') 386 date = wzr_brw.date and wzr_brw.date.split('-')
387 period = wzr_brw and wzr_brw.period and wzr_brw.period.id 387 period = wzr_brw and wzr_brw.period and wzr_brw.period.id
388 period_ids = date and len(date) == 3 and period_obj.search(cr,uid,[('code','=','%s/%s'%(date[1],date[0]))],context=context)388 period_ids = date and len(date) == 3 and period_obj.search(cr, uid, [('code', '=', '%s/%s' % (date[1], date[0]))], context=context)
389 if period not in period_ids:389 if period not in period_ids:
390 raise osv.except_osv(_('Error !'), \390 raise osv.except_osv(_('Error !'),
391 _('The date should be chosen to belong to the period')) 391 _('The date should be chosen to belong to the period'))
392 if not self.validate_wh(cr, uid, context.get('active_ids'), context=context):392 if not self.validate_wh(cr, uid, context.get('active_ids'), context=context):
393 inv= inv_obj.browse(cr,uid,context.get('active_ids'),context=context)[0]393 inv = inv_obj.browse(cr, uid, context.get('active_ids'), context=context)[0]
394 raise osv.except_osv(_('Error !'), \394 raise osv.except_osv(_('Error !'),
395 _('There are non-valid withholds for the document %s which refund is being processed!' % inv and inv.wh_iva_id.code or "vacio" ))395 _('There are non-valid withholds for the document %s which refund is being processed!' % inv and inv.wh_iva_id.code or "vacio"))
396 self.unreconcile_paid_invoices(cr, uid, context.get('active_ids'), context=context)396 self.unreconcile_paid_invoices(cr, uid, context.get('active_ids'), context=context)
397 data_refund = self.browse(cr, uid, ids, context=context)[0].filter_refund397 data_refund = self.browse(cr, uid, ids, context=context)[0].filter_refund
398 return self.compute_refund(cr, uid, ids, data_refund, context=context)398 return self.compute_refund(cr, uid, ids, data_refund, context=context)
399399
=== modified file 'l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py'
--- l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2013-06-03 21:19:56 +0000
+++ l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2014-10-11 00:06:17 +0000
@@ -2,7 +2,7 @@
2# -*- encoding: utf-8 -*-2# -*- encoding: utf-8 -*-
3##############################################################################3##############################################################################
4#4#
5# OpenERP, Open Source Management Solution 5# OpenERP, Open Source Management Solution
6# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved6# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
7# This module is developed by Vauxoo7# This module is developed by Vauxoo
8# This program is free software: you can redistribute it and/or modify8# This program is free software: you can redistribute it and/or modify
@@ -19,46 +19,46 @@
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
22import openerp.pooler
23from openerp.osv import osv, fields22from openerp.osv import osv, fields
24from openerp.tools.translate import _23from openerp.tools.translate import _
2524
25
26class search_info_partner_seniat(osv.osv_memory):26class search_info_partner_seniat(osv.osv_memory):
27 27
28 _name = "search.info.partner.seniat"28 _name = "search.info.partner.seniat"
29 _columns = {29 _columns = {
30 'vat':fields.char('ID Number (Cedula, Passport, VAT Number)', size=64, help='The VAT number must be in this format J1234567890, if you are looking for a cedula 12345678 and passport D123456789',required=True),30 'vat': fields.char('ID Number (Cedula, Passport, VAT Number)', size=64, help='The VAT number must be in this format J1234567890, if you are looking for a cedula 12345678 and passport D123456789', required=True),
31 'name':fields.char('Partner', size=256, help='Partner name'),31 'name': fields.char('Partner', size=256, help='Partner name'),
32 'wh_iva_agent':fields.boolean('Withholding Agent', help='It is withholding agent'),32 'wh_iva_agent': fields.boolean('Withholding Agent', help='It is withholding agent'),
33 'wh_iva_rate':fields.float('Percent of withholding', help='What is the percentil of withholding that you must to apply to this supplier if you are withholding agent'),33 'wh_iva_rate': fields.float('Percent of withholding', help='What is the percentil of withholding that you must to apply to this supplier if you are withholding agent'),
34 'vat_subjected':fields.boolean('Pay VAY', help='Pay VAT, in spanish known as : Contribuyente formal'),34 'vat_subjected': fields.boolean('Pay VAY', help='Pay VAT, in spanish known as : Contribuyente formal'),
35 }35 }
3636
37 def search_partner_seniat(self, cr, uid, ids, context=None):37 def search_partner_seniat(self, cr, uid, ids, context=None):
38 """ Check vat of the partner and update iva rate38 """ Check vat of the partner and update iva rate
39 """39 """
40 if context is None:40 if context is None:
41 context={}41 context = {}
42 this = self.browse(cr, uid, ids)[0]42 this = self.browse(cr, uid, ids)[0]
43 su_obj = self.pool.get('seniat.url')43 su_obj = self.pool.get('seniat.url')
44 rp_obj = self.pool.get('res.partner')44 rp_obj = self.pool.get('res.partner')
45 vat = this.vat.upper()45 vat = this.vat.upper()
46 res={'name': _('The requested contributor does not exist'),'vat_subjected': False,'vat':vat,'wh_iva_agent':False, 'wh_iva_rate': 0.0}46 res = {'name': _('The requested contributor does not exist'), 'vat_subjected': False, 'vat': vat, 'wh_iva_agent': False, 'wh_iva_rate': 0.0}
4747
48 if 'VE' in vat:48 if 'VE' in vat:
49 vat = vat[2:]49 vat = vat[2:]
5050
51 if rp_obj.check_vat_ve(vat,context=context):51 if rp_obj.check_vat_ve(vat, context=context):
52 res = su_obj._dom_giver(cr, uid, vat,context)52 res = su_obj._dom_giver(cr, uid, vat, context)
53 self.write(cr,uid,ids,res)53 self.write(cr, uid, ids, res)
54 54
55 return {55 return {
56 'type': 'ir.actions.act_window',56 'type': 'ir.actions.act_window',
57 'res_model': 'search.info.partner.seniat',57 'res_model': 'search.info.partner.seniat',
58 'view_mode': 'form',58 'view_mode': 'form',
59 'view_type': 'form',59 'view_type': 'form',
60 'res_id': this.id,60 'res_id': this.id,
61 'views': [(False, 'form')],61 'views': [(False, 'form')],
62 'target': 'new',62 'target': 'new',
63 }63 }
64search_info_partner_seniat()64search_info_partner_seniat()
6565
=== modified file 'l10n_ve_fiscal_requirements/wizard/update_info_partner.py'
--- l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2013-04-12 18:26:24 +0000
+++ l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2014-10-11 00:06:17 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution 4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# author.name@company.com6# author.name@company.com
7#7#
@@ -19,23 +19,21 @@
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
22import openerp.pooler22from openerp.osv import osv
23from openerp.osv import osv, fields23
24from openerp.tools.translate import _
2524
26class update_info_partner(osv.osv_memory):25class update_info_partner(osv.osv_memory):
27 _name = 'update.info.partner'26 _name = 'update.info.partner'
28 27
29 def update_info(self, cr, uid, ids, context={}):28 def update_info(self, cr, uid, ids, context={}):
30 """ OpenERP osv memory wizard : update_info_partner29 """ OpenERP osv memory wizard : update_info_partner
31 """30 """
32 aux=[]
33 seniat_url_obj = self.pool.get('seniat.url')31 seniat_url_obj = self.pool.get('seniat.url')
34 cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''')32 cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''')
35 record = cr.fetchall()33 record = cr.fetchall()
36 pids = record and map(lambda x: x[0],record) or []34 pids = record and map(lambda x: x[0], record) or []
37 seniat_url_obj.connect_seniat(cr, uid, pids, context=context, all_rif=True)35 seniat_url_obj.connect_seniat(cr, uid, pids, context=context, all_rif=True)
38 return{}36 return{}
3937
40 38
41update_info_partner()39update_info_partner()
4240
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2013-04-11 20:50:21 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2014-10-11 00:06:17 +0000
@@ -25,67 +25,65 @@
25##############################################################################25##############################################################################
2626
27from openerp.osv import fields, osv27from openerp.osv import fields, osv
28import openerp.tools
29from openerp.tools.translate import _28from openerp.tools.translate import _
30from openerp.tools import config29
3130
32class wizard_invoice_nro_ctrl(osv.osv_memory):31class wizard_invoice_nro_ctrl(osv.osv_memory):
3332
34 _name = "wizard.invoice.nro.ctrl"33 _name = "wizard.invoice.nro.ctrl"
35 _columns = {34 _columns = {
36 'invoice_id': fields.many2one('account.invoice','Invoice',help="Invoice to be declared damaged."),35 'invoice_id': fields.many2one('account.invoice', 'Invoice', help="Invoice to be declared damaged."),
37 'date': fields.date('Date',help="Date used for declared damaged paper. Keep empty to use the current date"),36 'date': fields.date('Date', help="Date used for declared damaged paper. Keep empty to use the current date"),
38 'sure': fields.boolean('Are You Sure?'),37 'sure': fields.boolean('Are You Sure?'),
39 }38 }
4039
41 def action_invoice_create(self, cr, uid, ids, wizard_brw,inv_brw,context=None):40 def action_invoice_create(self, cr, uid, ids, wizard_brw, inv_brw, context=None):
42 """ If the invoice has control number, this function is responsible for passing the bill to damaged paper41 """ If the invoice has control number, this function is responsible for passing the bill to damaged paper
43 @param wizard_brw: nothing for now 42 @param wizard_brw: nothing for now
44 @param inv_brw: damaged paper43 @param inv_brw: damaged paper
45 """44 """
46 invoice_line_obj = self.pool.get('account.invoice.line')45 invoice_line_obj = self.pool.get('account.invoice.line')
47 invoice_obj = self.pool.get('account.invoice')46 invoice_obj = self.pool.get('account.invoice')
48 acc_mv_obj = self.pool.get('account.move')47 acc_mv_obj = self.pool.get('account.move')
49 acc_mv_l_obj = self.pool.get('account.move.line')48 acc_mv_l_obj = self.pool.get('account.move.line')
50 tax_obj=self.pool.get('account.invoice.tax')49 tax_obj = self.pool.get('account.invoice.tax')
51 invoice={}50 invoice = {}
52 invoice_line ={}
53 if inv_brw.nro_ctrl:51 if inv_brw.nro_ctrl:
54 invoice.update({52 invoice.update({
55 'name': 'PAPELANULADO_NRO_CTRL_%s'%(inv_brw.nro_ctrl and inv_brw.nro_ctrl or '') ,53 'name': 'PAPELANULADO_NRO_CTRL_%s' % (inv_brw.nro_ctrl and inv_brw.nro_ctrl or ''),
56 'state':'paid',54 'state': 'paid',
57 'tax_line':[],55 'tax_line': [],
58 })56 })
59 else:57 else:
60 raise osv.except_osv(_('Validation error!'), _("You can run this process just if the invoice have Control Number, please verify the invoice and try again."))58 raise osv.except_osv(_('Validation error!'), _("You can run this process just if the invoice have Control Number, please verify the invoice and try again."))
61 invoice_obj.write(cr,uid,[inv_brw.id],invoice,context=context)59 invoice_obj.write(cr, uid, [inv_brw.id], invoice, context=context)
62 for line in inv_brw.invoice_line:60 for line in inv_brw.invoice_line:
63 invoice_line_obj.write(cr,uid,[line.id],{'quantity':0.0,'invoice_line_tax_id':[],'price_unit':0.0},context=context)61 invoice_line_obj.write(cr, uid, [line.id], {'quantity': 0.0, 'invoice_line_tax_id': [], 'price_unit': 0.0}, context=context)
64 62
65 tax_ids = self.pool.get('account.tax').search(cr,uid,[],context=context)63 tax_ids = self.pool.get('account.tax').search(cr, uid, [], context=context)
66 tax = tax_obj.search(cr,uid,[('invoice_id','=',inv_brw and inv_brw.id)],context=context)64 tax = tax_obj.search(cr, uid, [('invoice_id', '=', inv_brw and inv_brw.id)], context=context)
67 tax and tax_obj.write(cr,uid,tax[0],{'invoice_id':[]},context=context)65 tax and tax_obj.write(cr, uid, tax[0], {'invoice_id': []}, context=context)
68 tax_id=tax_obj.create(cr,uid,{'name':'SDCF',66 tax_id = tax_obj.create(cr, uid, {'name': 'SDCF',
69 'tax_id': tax_ids and tax_ids[0],67 'tax_id': tax_ids and tax_ids[0],
70 'amount':0.00,68 'amount': 0.00,
71 'tax_amount':0.00,69 'tax_amount': 0.00,
72 'base':0.00,70 'base': 0.00,
73 'account_id':inv_brw.company_id.acc_id.id,71 'account_id': inv_brw.company_id.acc_id.id,
74 'invoice_id':inv_brw and inv_brw.id},{})72 'invoice_id': inv_brw and inv_brw.id}, {})
75 move_id = inv_brw.move_id and inv_brw.move_id.id73 move_id = inv_brw.move_id and inv_brw.move_id.id
76 74
77 if move_id:75 if move_id:
78 acc_mv_obj.button_cancel(cr, uid, [inv_brw.move_id.id], context=context)76 acc_mv_obj.button_cancel(cr, uid, [inv_brw.move_id.id], context=context)
79 acc_mv_obj.write(cr, uid, [inv_brw.move_id.id],{'ref':'Damanged Paper'}, context=context)77 acc_mv_obj.write(cr, uid, [inv_brw.move_id.id], {'ref': 'Damanged Paper'}, context=context)
80 acc_mv_l_obj.unlink(cr,uid,[i.id for i in inv_brw.move_id.line_id])78 acc_mv_l_obj.unlink(cr, uid, [i.id for i in inv_brw.move_id.line_id])
81 return inv_brw.id79 return inv_brw.id
8280
83 def new_open_window(self,cr,uid,ids,list_ids,xml_id,module,context=None):81 def new_open_window(self, cr, uid, ids, list_ids, xml_id, module, context=None):
84 """ Generate new window at view form or tree82 """ Generate new window at view form or tree
85 """83 """
86 mod_obj = self.pool.get('ir.model.data')84 mod_obj = self.pool.get('ir.model.data')
87 act_obj = self.pool.get('ir.actions.act_window')85 act_obj = self.pool.get('ir.actions.act_window')
88 result = mod_obj._get_id(cr, uid, module, xml_id) 86 result = mod_obj._get_id(cr, uid, module, xml_id)
89 id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']87 id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
90 result = act_obj.read(cr, uid, id)88 result = act_obj.read(cr, uid, id)
91 result['res_id'] = list_ids89 result['res_id'] = list_ids
@@ -94,19 +92,17 @@
94 def create_invoice(self, cr, uid, ids, context=None):92 def create_invoice(self, cr, uid, ids, context=None):
95 """ Create a invoice refund93 """ Create a invoice refund
96 """94 """
97 if context==None:95 if context == None:
98 context={}96 context = {}
99 wizard_brw = self.browse(cr, uid, ids, context=None)97 wizard_brw = self.browse(cr, uid, ids, context=None)
100 wizard_deli_obj = self.pool.get('wz.picking.delivery.note')
101 inv_id = context.get('active_id')98 inv_id = context.get('active_id')
102 for wizard in wizard_brw:99 for wizard in wizard_brw:
103 if not wizard.sure:100 if not wizard.sure:
104 raise osv.except_osv(_("Validation error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))101 raise osv.except_osv(_("Validation error!"), _("Please confirm that you know what you're doing by checking the option bellow!"))
105 if wizard.invoice_id and wizard.invoice_id.company_id.jour_id and wizard.invoice_id and wizard.invoice_id.company_id.acc_id:102 if wizard.invoice_id and wizard.invoice_id.company_id.jour_id and wizard.invoice_id and wizard.invoice_id.company_id.acc_id:
106 inv_id = self.action_invoice_create(cr,uid,ids,wizard,wizard.invoice_id,context)103 inv_id = self.action_invoice_create(cr, uid, ids, wizard, wizard.invoice_id, context)
107 else:104 else:
108 raise osv.except_osv(_('Validation error!'), _("You must go to the company form and configure a journal and an account for damaged invoices"))105 raise osv.except_osv(_('Validation error!'), _("You must go to the company form and configure a journal and an account for damaged invoices"))
109 return self.new_open_window(cr,uid,ids,[inv_id],'action_invoice_tree1','account')106 return self.new_open_window(cr, uid, ids, [inv_id], 'action_invoice_tree1', 'account')
110107
111wizard_invoice_nro_ctrl()108wizard_invoice_nro_ctrl()
112
113109
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2013-04-11 20:50:21 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -26,6 +26,7 @@
26from openerp.osv import osv, fields26from openerp.osv import osv, fields
27from openerp.tools.translate import _27from openerp.tools.translate import _
2828
29
29class wiz_nroctrl(osv.osv_memory):30class wiz_nroctrl(osv.osv_memory):
30 _name = 'wiz.nroctrl'31 _name = 'wiz.nroctrl'
31 _description = "Wizard that changes the invoice control number"32 _description = "Wizard that changes the invoice control number"
@@ -34,14 +35,12 @@
34 """ Change control number of the invoice35 """ Change control number of the invoice
35 """36 """
36 if context is None:37 if context is None:
37 context={}38 context = {}
38 data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0]39 data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0]
39 if not data['sure']:40 if not data['sure']:
40 raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))41 raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))
41 inv_obj = self.pool.get('account.invoice')42 inv_obj = self.pool.get('account.invoice')
42 n_ctrl = data['name']43 n_ctrl = data['name']
43
44 invoice = inv_obj.browse(cr, uid, context['active_id'])
4544
46 inv_obj.write(cr, uid, context.get('active_id'), {'nro_ctrl': n_ctrl}, context=context)45 inv_obj.write(cr, uid, context.get('active_id'), {'nro_ctrl': n_ctrl}, context=context)
47 return {}46 return {}
@@ -54,4 +53,3 @@
5453
5554
56# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:55# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
57
5856
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_update_name.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2013-12-16 18:01:13 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Yanina Aular <yanina.aular@vauxoo.com> 8# Coded by: Yanina Aular <yanina.aular@vauxoo.com>
9# Planified by: Humberto Arocha9# Planified by: Humberto Arocha
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -26,6 +26,7 @@
26from openerp.osv import osv, fields26from openerp.osv import osv, fields
27from openerp.tools.translate import _27from openerp.tools.translate import _
2828
29
29class wiz_updatename(osv.osv_memory):30class wiz_updatename(osv.osv_memory):
30 _name = 'wiz.updatename'31 _name = 'wiz.updatename'
31 _description = "Wizard that changes the partner name"32 _description = "Wizard that changes the partner name"
@@ -36,10 +37,10 @@
36 data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]37 data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0]
37 if not data['sure']:38 if not data['sure']:
38 raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))39 raise osv.except_osv(_("Error!"), _("Please confirm that you want to do this by checking the option"))
39 40
40 partner_obj = self.pool.get('res.partner')41 partner_obj = self.pool.get('res.partner')
41 name_partner = data['name']42 name_partner = data['name']
42 43
43 partner_obj.write(cr, uid, context['active_id'], {'name': name_partner}, context=context)44 partner_obj.write(cr, uid, context['active_id'], {'name': name_partner}, context=context)
44 return {}45 return {}
4546
@@ -55,11 +56,11 @@
55 context = {}56 context = {}
56 partner_obj = self.pool.get('res.partner')57 partner_obj = self.pool.get('res.partner')
57 partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])])58 partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])])
58 partner_o = partner_obj.browse(cr, uid, partner[0])59 partner_o = partner_obj.browse(cr, uid, partner[0])
59 return partner_o and partner_o.name or False60 return partner_o and partner_o.name or False
6061
61 _defaults = {62 _defaults = {
62 'name': _get_name,63 'name': _get_name,
63 }64 }
64 65
65wiz_updatename()66wiz_updatename()
6667
=== modified file 'l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py'
--- l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2013-04-11 20:50:21 +0000
+++ l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2014-10-11 00:06:17 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution 4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# author.name@company.com6# author.name@company.com
7#7#
@@ -20,46 +20,43 @@
20#20#
21##############################################################################21##############################################################################
22from openerp.osv import fields, osv22from openerp.osv import fields, osv
23import openerp.tools23
24from openerp.tools.translate import _
25from openerp.tools import config
2624
27class wizard_url_seniat(osv.osv_memory):25class wizard_url_seniat(osv.osv_memory):
2826
2927 def _get_url(self, cr, uid, ids, context=None):
30 def _get_url(self,cr,uid,ids,context=None):
31 """ Get seniat web page28 """ Get seniat web page
32 """29 """
33 url= self.pool.get('seniat.url')30 url = self.pool.get('seniat.url')
34 url_ids = url.search(cr, uid,[])31 url_ids = url.search(cr, uid, [])
35 if len(url_ids)>1:32 if len(url_ids) > 1:
36 url.unlink(cr, uid,url_ids[1:])33 url.unlink(cr, uid, url_ids[1:])
37 url_obj=url.browse(cr, uid,url_ids,context=None)[0]34 url_obj = url.browse(cr, uid, url_ids, context=None)[0]
38 return url_obj35 return url_obj
3936
40 def _get_url1(self,cr,uid,ids,context=None):37 def _get_url1(self, cr, uid, ids, context=None):
41 url_obj = self._get_url(cr,uid,ids,context)38 url_obj = self._get_url(cr, uid, ids, context)
42 return url_obj.name39 return url_obj.name
43 40
44 def _get_url2(self,cr,uid,ids,context=None):41 def _get_url2(self, cr, uid, ids, context=None):
45 url_obj = self._get_url(cr,uid,ids,context)42 url_obj = self._get_url(cr, uid, ids, context)
46 return url_obj.url_seniat43 return url_obj.url_seniat
47 44
48 def _get_url3(self,cr,uid,ids,context=None):45 def _get_url3(self, cr, uid, ids, context=None):
49 url_obj = self._get_url(cr,uid,ids,context)46 url_obj = self._get_url(cr, uid, ids, context)
50 return url_obj.url_seniat247 return url_obj.url_seniat2
51 48
52 def update_url(self,cr,uid,ids,context=None):49 def update_url(self, cr, uid, ids, context=None):
53 data= self.pool.get('wizard.seniat.url').read(cr, uid, ids)[0]50 data = self.pool.get('wizard.seniat.url').read(cr, uid, ids)[0]
54 url_obj = self._get_url(cr,uid,ids,context)51 url_obj = self._get_url(cr, uid, ids, context)
55 url_obj.write({'name':data['url1'],'url_seniat':data['url2'],'url_seniat2':data['url3']})52 url_obj.write({'name': data['url1'], 'url_seniat': data['url2'], 'url_seniat2': data['url3']})
56 return {}53 return {}
5754
58 _name = "wizard.seniat.url"55 _name = "wizard.seniat.url"
59 _columns = {56 _columns = {
60 'url1':fields.char('URL1',255, required=True, readonly=False,help='In this field enter the URL from Seniat for search the fiscal information from partner'),57 'url1': fields.char('URL1', 255, required=True, readonly=False, help='In this field enter the URL from Seniat for search the fiscal information from partner'),
61 'url2':fields.char('URL2',255, required=True, readonly=False,help='In this field enter the URL from Seniat for search the retention rate from partner (RIF)'),58 'url2': fields.char('URL2', 255, required=True, readonly=False, help='In this field enter the URL from Seniat for search the retention rate from partner (RIF)'),
62 'url3':fields.char('URL3',255, required=True, readonly=False,help='In this field enter the URL from Seniat for search the retention rate from partner (CI or Passport)'),59 'url3': fields.char('URL3', 255, required=True, readonly=False, help='In this field enter the URL from Seniat for search the retention rate from partner (CI or Passport)'),
63 }60 }
64 _defaults = {61 _defaults = {
65 'url1': _get_url1,62 'url1': _get_url1,
@@ -67,4 +64,3 @@
67 'url3': _get_url3,64 'url3': _get_url3,
68 }65 }
69wizard_url_seniat()66wizard_url_seniat()
70
7167
=== modified file 'l10n_ve_generic/__init__.py'
--- l10n_ve_generic/__init__.py 2012-09-23 23:14:44 +0000
+++ l10n_ve_generic/__init__.py 2014-10-11 00:06:17 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution 4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved5# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$6# $Id$
7#7#
88
=== modified file 'l10n_ve_imex/__init__.py'
--- l10n_ve_imex/__init__.py 2013-04-26 19:54:06 +0000
+++ l10n_ve_imex/__init__.py 2014-10-11 00:06:17 +0000
@@ -25,4 +25,4 @@
25# along with this program. If not, see <http://www.gnu.org/licenses/>.25# along with this program. If not, see <http://www.gnu.org/licenses/>.
26###############################################################################26###############################################################################
2727
28import model28from . import model
2929
=== modified file 'l10n_ve_imex/model/__init__.py'
--- l10n_ve_imex/model/__init__.py 2013-04-29 16:31:11 +0000
+++ l10n_ve_imex/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -25,6 +25,6 @@
25# along with this program. If not, see <http://www.gnu.org/licenses/>.25# along with this program. If not, see <http://www.gnu.org/licenses/>.
26###############################################################################26###############################################################################
2727
28import customs_form_config28from . import customs_form_config
29import customs_form29from . import customs_form
30import invoice30from . import invoice
3131
=== modified file 'l10n_ve_imex/model/customs_form.py'
--- l10n_ve_imex/model/customs_form.py 2014-06-27 21:21:30 +0000
+++ l10n_ve_imex/model/customs_form.py 2014-10-11 00:06:17 +0000
@@ -26,7 +26,6 @@
26###############################################################################26###############################################################################
27from openerp.osv import fields, osv27from openerp.osv import fields, osv
28from openerp.tools.translate import _28from openerp.tools.translate import _
29import openerp.pooler
30import openerp.addons.decimal_precision as dp29import openerp.addons.decimal_precision as dp
31import time30import time
3231
@@ -110,8 +109,8 @@
110 readonly=True, states={'draft': [('readonly', False)]},109 readonly=True, states={'draft': [('readonly', False)]},
111 ondelete='restrict'),110 ondelete='restrict'),
112 'cfl_ids': fields.one2many('customs.form.line', 'customs_form_id',111 'cfl_ids': fields.one2many('customs.form.line', 'customs_form_id',
113 'Tax lines', readonly=True,112 'Tax lines', readonly=True,
114 states={'draft': [('readonly', False)]}),113 states={'draft': [('readonly', False)]}),
115 'amount_total': fields.function(_amount_total, method=True,114 'amount_total': fields.function(_amount_total, method=True,
116 type='float', string='Amount total',115 type='float', string='Amount total',
117 store=False),116 store=False),
@@ -329,4 +328,3 @@
329 ('code_uniq', 'UNIQUE(customs_form_id,tax_code)',328 ('code_uniq', 'UNIQUE(customs_form_id,tax_code)',
330 'The code must be unique! (for this form)'),329 'The code must be unique! (for this form)'),
331 ]330 ]
332
333331
=== modified file 'l10n_ve_imex/model/customs_form_config.py'
--- l10n_ve_imex/model/customs_form_config.py 2013-06-14 13:39:39 +0000
+++ l10n_ve_imex/model/customs_form_config.py 2014-10-11 00:06:17 +0000
@@ -26,11 +26,10 @@
26###############################################################################26###############################################################################
2727
28from openerp.osv import fields, osv28from openerp.osv import fields, osv
29from openerp.tools.translate import _
30import openerp.pooler
3129
3230
33class customs_form_config(osv.osv):31class customs_form_config(osv.osv):
32
34 '''33 '''
35 Stores common config parameters for form_86 data34 Stores common config parameters for form_86 data
36 '''35 '''
@@ -59,6 +58,7 @@
5958
6059
61class customs_facility(osv.osv):60class customs_facility(osv.osv):
61
62 '''62 '''
63 Stores a list with Venezuela's customs63 Stores a list with Venezuela's customs
64 '''64 '''
@@ -82,7 +82,7 @@
82 cr, user, name, args, operator, context, limit)82 cr, user, name, args, operator, context, limit)
83 if not res and name:83 if not res and name:
84 ids = self.search(cr, user, [(84 ids = self.search(cr, user, [(
85 'code', '=like', name+"%")]+args, limit=limit)85 'code', '=like', name + "%")] + args, limit=limit)
86 if ids:86 if ids:
87 res = self.name_get(cr, user, ids, context=context)87 res = self.name_get(cr, user, ids, context=context)
88 return res88 return res
@@ -101,6 +101,7 @@
101101
102102
103class customs_duty(osv.osv):103class customs_duty(osv.osv):
104
104 '''105 '''
105 A list of the concepts for taxes in form_86106 A list of the concepts for taxes in form_86
106 '''107 '''
@@ -152,4 +153,3 @@
152 ('sequence_uniq', 'UNIQUE(sequence,company_id)',153 ('sequence_uniq', 'UNIQUE(sequence,company_id)',
153 'The sequence must be unique! (for this comany)'),154 'The sequence must be unique! (for this comany)'),
154 ]155 ]
155
156156
=== modified file 'l10n_ve_imex/model/invoice.py'
--- l10n_ve_imex/model/invoice.py 2014-06-27 21:21:30 +0000
+++ l10n_ve_imex/model/invoice.py 2014-10-11 00:06:17 +0000
@@ -26,7 +26,6 @@
26###############################################################################26###############################################################################
2727
28from openerp.osv import osv, fields28from openerp.osv import osv, fields
29import openerp.addons.decimal_precision as dp
30from openerp.tools.translate import _29from openerp.tools.translate import _
3130
3231
@@ -59,13 +58,13 @@
59 type='many2one', relation='customs.form',58 type='many2one', relation='customs.form',
60 string='Customs form',59 string='Customs form',
61 store={60 store={
62 'account.invoice.tax':(_get_inv_from_ait, ['imex_inv_id'], 50),61 'account.invoice.tax': (_get_inv_from_ait, ['imex_inv_id'], 50),
63 }, help="This is the VAT Withholding Document where this invoice is being withheld"),62 }, help="This is the VAT Withholding Document where this invoice is being withheld"),
64 'imex_tax_line': fields.one2many(63 'imex_tax_line': fields.one2many(
65 'account.invoice.tax', 'imex_inv_id', 'Vat lines', readonly=True,64 'account.invoice.tax', 'imex_inv_id', 'Vat lines', readonly=True,
66 attrs="{'readonly':[('vat_detail','=',True)], \65 attrs="{'readonly':[('vat_detail','=',True)], \
67 'required':[('vat_detail','=',True)]}",),66 'required':[('vat_detail','=',True)]}",),
68 'expedient':fields.boolean('Dossier',67 'expedient': fields.boolean('Dossier',
69 help="If it is true, it means this is a \68 help="If it is true, it means this is a \
70 landindg form, you will need to load this \69 landindg form, you will need to load this \
71 format as an purchase invoice to declarate \70 format as an purchase invoice to declarate \
@@ -77,8 +76,8 @@
77 res = {}76 res = {}
78 if customs_form_id:77 if customs_form_id:
79 imp = self.pool.get('customs.form').browse(cr, uid,78 imp = self.pool.get('customs.form').browse(cr, uid,
80 customs_form_id,79 customs_form_id,
81 context=context)80 context=context)
82 res = {'value': {'num_import_form': imp.name,81 res = {'value': {'num_import_form': imp.name,
83 'import_invo': imp.date_liq}}82 'import_invo': imp.date_liq}}
84 return res83 return res
@@ -94,19 +93,20 @@
94 % item.customs_form_id.name)93 % item.customs_form_id.name)
95 return super(account_invoice, self).test_open(cr, uid, ids, args)94 return super(account_invoice, self).test_open(cr, uid, ids, args)
9695
96
97class account_invoice_tax(osv.osv):97class account_invoice_tax(osv.osv):
9898
99 _inherit = 'account.invoice.tax'99 _inherit = 'account.invoice.tax'
100100
101 _columns = {101 _columns = {
102 'cfl_id': fields.many2one('customs.form.line',102 'cfl_id': fields.many2one('customs.form.line',
103 'Vat line',103 'Vat line',
104 ondelete='cascade'),104 ondelete='cascade'),
105 'imex_inv_id': fields.many2one('account.invoice', 'Imex Invoice',105 'imex_inv_id': fields.many2one('account.invoice', 'Imex Invoice',
106 ondelete='cascade', select=True),106 ondelete='cascade', select=True),
107 'partner_id': fields.related('imex_inv_id', 'partner_id',107 'partner_id': fields.related('imex_inv_id', 'partner_id',
108 type='many2one', relation='res.partner',108 type='many2one', relation='res.partner',
109 string='Supplier',store=False, readonly=True),109 string='Supplier', store=False, readonly=True),
110 'supplier_invoice_number': fields.related('imex_inv_id', 'supplier_invoice_number', type='char',110 'supplier_invoice_number': fields.related('imex_inv_id', 'supplier_invoice_number', type='char',
111 string='Invoice ref', size=64, store=False,111 string='Invoice ref', size=64, store=False,
112 readonly=True),112 readonly=True),
@@ -116,27 +116,27 @@
116 }116 }
117117
118 #~ _sql_constraints = [118 #~ _sql_constraints = [
119 #~ ('base_gt_zero', 'CHECK (base>0)',119 #~ ('base_gt_zero', 'CHECK (base>0)',
120 #~ 'The base amount must be > 0!'),120 #~ 'The base amount must be > 0!'),
121 #~ ('amount_zero', 'CHECK (amount>=0)',121 #~ ('amount_zero', 'CHECK (amount>=0)',
122 #~ 'The tax amount must be >= 0!'),122 #~ 'The tax amount must be >= 0!'),
123 #~ ]123 #~ ]
124124
125 #~ def on_change_cfl_id(self, cr, uid, ids,125 #~ def on_change_cfl_id(self, cr, uid, ids,
126 #~ cfl_id):126 #~ cfl_id):
127 #~ '''127 #~ '''
128 #~ Create a domain to filter invoice_id for invoices listed in128 #~ Create a domain to filter invoice_id for invoices listed in
129 #~ customs_form.invoice_ids only129 #~ customs_form.invoice_ids only
130 #~ http://help.openerp.com/question/11180/how-to-create-a-domain-for-130 #~ http://help.openerp.com/question/11180/how-to-create-a-domain-for-
131 #~ field-in-parentparent-model/131 #~ field-in-parentparent-model/
132 #~ '''132 #~ '''
133 #~ res = {}133 #~ res = {}
134 #~ if cfl_id:134 #~ if cfl_id:
135 #~ line_obj = self.pool.get('customs.form.line')135 #~ line_obj = self.pool.get('customs.form.line')
136 #~ invoices = [i.id for i in line_obj.browse(136 #~ invoices = [i.id for i in line_obj.browse(
137 #~ cr, uid, cfl_id).customs_form_id.invoice_ids]137 #~ cr, uid, cfl_id).customs_form_id.invoice_ids]
138 #~ res = {'domain': {'invoice_id': [('id','in',invoices)]}}138 #~ res = {'domain': {'invoice_id': [('id','in',invoices)]}}
139 #~ return res139 #~ return res
140140
141 def on_change_amount(self, cr, uid, ids, tax_id, base_amount, tax_amount,141 def on_change_amount(self, cr, uid, ids, tax_id, base_amount, tax_amount,
142 context=None):142 context=None):
143143
=== modified file 'l10n_ve_sale_purchase/__init__.py'
--- l10n_ve_sale_purchase/__init__.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve> 8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve>
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -22,4 +22,4 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25import model25from . import model
2626
=== modified file 'l10n_ve_sale_purchase/__openerp__.py'
--- l10n_ve_sale_purchase/__openerp__.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/__openerp__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve> 8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve>
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
1212
=== modified file 'l10n_ve_sale_purchase/model/__init__.py'
--- l10n_ve_sale_purchase/model/__init__.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve> 8# Coded by: Israel Fermín Montilla <israel@openerp.com.ve>
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -22,7 +22,7 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25import stock25from . import stock
26import purchase26from . import purchase
27import sale27from . import sale
28import product 28from . import product
2929
=== modified file 'l10n_ve_sale_purchase/model/product.py'
--- l10n_ve_sale_purchase/model/product.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/model/product.py 2014-10-11 00:06:17 +0000
@@ -25,35 +25,31 @@
25# You should have received a copy of the GNU Affero General Public License25# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields
30from openerp.tools.translate import _29from openerp.tools.translate import _
31from openerp.tools import config30
32import time
33import datetime
3431
35class product_template(osv.osv):32class product_template(osv.osv):
3633
37 _inherit = "product.template"34 _inherit = "product.template"
3835
39 _columns = {36 _columns = {
40 'concept_id': fields.many2one('islr.wh.concept','Withhold Concept',help="Concept Withholding Income to apply to the service", required=False),37 'concept_id': fields.many2one('islr.wh.concept', 'Withhold Concept', help="Concept Withholding Income to apply to the service", required=False),
41 }38 }
4239
40
43class product_product(osv.osv):41class product_product(osv.osv):
44 _inherit = "product.product"42 _inherit = "product.product"
45 43
46 def onchange_product_type(self, cr, uid, ids, prd_type, context=None):44 def onchange_product_type(self, cr, uid, ids, prd_type, context=None):
47 """ Function that adds a default concept for products that are not service45 """ Function that adds a default concept for products that are not service
48 """46 """
49 domain = {}
50 if prd_type != 'service':47 if prd_type != 'service':
51 concept_obj = self.pool.get('islr.wh.concept')48 concept_obj = self.pool.get('islr.wh.concept')
52 concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)],context=context)49 concept_id = concept_obj.search(cr, uid, [('withholdable', '=', False)], context=context)
53 if concept_id:50 if concept_id:
54 return {'value' : {'concept_id':concept_id[0]}}51 return {'value': {'concept_id': concept_id[0]}}
55 else:52 else:
56 raise osv.except_osv(_('Invalid action !'),_("Must create the concept of income withholding"))53 raise osv.except_osv(_('Invalid action !'), _("Must create the concept of income withholding"))
57 return {'value' : {'concept_id':False} ,54 return {'value': {'concept_id': False},
58 'domain' :{'concept_id':[('withholdable','=',True)]}} ,55 'domain': {'concept_id': [('withholdable', '=', True)]}},
59
6056
=== modified file 'l10n_ve_sale_purchase/model/purchase.py'
--- l10n_ve_sale_purchase/model/purchase.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/model/purchase.py 2014-10-11 00:06:17 +0000
@@ -7,7 +7,7 @@
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>9# Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
10# Javier Duran <javier@vauxoo.com> 10# Javier Duran <javier@vauxoo.com>
11# Planified by: Nhomar Hernandez11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve13# Audited by: Humberto Arocha humberto@openerp.com.ve
@@ -25,43 +25,41 @@
25# You should have received a copy of the GNU Affero General Public License25# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields29
30from openerp.tools.translate import _
31from openerp.tools import config
32import time
33import datetime
3430
35class purchase_order_line(osv.osv):31class purchase_order_line(osv.osv):
36 32
37 _inherit ="purchase.order.line"33 _inherit = "purchase.order.line"
3834
39 _columns = {35 _columns = {
40 'concept_id': fields.many2one('islr.wh.concept','Withhold Concept',help="Withhold concept associated with this rate",required=False),36 'concept_id': fields.many2one('islr.wh.concept', 'Withhold Concept', help="Withhold concept associated with this rate", required=False),
41 }37 }
42 38
43 def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False):39 def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, name=False, price_unit=False, notes=False):
44 """ This method loads the withholding concept to a product automatically40 """ This method loads the withholding concept to a product automatically
45 """ 41 """
46 def get_concept():42 def get_concept():
47 concept_obj = self.pool.get('islr.wh.concept')43 concept_obj = self.pool.get('islr.wh.concept')
48 concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)])44 concept_id = concept_obj.search(cr, uid, [('withholdable', '=', False)])
49 return concept_id and concept_id[0] or False45 return concept_id and concept_id[0] or False
50 res = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order, fiscal_position, date_planned, name, price_unit, notes)46 res = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order, fiscal_position, date_planned, name, price_unit, notes)
51 if not product:47 if not product:
52 concept_id = get_concept()48 concept_id = get_concept()
53 if concept_id:49 if concept_id:
54 res['value']['concept_id']=concept_id50 res['value']['concept_id'] = concept_id
55 return res51 return res
56 prod_brw = self.pool.get('product.product').browse(cr, uid, product)52 prod_brw = self.pool.get('product.product').browse(cr, uid, product)
57 res['value']['concept_id'] = prod_brw.concept_id and prod_brw.concept_id.id or get_concept()53 res['value']['concept_id'] = prod_brw.concept_id and prod_brw.concept_id.id or get_concept()
58 return res54 return res
55
56
59class purchase_order(osv.osv):57class purchase_order(osv.osv):
60 _inherit = 'purchase.order'58 _inherit = 'purchase.order'
61 59
62 def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):60 def _prepare_inv_line(self, cr, uid, account_id, order_line, context=None):
63 """ Update concept_id field to the prepare line61 """ Update concept_id field to the prepare line
64 """62 """
65 data = super(purchase_order, self)._prepare_inv_line( cr, uid, account_id, order_line, context=context)63 data = super(purchase_order, self)._prepare_inv_line(cr, uid, account_id, order_line, context=context)
66 data.update({'concept_id':order_line and order_line.concept_id and order_line.concept_id.id })64 data.update({'concept_id': order_line and order_line.concept_id and order_line.concept_id.id})
67 return data65 return data
6866
=== modified file 'l10n_ve_sale_purchase/model/sale.py'
--- l10n_ve_sale_purchase/model/sale.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/model/sale.py 2014-10-11 00:06:17 +0000
@@ -7,7 +7,7 @@
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Humberto Arocha <humberto@openerp.com.ve>8# Coded by: Humberto Arocha <humberto@openerp.com.ve>
9# Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>9# Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com>
10# Javier Duran <javier@vauxoo.com> 10# Javier Duran <javier@vauxoo.com>
11# Planified by: Nhomar Hernandez11# Planified by: Nhomar Hernandez
12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve12# Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve
13# Audited by: Humberto Arocha humberto@openerp.com.ve13# Audited by: Humberto Arocha humberto@openerp.com.ve
@@ -25,20 +25,16 @@
25# You should have received a copy of the GNU Affero General Public License25# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields29
30from openerp.tools.translate import _
31from openerp.tools import config
32import time
33import datetime
3430
35class sale_order_line(osv.osv):31class sale_order_line(osv.osv):
36 _inherit = "sale.order.line"32 _inherit = "sale.order.line"
3733
38 _columns = {34 _columns = {
39 'concept_id': fields.many2one('islr.wh.concept','Withhold Concept',help="Withhold concept associated with this rate",required=False),35 'concept_id': fields.many2one('islr.wh.concept', 'Withhold Concept', help="Withhold concept associated with this rate", required=False),
40 }36 }
41 37
42# def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,uom=False, qty_uos=0, uos=False, name='', partner_id=False,lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):38# def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,uom=False, qty_uos=0, uos=False, name='', partner_id=False,lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
43# def get_concept():39# def get_concept():
44# concept_obj = self.pool.get('islr.wh.concept')40# concept_obj = self.pool.get('islr.wh.concept')
@@ -61,8 +57,8 @@
61 create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context)57 create_ids = super(sale_order_line, self).invoice_line_create(cr, uid, ids, context)
62 invoice_line_brws = self.pool.get('account.invoice.line').browse(cr, uid, create_ids)58 invoice_line_brws = self.pool.get('account.invoice.line').browse(cr, uid, create_ids)
63 order_line_sale_brws = self.pool.get('sale.order.line').browse(cr, uid, ids)59 order_line_sale_brws = self.pool.get('sale.order.line').browse(cr, uid, ids)
64 for line_invoice in invoice_line_brws: #lineas de la factura60 for line_invoice in invoice_line_brws: # lineas de la factura
65 for line_sale in order_line_sale_brws: #lineas de la orden de venta61 for line_sale in order_line_sale_brws: # lineas de la orden de venta
66 if line_sale.product_id==line_invoice.product_id: #si es la misma linea 62 if line_sale.product_id == line_invoice.product_id: # si es la misma linea
67 self.pool.get('account.invoice.line').write(cr, uid, line_invoice.id, {'concept_id':line_sale.concept_id.id}) 63 self.pool.get('account.invoice.line').write(cr, uid, line_invoice.id, {'concept_id': line_sale.concept_id.id})
68 return create_ids 64 return create_ids
6965
=== modified file 'l10n_ve_sale_purchase/model/stock.py'
--- l10n_ve_sale_purchase/model/stock.py 2013-11-18 23:18:43 +0000
+++ l10n_ve_sale_purchase/model/stock.py 2014-10-11 00:06:17 +0000
@@ -25,25 +25,22 @@
25# You should have received a copy of the GNU Affero General Public License25# You should have received a copy of the GNU Affero General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.26# along with this program. If not, see <http://www.gnu.org/licenses/>.
27##############################################################################27##############################################################################
28from openerp.osv import osv28from openerp.osv import osv, fields
29from openerp.osv import fields29
30from openerp.tools.translate import _
31from openerp.tools import config
32import time
3330
34class stock_picking(osv.osv):31class stock_picking(osv.osv):
35 _inherit = 'stock.picking'32 _inherit = 'stock.picking'
36 def action_invoice_create(self, cursor, user, ids, journal_id=False,group=False, type='out_invoice', context=None):33
37 """ Function that adds the concept of retention to the invoice_lines from 34 def action_invoice_create(self, cursor, user, ids, journal_id=False, group=False, type='out_invoice', context=None):
35 """ Function that adds the concept of retention to the invoice_lines from
38 a purchase order or sales order with billing method from picking list36 a purchase order or sales order with billing method from picking list
39 """37 """
40 if context is None:38 if context is None:
41 context = {}39 context = {}
42 data = super(stock_picking, self).action_invoice_create(cursor, user, ids, journal_id, group, type, context)40 data = super(stock_picking, self).action_invoice_create(cursor, user, ids, journal_id, group, type, context)
43 picking_id=data.keys()[0]41 picking_id = data.keys()[0]
44 invoice_id=data[picking_id]42 invoice_id = data[picking_id]
45 invoice_brw = self.pool.get('account.invoice').browse(cursor, user, invoice_id)43 invoice_brw = self.pool.get('account.invoice').browse(cursor, user, invoice_id)
46 picking_brw=self.browse(cursor, user, picking_id)
47 invoice_line_obj = self.pool.get('account.invoice.line')44 invoice_line_obj = self.pool.get('account.invoice.line')
48 for l in invoice_brw.invoice_line:45 for l in invoice_brw.invoice_line:
49 invoice_line_obj.write(cursor, user, l.id, {'concept_id':46 invoice_line_obj.write(cursor, user, l.id, {'concept_id':
@@ -51,7 +48,5 @@
51 return data48 return data
5249
53 _columns = {50 _columns = {
54 'nro_ctrl': fields.char('Invoice ref.', size=32, readonly=True, states={'draft':[('readonly',False)]}, help="Invoice reference"),51 'nro_ctrl': fields.char('Invoice ref.', size=32, readonly=True, states={'draft': [('readonly', False)]}, help="Invoice reference"),
55 }52 }
56
57
5853
=== modified file 'l10n_ve_split_invoice/__init__.py'
--- l10n_ve_split_invoice/__init__.py 2013-11-18 09:24:59 +0000
+++ l10n_ve_split_invoice/__init__.py 2014-10-11 00:06:17 +0000
@@ -22,4 +22,4 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24##############################################################################24##############################################################################
25import model25from . import model
2626
=== modified file 'l10n_ve_split_invoice/model/__init__.py'
--- l10n_ve_split_invoice/model/__init__.py 2013-11-18 09:24:59 +0000
+++ l10n_ve_split_invoice/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -22,7 +22,7 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24##############################################################################24##############################################################################
25import installer25from . import installer
26import res_company26from . import res_company
27import invoice27from . import invoice
2828
2929
=== modified file 'l10n_ve_split_invoice/model/installer.py'
--- l10n_ve_split_invoice/model/installer.py 2013-11-18 09:24:59 +0000
+++ l10n_ve_split_invoice/model/installer.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -22,18 +22,19 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
25from openerp.osv import osv25from openerp.osv import osv, fields
26from openerp.osv import fields
27from openerp.tools.translate import _26from openerp.tools.translate import _
28import base6427import base64
29import openerp.addons as addons28import openerp.addons as addons
3029
30
31class split_invoice_config(osv.osv_memory):31class split_invoice_config(osv.osv_memory):
32
32 """ Fiscal Requirements installer wizard33 """ Fiscal Requirements installer wizard
33 """34 """
34 _name = 'split.invoice.config'35 _name = 'split.invoice.config'
35 _inherit = 'res.config'36 _inherit = 'res.config'
36 _description= __doc__37 _description = __doc__
3738
38 def default_get(self, cr, uid, fields_list=None, context=None):39 def default_get(self, cr, uid, fields_list=None, context=None):
39 """ Default value to the config_logo field40 """ Default value to the config_logo field
@@ -47,18 +48,18 @@
47 """ In this method I will configure the maximum number of lines in your invoices.48 """ In this method I will configure the maximum number of lines in your invoices.
48 """49 """
49 wiz_data = self.browse(cr, uid, ids[0])50 wiz_data = self.browse(cr, uid, ids[0])
50 if wiz_data.name < 1 :51 if wiz_data.name < 1:
51 raise osv.except_osv(_('Error !'), _('The number of customer invoice lines must be at least one'))52 raise osv.except_osv(_('Error !'), _('The number of customer invoice lines must be at least one'))
52 company = self.pool.get('res.users').browse(cr, uid, uid).company_id53 company = self.pool.get('res.users').browse(cr, uid, uid).company_id
53 company_obj = self.pool.get('res.company')54 company_obj = self.pool.get('res.company')
54 company_id = company_obj.search(cr,uid,[('id','=',company.id)])55 company_id = company_obj.search(cr, uid, [('id', '=', company.id)])
55 data = {'lines_invoice': wiz_data.name}56 data = {'lines_invoice': wiz_data.name}
56 company_obj.write(cr, uid, company_id, data)57 company_obj.write(cr, uid, company_id, data)
5758
58 _columns = {59 _columns = {
59 'name': fields.integer('Max Invoice Lines',required=True, help='Select the maximum number of lines in your customer invoices'),60 'name': fields.integer('Max Invoice Lines', required=True, help='Select the maximum number of lines in your customer invoices'),
60 }61 }
61 _defaults={62 _defaults = {
62 'name': 50,63 'name': 50,
63 }64 }
64split_invoice_config()65split_invoice_config()
6566
=== modified file 'l10n_ve_split_invoice/model/invoice.py'
--- l10n_ve_split_invoice/model/invoice.py 2014-02-19 04:36:23 +0000
+++ l10n_ve_split_invoice/model/invoice.py 2014-10-11 00:06:17 +0000
@@ -23,10 +23,10 @@
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24##############################################################################24##############################################################################
25from openerp.osv import osv25from openerp.osv import osv
26from openerp.osv import fields
27from openerp.tools.translate import _26from openerp.tools.translate import _
28from openerp import netsvc27from openerp import netsvc
2928
29
30class account_invoice(osv.osv):30class account_invoice(osv.osv):
31 _inherit = 'account.invoice'31 _inherit = 'account.invoice'
3232
@@ -34,13 +34,13 @@
34 """ Split the invoice when the lines exceed the maximum set for the company34 """ Split the invoice when the lines exceed the maximum set for the company
35 """35 """
36 for inv in self.browse(cr, uid, ids):36 for inv in self.browse(cr, uid, ids):
37 inv_id =False37 inv_id = False
38 if inv.company_id.lines_invoice < 1:38 if inv.company_id.lines_invoice < 1:
39 raise osv.except_osv(_('Error !'), _('Please set an invoice lines value in:\nAdministration->Company->Configuration->Invoice lines'))39 raise osv.except_osv(_('Error !'), _('Please set an invoice lines value in:\nAdministration->Company->Configuration->Invoice lines'))
40 if inv.type in ["out_invoice","out_refund"]:40 if inv.type in ["out_invoice", "out_refund"]:
41 if len(inv.invoice_line)> inv.company_id.lines_invoice:41 if len(inv.invoice_line) > inv.company_id.lines_invoice:
42 lst = []42 lst = []
43 invoice = self.read(cr, uid, inv.id, ['name', 'type', 'number', 'supplier_invoice_number', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'period_id', "user_id"])43 invoice = self.read(cr, uid, inv.id, ['name', 'type', 'number', 'supplier_invoice_number', 'comment', 'date_due', 'partner_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id', 'period_id', "user_id"])
44 invoice.update({44 invoice.update({
45 'state': 'draft',45 'state': 'draft',
46 'number': False,46 'number': False,
@@ -49,16 +49,16 @@
49 })49 })
50 # take the id part of the tuple returned for many2one fields50 # take the id part of the tuple returned for many2one fields
51 invoice.pop('id', None)51 invoice.pop('id', None)
52 for field in ( 'partner_id',52 for field in ('partner_id',
53 'account_id', 'currency_id', 'payment_term', 'journal_id', 'period_id','user_id'):53 'account_id', 'currency_id', 'payment_term', 'journal_id', 'period_id', 'user_id'):
54 invoice[field] = invoice[field] and invoice[field][0]54 invoice[field] = invoice[field] and invoice[field][0]
55 55
56 #~ if hasattr(inv,'sale_ids'):56 #~ if hasattr(inv,'sale_ids'):
57 #~ if self.browse(cr,uid,inv.id,context={}).sale_ids:57 #~ if self.browse(cr,uid,inv.id,context={}).sale_ids:
58 #~ invoice.update({58 #~ invoice.update({
59 #~ 'sale_ids':[(6,0,[i.id for i in self.browse(cr,uid,inv.id,context={}).sale_ids])]59 #~ 'sale_ids':[(6,0,[i.id for i in self.browse(cr,uid,inv.id,context={}).sale_ids])]
60 #~ })60 #~ })
61 61
62 inv_id = self.create(cr, uid, invoice)62 inv_id = self.create(cr, uid, invoice)
63 cont = 063 cont = 0
64 lst = inv.invoice_line64 lst = inv.invoice_line
@@ -66,10 +66,9 @@
66 lst.pop(0)66 lst.pop(0)
67 cont += 167 cont += 1
68 for il in lst:68 for il in lst:
69 self.pool.get('account.invoice.line').write(cr,uid,il.id,{'invoice_id':inv_id})69 self.pool.get('account.invoice.line').write(cr, uid, il.id, {'invoice_id': inv_id})
70 self.button_compute(cr, uid, [inv.id], set_total=True)70 self.button_compute(cr, uid, [inv.id], set_total=True)
71 if inv_id:71 if inv_id:
72 wf_service = netsvc.LocalService("workflow")
73 self.button_compute(cr, uid, [inv_id], set_total=True)72 self.button_compute(cr, uid, [inv_id], set_total=True)
74# wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)73# wf_service.trg_validate(uid, 'account.invoice', inv_id, 'invoice_open', cr)
75 return True74 return True
@@ -77,8 +76,8 @@
77 def action_date_assign(self, cr, uid, ids, *args):76 def action_date_assign(self, cr, uid, ids, *args):
78 """ Return assigned dat77 """ Return assigned dat
79 """78 """
80 data = super(account_invoice, self).action_date_assign(cr, uid, ids, *args)79 super(account_invoice, self).action_date_assign(cr, uid, ids, *args)
81 self.split_invoice(cr,uid,ids)80 self.split_invoice(cr, uid, ids)
82 return True81 return True
8382
84account_invoice()83account_invoice()
8584
=== modified file 'l10n_ve_split_invoice/model/res_company.py'
--- l10n_ve_split_invoice/model/res_company.py 2013-11-18 09:24:59 +0000
+++ l10n_ve_split_invoice/model/res_company.py 2014-10-11 00:06:17 +0000
@@ -22,19 +22,18 @@
22# You should have received a copy of the GNU Affero General Public License22# You should have received a copy of the GNU Affero General Public License
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24##############################################################################24##############################################################################
25from openerp.osv import osv25from openerp.osv import osv, fields
26from openerp.osv import fields26
27from openerp.tools.translate import _
2827
29class res_company(osv.osv):28class res_company(osv.osv):
30 _inherit = 'res.company'29 _inherit = 'res.company'
3130
32 _columns = {31 _columns = {
33 'lines_invoice':fields.integer('Invoice Lines',required=False, help="Number of lines per invoice"),32 'lines_invoice': fields.integer('Invoice Lines', required=False, help="Number of lines per invoice"),
34 }33 }
3534
36 _defaults = {35 _defaults = {
37 'lines_invoice':50,36 'lines_invoice': 50,
38 }37 }
3938
40res_company()39res_company()
4140
=== modified file 'l10n_ve_vat_write_off/__init__.py'
--- l10n_ve_vat_write_off/__init__.py 2013-05-02 17:01:41 +0000
+++ l10n_ve_vat_write_off/__init__.py 2014-10-11 00:06:17 +0000
@@ -1,1 +1,1 @@
1import model1from . import model
22
=== modified file 'l10n_ve_vat_write_off/__openerp__.py'
--- l10n_ve_vat_write_off/__openerp__.py 2014-02-18 21:58:17 +0000
+++ l10n_ve_vat_write_off/__openerp__.py 2014-10-11 00:06:17 +0000
@@ -1,4 +1,4 @@
1{ 1{
2 "name" : "VAT Write Off",2 "name" : "VAT Write Off",
3 "version" : "0.5",3 "version" : "0.5",
4 "depends" : ["l10n_ve_fiscal_book",4 "depends" : ["l10n_ve_fiscal_book",
55
=== modified file 'l10n_ve_vat_write_off/model/__init__.py'
--- l10n_ve_vat_write_off/model/__init__.py 2013-03-13 21:07:18 +0000
+++ l10n_ve_vat_write_off/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -1,1 +1,1 @@
1import l10n_ve_vat_write_off1from . import l10n_ve_vat_write_off
22
=== modified file 'l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py'
--- l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py 2013-05-06 18:55:10 +0000
+++ l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py 2014-10-11 00:06:17 +0000
@@ -1,156 +1,156 @@
1from openerp.osv import fields, osv1from openerp.osv import fields, osv
2from datetime import datetime, timedelta2
33
4class vat_write_off(osv.osv):4class vat_write_off(osv.osv):
5 _description = ''5 _description = ''
6 _name = 'vat.write.off'6 _name = 'vat.write.off'
7 _columns = {7 _columns = {
8 'company_id':fields.many2one('res.company','Company',8 'company_id': fields.many2one('res.company', 'Company',
9 help='Company',required=True),9 help='Company', required=True),
10 'period_id':fields.many2one('account.period','Period',10 'period_id': fields.many2one('account.period', 'Period',
11 help="Book's Fiscal Period",required=True),11 help="Book's Fiscal Period", required=True),
12 'state': fields.selection([('draft','Getting Ready'),12 'state': fields.selection([('draft', 'Getting Ready'),
13 ('open','Approved by Manager'),('done','Seniat Submitted')],13 ('open', 'Approved by Manager'), ('done', 'Seniat Submitted')],
14 string='Status', required=True),14 string='Status', required=True),
15 'purchase_fb_id':fields.many2one('fiscal.book', 'Purchase Fiscal Book',15 'purchase_fb_id': fields.many2one('fiscal.book', 'Purchase Fiscal Book',
16 help='Purchase Fiscal Book'),16 help='Purchase Fiscal Book'),
17 'p_do_general_vat_base_sum' : fields.related('purchase_fb_id',17 'p_do_general_vat_base_sum': fields.related('purchase_fb_id',
18 'do_general_vat_base_sum',18 'do_general_vat_base_sum',
19 type="float",
20 readonly=True,
21 store=True,),
22 'p_do_general_vat_tax_sum' : fields.related('purchase_fb_id',
23 'do_general_vat_tax_sum',
24 type="float",19 type="float",
25 readonly=True,20 readonly=True,
26 store=True,),21 store=True,),
27 'p_do_additional_vat_base_sum' : fields.related('purchase_fb_id',22 'p_do_general_vat_tax_sum': fields.related('purchase_fb_id',
28 'do_additional_vat_base_sum',23 'do_general_vat_tax_sum',
29 type="float",24 type="float",
30 readonly=True,25 readonly=True,
31 store=True,),26 store=True,),
32 'p_do_additional_vat_tax_sum' : fields.related('purchase_fb_id',27 'p_do_additional_vat_base_sum': fields.related('purchase_fb_id',
33 'do_additional_vat_tax_sum',28 'do_additional_vat_base_sum',
34 type="float",29 type="float",
35 readonly=True,30 readonly=True,
36 store=True,),31 store=True,),
37 'p_do_reduced_vat_base_sum' : fields.related('purchase_fb_id',32 'p_do_additional_vat_tax_sum': fields.related('purchase_fb_id',
38 'do_reduced_vat_base_sum',33 'do_additional_vat_tax_sum',
39 type="float",34 type="float",
40 readonly=True,35 readonly=True,
41 store=True,),36 store=True,),
42 'p_do_reduced_vat_tax_sum' : fields.related('purchase_fb_id',37 'p_do_reduced_vat_base_sum': fields.related('purchase_fb_id',
43 'do_reduced_vat_tax_sum',38 'do_reduced_vat_base_sum',
44 type="float",39 type="float",
45 readonly=True,40 readonly=True,
46 store=True,),41 store=True,),
47 'p_tax_amount' : fields.related('purchase_fb_id',42 'p_do_reduced_vat_tax_sum': fields.related('purchase_fb_id',
43 'do_reduced_vat_tax_sum',
44 type="float",
45 readonly=True,
46 store=True,),
47 'p_tax_amount': fields.related('purchase_fb_id',
48 'tax_amount',48 'tax_amount',
49 type="float",49 type="float",
50 readonly=True,50 readonly=True,
51 store=True,),51 store=True,),
52 'sale_fb_id':fields.many2one('fiscal.book', 'Sale Fiscal Book',52 'sale_fb_id': fields.many2one('fiscal.book', 'Sale Fiscal Book',
53 help='Sale Fiscal Book'),53 help='Sale Fiscal Book'),
54 's_do_sdcf_and_exempt_sum' : fields.related('sale_fb_id',54 's_do_sdcf_and_exempt_sum': fields.related('sale_fb_id',
55 'do_sdcf_and_exempt_sum',55 'do_sdcf_and_exempt_sum',
56 type="float",56 type="float",
57 readonly=True,57 readonly=True,
58 store=True,),58 store=True,),
59 's_imex_vat_base_sum' : fields.related('sale_fb_id',59 's_imex_vat_base_sum': fields.related('sale_fb_id',
60 'imex_vat_base_sum',60 'imex_vat_base_sum',
61 type="float",61 type="float",
62 readonly=True,62 readonly=True,
63 store=True,),63 store=True,),
64 's_get_vat_sdcf_sum' : fields.related('sale_fb_id',64 's_get_vat_sdcf_sum': fields.related('sale_fb_id',
65 'get_vat_sdcf_sum',65 'get_vat_sdcf_sum',
66 type="float",66 type="float",
67 readonly=True,67 readonly=True,
68 store=True,),68 store=True,),
69 's_imex_general_vat_base_sum' : fields.related('sale_fb_id',69 's_imex_general_vat_base_sum': fields.related('sale_fb_id',
70 'imex_general_vat_base_sum',70 'imex_general_vat_base_sum',
71 type="float",71 type="float",
72 readonly=True,72 readonly=True,
73 store=True,),73 store=True,),
74 's_imex_general_vat_tax_sum' : fields.related('sale_fb_id',74 's_imex_general_vat_tax_sum': fields.related('sale_fb_id',
75 'imex_general_vat_tax_sum',75 'imex_general_vat_tax_sum',
76 type="float",76 type="float",
77 readonly=True,77 readonly=True,
78 store=True),78 store=True),
79 's_imex_additional_vat_base_sum' : fields.related('sale_fb_id',79 's_imex_additional_vat_base_sum': fields.related('sale_fb_id',
80 'imex_additional_vat_base_sum',80 'imex_additional_vat_base_sum',
81 type="float",
82 readonly=True,
83 store=True),
84 's_imex_additional_vat_tax_sum' : fields.related('sale_fb_id',
85 'imex_additional_vat_tax_sum',
86 type="float",
87 readonly=True,
88 store=True),
89 's_imex_reduced_vat_base_sum' : fields.related('sale_fb_id',
90 'imex_reduced_vat_base_sum',
91 type="float",
92 readonly=True,
93 store=True),
94 's_imex_reduced_vat_tax_sum' : fields.related('sale_fb_id',
95 'imex_reduced_vat_tax_sum',
96 type="float",
97 readonly=True,
98 store=True),
99 's_do_general_vat_base_sum' : fields.related('sale_fb_id',
100 'do_general_vat_base_sum',
101 type="float",
102 readonly=True,
103 store=True),
104 's_do_general_vat_tax_sum' : fields.related('sale_fb_id',
105 'do_general_vat_tax_sum',
106 type="float",
107 readonly=True,
108 store=True),
109 's_do_additional_vat_base_sum' : fields.related('sale_fb_id',
110 'do_additional_vat_base_sum',
111 type="float",
112 readonly=True,
113 store=True),
114 's_do_additional_vat_tax_sum' : fields.related('sale_fb_id',
115 'do_additional_vat_tax_sum',
116 type="float",81 type="float",
117 readonly=True,82 readonly=True,
118 store=True),83 store=True),
119 's_do_reduced_vat_base_sum' : fields.related('sale_fb_id',84 's_imex_additional_vat_tax_sum': fields.related('sale_fb_id',
120 'do_reduced_vat_base_sum',85 'imex_additional_vat_tax_sum',
121 type="float",86 type="float",
122 readonly=True,87 readonly=True,
123 store=True),88 store=True),
124 's_do_reduced_vat_tax_sum' : fields.related('sale_fb_id',89 's_imex_reduced_vat_base_sum': fields.related('sale_fb_id',
125 'do_reduced_vat_tax_sum',90 'imex_reduced_vat_base_sum',
126 type="float",91 type="float",
127 readonly=True,92 readonly=True,
128 store=True),93 store=True),
129 's_base_amount' : fields.related('sale_fb_id',94 's_imex_reduced_vat_tax_sum': fields.related('sale_fb_id',
95 'imex_reduced_vat_tax_sum',
96 type="float",
97 readonly=True,
98 store=True),
99 's_do_general_vat_base_sum': fields.related('sale_fb_id',
100 'do_general_vat_base_sum',
101 type="float",
102 readonly=True,
103 store=True),
104 's_do_general_vat_tax_sum': fields.related('sale_fb_id',
105 'do_general_vat_tax_sum',
106 type="float",
107 readonly=True,
108 store=True),
109 's_do_additional_vat_base_sum': fields.related('sale_fb_id',
110 'do_additional_vat_base_sum',
111 type="float",
112 readonly=True,
113 store=True),
114 's_do_additional_vat_tax_sum': fields.related('sale_fb_id',
115 'do_additional_vat_tax_sum',
116 type="float",
117 readonly=True,
118 store=True),
119 's_do_reduced_vat_base_sum': fields.related('sale_fb_id',
120 'do_reduced_vat_base_sum',
121 type="float",
122 readonly=True,
123 store=True),
124 's_do_reduced_vat_tax_sum': fields.related('sale_fb_id',
125 'do_reduced_vat_tax_sum',
126 type="float",
127 readonly=True,
128 store=True),
129 's_base_amount': fields.related('sale_fb_id',
130 'base_amount',130 'base_amount',
131 type="float",131 type="float",
132 readonly=True,132 readonly=True,
133 store=True),133 store=True),
134 's_tax_amount' : fields.related('sale_fb_id',134 's_tax_amount': fields.related('sale_fb_id',
135 'tax_amount',135 'tax_amount',
136 type="float",136 type="float",
137 readonly=True,137 readonly=True,
138 store=True),138 store=True),
139 'start_date' : fields.date(string='Start date'),139 'start_date': fields.date(string='Start date'),
140140
141 'vat' : fields.related('company_id',141 'vat': fields.related('company_id',
142 'partner_id',142 'partner_id',
143 'vat',143 'vat',
144 type='char',144 type='char',
145 string='TIN',145 string='TIN',
146 readonly=True,146 readonly=True,
147 store=True),147 store=True),
148148
149149
150 }150 }
151 _defaults = {151 _defaults = {
152 'state': 'draft',152 'state': 'draft',
153 'company_id': lambda s,c,u,ctx: \153 'company_id': lambda s, c, u, ctx:
154 s.pool.get('res.users').browse(c,u,u,context=ctx).company_id.id,154 s.pool.get('res.users').browse(c, u, u, context=ctx).company_id.id,
155 'start_date': fields.date.today,155 'start_date': fields.date.today,
156 }156 }
157157
=== modified file 'l10n_ve_withholding/__init__.py'
--- l10n_ve_withholding/__init__.py 2012-12-05 10:06:09 +0000
+++ l10n_ve_withholding/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -23,6 +23,6 @@
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
2525
26import model 26from . import model
2727
28# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:28# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2929
=== modified file 'l10n_ve_withholding/__openerp__.py'
--- l10n_ve_withholding/__openerp__.py 2013-11-26 01:24:05 +0000
+++ l10n_ve_withholding/__openerp__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: javier@vauxoo.com 8# Coded by: javier@vauxoo.com
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -36,14 +36,14 @@
36- Add common tabs on views where they will be used to add information for other modules related to Venezuela. localization.36- Add common tabs on views where they will be used to add information for other modules related to Venezuela. localization.
3737
38TODO:38TODO:
39- 39-
40 """,40 """,
41 'init_xml': [],41 'init_xml': [],
42 "depends" : ["l10n_ve_fiscal_requirements"],42 "depends" : ["l10n_ve_fiscal_requirements"],
43 'update_xml': [43 'update_xml': [
44 'security/withholding_security.xml',44 'security/withholding_security.xml',
45 'security/ir.model.access.csv', 45 'security/ir.model.access.csv',
46 'data/l10n_ve_withholding_data.xml', 46 'data/l10n_ve_withholding_data.xml',
47 'view/l10n_ve_withholding_view.xml',47 'view/l10n_ve_withholding_view.xml',
48 'workflow/wh_action_server.xml',48 'workflow/wh_action_server.xml',
49 ],49 ],
5050
=== modified file 'l10n_ve_withholding/model/__init__.py'
--- l10n_ve_withholding/model/__init__.py 2013-05-22 20:31:12 +0000
+++ l10n_ve_withholding/model/__init__.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -23,7 +23,7 @@
23# along with this program. If not, see <http://www.gnu.org/licenses/>.23# along with this program. If not, see <http://www.gnu.org/licenses/>.
24################################################################################24################################################################################
2525
26import account26from . import account
27import invoice27from . import invoice
2828
29# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:29# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
3030
=== modified file 'l10n_ve_withholding/model/account.py'
--- l10n_ve_withholding/model/account.py 2014-07-11 17:47:27 +0000
+++ l10n_ve_withholding/model/account.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -27,35 +27,36 @@
27from openerp.tools.translate import _27from openerp.tools.translate import _
28import time28import time
2929
30__TYPES__ =[('sale', 'Sale'),30__TYPES__ = [('sale', 'Sale'),
31 ('sale_refund','Sale Refund'), 31 ('sale_refund', 'Sale Refund'),
32 ('purchase', 'Purchase'), 32 ('purchase', 'Purchase'),
33 ('purchase_refund','Purchase Refund'), 33 ('purchase_refund', 'Purchase Refund'),
34 ('cash', 'Cash'), 34 ('cash', 'Cash'),
35 ('bank', 'Bank and Cheques'), 35 ('bank', 'Bank and Cheques'),
36 ('general', 'General'), 36 ('general', 'General'),
37 ('situation', 'Opening/Closing Situation'),37 ('situation', 'Opening/Closing Situation'),
38 ('sale_debit', 'Sale Debit'),38 ('sale_debit', 'Sale Debit'),
39 ('purchase_debit', 'Purchase Debit'),39 ('purchase_debit', 'Purchase Debit'),
40 ('iva_sale', 'Sale Wh VAT'), 40 ('iva_sale', 'Sale Wh VAT'),
41 ('iva_purchase', 'Purchase Wh VAT'), 41 ('iva_purchase', 'Purchase Wh VAT'),
42 ('islr_purchase', 'Purchase Wh Income'), 42 ('islr_purchase', 'Purchase Wh Income'),
43 ('islr_sale', 'Sale Wh Income'), 43 ('islr_sale', 'Sale Wh Income'),
44 ('mun_sale', 'Sale Wh County'), 44 ('mun_sale', 'Sale Wh County'),
45 ('mun_purchase', 'Purchase Wh County'),45 ('mun_purchase', 'Purchase Wh County'),
46 ('src_sale', 'Sale Wh src'), 46 ('src_sale', 'Sale Wh src'),
47 ('src_purchase', 'Purchase Wh src')]47 ('src_purchase', 'Purchase Wh src')]
48
4849
49class account_journal(osv.osv):50class account_journal(osv.osv):
50 _inherit = 'account.journal'51 _inherit = 'account.journal'
51 52
52 _columns = {'type': fields.selection(__TYPES__, 'Type', size=32, required=True, 53 _columns = {'type': fields.selection(__TYPES__, 'Type', size=32, required=True,
53 help = "Select 'Sale' for customer invoices journals."\54 help="Select 'Sale' for customer invoices journals."
54 " Select 'Purchase' for supplier invoices journals."\55 " Select 'Purchase' for supplier invoices journals."
55 " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."\56 " Select 'Cash' or 'Bank' for journals that are used in customer or supplier payments."
56 " Select 'General' for miscellaneous operations journals."\57 " Select 'General' for miscellaneous operations journals."
57 " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\58 " Select 'Opening/Closing Situation' for entries generated for new fiscal years."
58 " Select 'Sale Debit' for customer debit note journals."\59 " Select 'Sale Debit' for customer debit note journals."
59 " Select 'Purchase Debit' for supplier debit note journals."60 " Select 'Purchase Debit' for supplier debit note journals."
60 " Select 'Sale Wh VAT' for customer vat withholding journals."61 " Select 'Sale Wh VAT' for customer vat withholding journals."
61 " Select 'Purchase Wh VAT' for supplier vat withholding journals."62 " Select 'Purchase Wh VAT' for supplier vat withholding journals."
@@ -65,16 +66,17 @@
65 " Select 'Purchase Wh County' for supplier municipal withholding journals."66 " Select 'Purchase Wh County' for supplier municipal withholding journals."
66 " Select 'Sale Wh SRC' for customer social withholding journals."67 " Select 'Sale Wh SRC' for customer social withholding journals."
67 " Select 'Purchase Wh SRC' for supplier social withholding journals."68 " Select 'Purchase Wh SRC' for supplier social withholding journals."
68 )69 )
69 }70 }
7071
71account_journal()72account_journal()
7273
74
73class account_period(osv.osv):75class account_period(osv.osv):
74 _inherit = "account.period"76 _inherit = "account.period"
7577
76 def _find_fortnight(self, cr, uid, dt=None, context=None):78 def _find_fortnight(self, cr, uid, dt=None, context=None):
77 """ This Function returns a tuple composed of 79 """ This Function returns a tuple composed of
78 *) period for the asked dt (int)80 *) period for the asked dt (int)
79 *) fortnight for the asked dt (boolean):81 *) fortnight for the asked dt (boolean):
80 -) False: for the 1st. fortnight82 -) False: for the 1st. fortnight
@@ -82,26 +84,27 @@
82 Example:84 Example:
83 (3,True) => a period whose id is 3 in the second fortnight85 (3,True) => a period whose id is 3 in the second fortnight
84 """86 """
85 if context is None: context = {}87 if context is None:
88 context = {}
86 if not dt:89 if not dt:
87 dt = time.strftime('%Y-%m-%d')90 dt = time.strftime('%Y-%m-%d')
88 period_ids = self.find(cr,uid,dt=dt,context=context)91 period_ids = self.find(cr, uid, dt=dt, context=context)
89 do = [('special','=',False),('id','in',period_ids)]92 do = [('special', '=', False), ('id', 'in', period_ids)]
90 #Due to the fact that demo data for periods sets 'special' as True on them, this little93 # Due to the fact that demo data for periods sets 'special' as True on them, this little
91 #hack is necesary if this issue is solved we should ask directly for the 94 # hack is necesary if this issue is solved we should ask directly for the
92 #refer to this bug for more information 95 # refer to this bug for more information
93 #https://bugs.launchpad.net/openobject-addons/+bug/92420096 # https://bugs.launchpad.net/openobject-addons/+bug/924200
94 demo_enabled = self.pool.get('ir.module.module').search(cr, uid,97 demo_enabled = self.pool.get('ir.module.module').search(cr, uid,
95 [('name', '=', 'base'),98 [('name', '=', 'base'),
96 ('demo', '=', True)])99 ('demo', '=', True)])
97 domain = demo_enabled and [do[1]] or do100 domain = demo_enabled and [do[1]] or do
98 #### End of hack, dear future me I am really sorry for this....101 # End of hack, dear future me I am really sorry for this....
99 period_ids = self.search(cr, uid, domain, context = context)102 period_ids = self.search(cr, uid, domain, context=context)
100 if not period_ids:103 if not period_ids:
101 raise osv.except_osv(_('Error looking Fortnight !'), _('There is no "Special" period defined for this date: %s.')%dt)104 raise osv.except_osv(_('Error looking Fortnight !'), _('There is no "Special" period defined for this date: %s.') % dt)
102 105
103 fortnight= False if time.strptime(dt, '%Y-%m-%d').tm_mday <= 15 else True106 fortnight = False if time.strptime(dt, '%Y-%m-%d').tm_mday <= 15 else True
104 return (period_ids[0],fortnight)107 return (period_ids[0], fortnight)
105108
106 def find_fortnight(self, cr, uid, dt=None, context=None):109 def find_fortnight(self, cr, uid, dt=None, context=None):
107 """110 """
@@ -110,7 +113,7 @@
110 """113 """
111 # TODO: fix this workaround in version 8.0 [hbto notes]114 # TODO: fix this workaround in version 8.0 [hbto notes]
112 context = context or {}115 context = context or {}
113 p,f = self._find_fortnight(cr, uid, dt=dt, context=context)116 p, f = self._find_fortnight(cr, uid, dt=dt, context=context)
114 return p, str(f)117 return p, str(f)
115118
116# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:119# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
117120
=== modified file 'l10n_ve_withholding/model/invoice.py'
--- l10n_ve_withholding/model/invoice.py 2013-12-10 15:52:19 +0000
+++ l10n_ve_withholding/model/invoice.py 2014-10-11 00:06:17 +0000
@@ -5,7 +5,7 @@
5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).5# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
6# All Rights Reserved6# All Rights Reserved
7###############Credits######################################################7###############Credits######################################################
8# Coded by: Vauxoo C.A. 8# Coded by: Vauxoo C.A.
9# Planified by: Nhomar Hernandez9# Planified by: Nhomar Hernandez
10# Audited by: Vauxoo C.A.10# Audited by: Vauxoo C.A.
11#############################################################################11#############################################################################
@@ -25,58 +25,58 @@
2525
26import time26import time
27from openerp.osv import fields, osv27from openerp.osv import fields, osv
28from openerp.addons import decimal_precision as dp
29from openerp.tools.translate import _28from openerp.tools.translate import _
3029
30
31class account_invoice(osv.osv):31class account_invoice(osv.osv):
32 _inherit = 'account.invoice'32 _inherit = 'account.invoice'
33 33
34 def _get_move_lines(self, cr, uid, ids, to_wh, period_id, 34 def _get_move_lines(self, cr, uid, ids, to_wh, period_id,
35 pay_journal_id, writeoff_acc_id, 35 pay_journal_id, writeoff_acc_id,
36 writeoff_period_id, writeoff_journal_id, date, 36 writeoff_period_id, writeoff_journal_id, date,
37 name, context=None):37 name, context=None):
38 """ Function openerp is rewritten for adaptation in38 """ Function openerp is rewritten for adaptation in
39 the ovl39 the ovl
40 """40 """
41 if context is None: context = {}41 if context is None:
42 context = {}
42 return []43 return []
4344
44 def ret_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, 45 def ret_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id,
45 period_id, pay_journal_id, writeoff_acc_id, 46 period_id, pay_journal_id, writeoff_acc_id,
46 writeoff_period_id, writeoff_journal_id, date, 47 writeoff_period_id, writeoff_journal_id, date,
47 name, to_wh, context=None):48 name, to_wh, context=None):
48 """ Make the payment of the invoice 49 """ Make the payment of the invoice
49 """50 """
50 if context is None:51 if context is None:
51 context = {}52 context = {}
52 rp_obj = self.pool.get('res.partner')53 rp_obj = self.pool.get('res.partner')
53 54
54 #TODO check if we can use different period for payment and the writeoff line55 # TODO check if we can use different period for payment and the writeoff line
55 assert len(ids)==1, "Can only pay one invoice at a time"56 assert len(ids) == 1, "Can only pay one invoice at a time"
56 invoice = self.browse(cr, uid, ids[0])57 invoice = self.browse(cr, uid, ids[0])
57 src_account_id = invoice.account_id.id58 src_account_id = invoice.account_id.id
58 59
59 # Take the seq as name for move60 # Take the seq as name for move
60 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}61 types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
61 direction = types[invoice.type]62 direction = types[invoice.type]
62 l1 = {63 l1 = {
63 'debit': direction * pay_amount>0 and direction * pay_amount,64 'debit': direction * pay_amount > 0 and direction * pay_amount,
64 'credit': direction * pay_amount<0 and - direction * pay_amount,65 'credit': direction * pay_amount < 0 and - direction * pay_amount,
65 'account_id': src_account_id,66 'account_id': src_account_id,
66 'partner_id': rp_obj._find_accounting_partner(invoice.partner_id).id,67 'partner_id': rp_obj._find_accounting_partner(invoice.partner_id).id,
67 'ref':invoice.number,68 'ref': invoice.number,
68 'date': date,69 'date': date,
69 'currency_id': False,70 'currency_id': False,
70 'name':name71 'name': name
71 }72 }
72 lines = [(0, 0, l1)]73 lines = [(0, 0, l1)]
73 74
74 l2 = self._get_move_lines(cr, uid, ids, to_wh, period_id, 75 l2 = self._get_move_lines(cr, uid, ids, to_wh, period_id,
75 pay_journal_id, writeoff_acc_id, 76 pay_journal_id, writeoff_acc_id,
76 writeoff_period_id, writeoff_journal_id, date, 77 writeoff_period_id, writeoff_journal_id, date,
77 name, context=context)78 name, context=context)
78 79
79
80 if not l2:80 if not l2:
81 raise osv.except_osv(_('Warning !'), _('No accounting moves were created.\n Please, Check if there are Taxes/Concepts to withhold in the Invoices!'))81 raise osv.except_osv(_('Warning !'), _('No accounting moves were created.\n Please, Check if there are Taxes/Concepts to withhold in the Invoices!'))
82 lines += l282 lines += l2
@@ -89,13 +89,13 @@
89 line_ids = []89 line_ids = []
90 total = 0.090 total = 0.0
91 line = self.pool.get('account.move.line')91 line = self.pool.get('account.move.line')
92 cr.execute('select id from account_move_line where move_id in ('+str(move_id)+','+str(invoice.move_id.id)+')')92 cr.execute('select id from account_move_line where move_id in (' + str(move_id) + ',' + str(invoice.move_id.id) + ')')
93 lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()) )93 lines = line.browse(cr, uid, map(lambda x: x[0], cr.fetchall()))
94 for l in lines+invoice.payment_ids:94 for l in lines + invoice.payment_ids:
95 if l.account_id.id==src_account_id:95 if l.account_id.id == src_account_id:
96 line_ids.append(l.id)96 line_ids.append(l.id)
97 total += (l.debit or 0.0) - (l.credit or 0.0)97 total += (l.debit or 0.0) - (l.credit or 0.0)
98 if (not round(total,self.pool.get('decimal.precision').precision_get(cr, uid, 'Withhold'))) or writeoff_acc_id:98 if (not round(total, self.pool.get('decimal.precision').precision_get(cr, uid, 'Withhold'))) or writeoff_acc_id:
99 self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context)99 self.pool.get('account.move.line').reconcile(cr, uid, line_ids, 'manual', writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context)
100 else:100 else:
101 self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)101 self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
@@ -116,21 +116,21 @@
116 moves = self.move_line_id_payment_get(cr, uid, [invoice.id])116 moves = self.move_line_id_payment_get(cr, uid, [invoice.id])
117 src = []117 src = []
118 for m in self.pool.get('account.move.line').browse(cr, uid, moves):118 for m in self.pool.get('account.move.line').browse(cr, uid, moves):
119 temp_lines = []#Added temp list to avoid duplicate records119 temp_lines = [] # Added temp list to avoid duplicate records
120 if m.reconcile_id:120 if m.reconcile_id:
121 temp_lines = [i.id for i in m.reconcile_id.line_id]121 temp_lines = [i.id for i in m.reconcile_id.line_id]
122 elif m.reconcile_partial_id:122 elif m.reconcile_partial_id:
The diff has been truncated for viewing.