Merge lp:~vauxoo/openerp-venezuela-localization/7.0-pylint5-dev-sabrina into lp:openerp-venezuela-localization
- 7.0-pylint5-dev-sabrina
- Merge into trunk
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 |
Related bugs: |
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 |
Commit message
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 : | # |
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
1 | === modified file 'l10n_ve_fiscal_book/__init__.py' | |||
2 | --- l10n_ve_fiscal_book/__init__.py 2013-04-30 18:17:08 +0000 | |||
3 | +++ l10n_ve_fiscal_book/__init__.py 2014-10-11 00:06:17 +0000 | |||
4 | @@ -4,7 +4,7 @@ | |||
5 | 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. |
6 | 5 | # Javier Duran <javier@vauxoo.com> | 5 | # Javier Duran <javier@vauxoo.com> |
7 | 6 | # Nhomar Hernandéz <nhomar@vauxoo.com> | 6 | # Nhomar Hernandéz <nhomar@vauxoo.com> |
9 | 7 | # | 7 | # |
10 | 8 | # | 8 | # |
11 | 9 | # WARNING: This program as such is intended to be used by professional | 9 | # WARNING: This program as such is intended to be used by professional |
12 | 10 | # programmers who take the whole responsability of assessing all potential | 10 | # programmers who take the whole responsability of assessing all potential |
13 | @@ -29,5 +29,5 @@ | |||
14 | 29 | # | 29 | # |
15 | 30 | ############################################################################## | 30 | ############################################################################## |
16 | 31 | 31 | ||
19 | 32 | import model | 32 | from . import model |
20 | 33 | import wizard | 33 | from . import wizard |
21 | 34 | 34 | ||
22 | === modified file 'l10n_ve_fiscal_book/__openerp__.py' | |||
23 | --- l10n_ve_fiscal_book/__openerp__.py 2014-09-19 15:18:43 +0000 | |||
24 | +++ l10n_ve_fiscal_book/__openerp__.py 2014-10-11 00:06:17 +0000 | |||
25 | @@ -4,7 +4,7 @@ | |||
26 | 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. |
27 | 5 | # Luis Escobar <luis@vauxoo.com> | 5 | # Luis Escobar <luis@vauxoo.com> |
28 | 6 | # Tulio Ruiz <tulio@vauxoo.com> | 6 | # Tulio Ruiz <tulio@vauxoo.com> |
30 | 7 | # | 7 | # |
31 | 8 | # | 8 | # |
32 | 9 | # WARNING: This program as such is intended to be used by professional | 9 | # WARNING: This program as such is intended to be used by professional |
33 | 10 | # programmers who take the whole responsability of assessing all potential | 10 | # programmers who take the whole responsability of assessing all potential |
34 | @@ -40,7 +40,7 @@ | |||
35 | 40 | Build all Fiscal Reports for Law in Venezuela. | 40 | Build all Fiscal Reports for Law in Venezuela. |
36 | 41 | Add 2 new columns because of: | 41 | Add 2 new columns because of: |
37 | 42 | 42 | ||
39 | 43 | Según Articulo 77 del Reglamento de la Ley del IVA No.5.363 del 12 de Julio de 1999. | 43 | Según Articulo 77 del Reglamento de la Ley del IVA No.5.363 del 12 de Julio de 1999. |
40 | 44 | Pará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. | 44 | Pará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. |
41 | 45 | 45 | ||
42 | 46 | .. note:: | 46 | .. note:: |
43 | 47 | 47 | ||
44 | === modified file 'l10n_ve_fiscal_book/adjustment_book.py' | |||
45 | --- l10n_ve_fiscal_book/adjustment_book.py 2014-01-08 20:42:28 +0000 | |||
46 | +++ l10n_ve_fiscal_book/adjustment_book.py 2014-10-11 00:06:17 +0000 | |||
47 | @@ -7,7 +7,7 @@ | |||
48 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
49 | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> |
50 | 9 | # María Gabriela Quilarque <gabrielaquilarque97@gmail.com> | 9 | # María Gabriela Quilarque <gabrielaquilarque97@gmail.com> |
52 | 10 | # Javier Duran <javier@vauxoo.com> | 10 | # Javier Duran <javier@vauxoo.com> |
53 | 11 | # Planified by: Nhomar Hernandez | 11 | # Planified by: Nhomar Hernandez |
54 | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve |
55 | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve |
56 | @@ -25,29 +25,25 @@ | |||
57 | 25 | # You should have received a copy of the GNU Affero General Public License | 25 | # You should have received a copy of the GNU Affero General Public License |
58 | 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/>. |
59 | 27 | ############################################################################## | 27 | ############################################################################## |
66 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
61 | 29 | from openerp.osv import fields | ||
62 | 30 | from openerp.tools.translate import _ | ||
63 | 31 | from openerp.tools import config | ||
64 | 32 | import time | ||
65 | 33 | import datetime | ||
67 | 34 | from openerp.addons import decimal_precision as dp | 29 | from openerp.addons import decimal_precision as dp |
68 | 35 | 30 | ||
69 | 31 | |||
70 | 36 | class adjustment_book(osv.osv): | 32 | class adjustment_book(osv.osv): |
71 | 37 | 33 | ||
73 | 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): |
74 | 39 | res = {} | 35 | res = {} |
76 | 40 | for adj in self.browse(cr,uid,ids,context): | 36 | for adj in self.browse(cr, uid, ids, context): |
77 | 41 | res[adj.id] = { | 37 | res[adj.id] = { |
78 | 42 | 'amount_total': 0.0, | 38 | 'amount_total': 0.0, |
80 | 43 | 'amount_untaxed_n_total' : 0.0, | 39 | 'amount_untaxed_n_total': 0.0, |
81 | 44 | 'amount_with_vat_n_total': 0.0, | 40 | 'amount_with_vat_n_total': 0.0, |
83 | 45 | 'amount_untaxed_i_total' : 0.0, | 41 | 'amount_untaxed_i_total': 0.0, |
84 | 46 | 'amount_with_vat_i_total': 0.0, | 42 | 'amount_with_vat_i_total': 0.0, |
89 | 47 | 'uncredit_fiscal_total' : 0.0, | 43 | 'uncredit_fiscal_total': 0.0, |
90 | 48 | 'amount_with_vat_total' : 0.0, | 44 | 'amount_with_vat_total': 0.0, |
91 | 49 | 'amount_base_total' : 0.0, | 45 | 'amount_base_total': 0.0, |
92 | 50 | 'amount_percent_total' : 0.0, | 46 | 'amount_percent_total': 0.0, |
93 | 51 | } | 47 | } |
94 | 52 | for line in adj.adjustment_ids: | 48 | for line in adj.adjustment_ids: |
95 | 53 | res[adj.id]['amount_total'] += line.amount | 49 | res[adj.id]['amount_total'] += line.amount |
96 | @@ -57,134 +53,129 @@ | |||
97 | 57 | res[adj.id]['amount_with_vat_i_total'] += line.amount_with_vat_i | 53 | res[adj.id]['amount_with_vat_i_total'] += line.amount_with_vat_i |
98 | 58 | res[adj.id]['uncredit_fiscal_total'] += line.uncredit_fiscal | 54 | res[adj.id]['uncredit_fiscal_total'] += line.uncredit_fiscal |
99 | 59 | res[adj.id]['amount_with_vat_total'] += line.amount_with_vat | 55 | res[adj.id]['amount_with_vat_total'] += line.amount_with_vat |
105 | 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 +\ |
106 | 61 | adj.vat_general_add_n+adj.vat_reduced_n+adj.adjustment+adj.no_grav+adj.sale_export | 57 | adj.vat_general_add_n + adj.vat_reduced_n + adj.adjustment + adj.no_grav + adj.sale_export |
107 | 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 +\ |
108 | 63 | adj.vat_general_add_ncf+adj.vat_reduced_ncf+adj.adjustment_cf+adj.sale_export_cf | 59 | adj.vat_general_add_ncf + adj.vat_reduced_ncf + adj.adjustment_cf + adj.sale_export_cf |
109 | 64 | 60 | ||
110 | 65 | return res | 61 | return res |
111 | 66 | 62 | ||
118 | 67 | _name='adjustment.book' | 63 | _name = 'adjustment.book' |
119 | 68 | _columns={ | 64 | _columns = { |
120 | 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"), |
121 | 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"), |
122 | 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'), |
123 | 72 | 'note': fields.text('Note',required=True), | 68 | 'note': fields.text('Note', required=True), |
124 | 73 | 'type': fields.selection([ | 69 | 'type': fields.selection([ |
126 | 74 | ('sale','Sale'), | 70 | ('sale', 'Sale'), |
127 | 75 | ('purchase', 'Purchase'), | 71 | ('purchase', 'Purchase'), |
155 | 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"), |
156 | 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"), |
157 | 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"), |
158 | 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"), |
159 | 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"), |
160 | 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"), |
161 | 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"), |
162 | 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"), |
163 | 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"), |
164 | 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"), |
165 | 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"), |
166 | 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"), |
167 | 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"), |
168 | 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"), |
169 | 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"), |
170 | 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"), |
171 | 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"), |
172 | 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"), |
173 | 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"), |
174 | 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"), |
175 | 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"), |
176 | 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"), |
177 | 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"), |
178 | 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"), |
179 | 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"), |
180 | 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"), |
181 | 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"), |
182 | 103 | } | 99 | } |
183 | 104 | 100 | ||
184 | 105 | _sql_constraints = [ | 101 | _sql_constraints = [ |
185 | 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!') |
186 | 107 | ] | 103 | ] |
189 | 108 | 104 | ||
188 | 109 | |||
190 | 110 | #~ def action_set_totals(self,cr,uid,ids, *args): | 105 | #~ def action_set_totals(self,cr,uid,ids, *args): |
234 | 111 | #~ self.write(cr, uid, ids, {'vat_general_i':0.00, | 106 | #~ self.write(cr, uid, ids, {'vat_general_i':0.00, |
235 | 112 | #~ 'vat_general_add_i':0.00,'vat_reduced_i':0.00, | 107 | #~ 'vat_general_add_i':0.00,'vat_reduced_i':0.00, |
236 | 113 | #~ 'vat_general_n':0.00,'vat_general_add_n':0.00, | 108 | #~ 'vat_general_n':0.00,'vat_general_add_n':0.00, |
237 | 114 | #~ 'vat_reduced_n':0.00,'sale_export':0.00, | 109 | #~ 'vat_reduced_n':0.00,'sale_export':0.00, |
238 | 115 | #~ }) | 110 | #~ }) |
239 | 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, |
240 | 117 | #~ 'amount_untaxed_i':0.0,'amount_untaxed_i_scdf':0.0, | 112 | #~ 'amount_untaxed_i':0.0,'amount_untaxed_i_scdf':0.0, |
241 | 118 | #~ 'vat_general_ncf':0.0,'vat_general_ncf':0.0, | 113 | #~ 'vat_general_ncf':0.0,'vat_general_ncf':0.0, |
242 | 119 | #~ 'vat_add_ncf':0.0} | 114 | #~ 'vat_add_ncf':0.0} |
243 | 120 | #~ | 115 | #~ |
244 | 121 | #~ for adj in self.browse(cr, uid, ids): | 116 | #~ for adj in self.browse(cr, uid, ids): |
245 | 122 | #~ if adj.type=='purchase': | 117 | #~ if adj.type=='purchase': |
246 | 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, |
247 | 124 | #~ 'vat_general_add_i':adj.amount_untaxed_i_total, | 119 | #~ 'vat_general_add_i':adj.amount_untaxed_i_total, |
248 | 125 | #~ 'vat_reduced_i':adj.amount_untaxed_i_total,}) | 120 | #~ 'vat_reduced_i':adj.amount_untaxed_i_total,}) |
249 | 126 | #~ else: | 121 | #~ else: |
250 | 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,}) |
251 | 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, |
252 | 129 | #~ 'vat_general_add_n':adj.amount_untaxed_n_total, | 124 | #~ 'vat_general_add_n':adj.amount_untaxed_n_total, |
253 | 130 | #~ 'vat_reduced_n':adj.amount_untaxed_n_total, | 125 | #~ 'vat_reduced_n':adj.amount_untaxed_n_total, |
254 | 131 | #~ }) | 126 | #~ }) |
255 | 132 | #~ for line in adj.adjustment_ids: | 127 | #~ for line in adj.adjustment_ids: |
256 | 133 | #~ | 128 | #~ |
257 | 134 | #~ if 0==line.percent_with_vat_n: | 129 | #~ if 0==line.percent_with_vat_n: |
258 | 135 | #~ total['amount_untaxed_n_scdf']+=line.amount_untaxed_n | 130 | #~ total['amount_untaxed_n_scdf']+=line.amount_untaxed_n |
259 | 136 | #~ total['amount_untaxed_i_scdf']+=line.amount_untaxed_i | 131 | #~ total['amount_untaxed_i_scdf']+=line.amount_untaxed_i |
260 | 137 | #~ else: | 132 | #~ else: |
261 | 138 | #~ total['amount_untaxed_n']+=line.amount_untaxed_n | 133 | #~ total['amount_untaxed_n']+=line.amount_untaxed_n |
262 | 139 | #~ total['amount_untaxed_i']+=line.amount_untaxed_i | 134 | #~ total['amount_untaxed_i']+=line.amount_untaxed_i |
263 | 140 | #~ if 12 == line.percent_with_vat_n: | 135 | #~ if 12 == line.percent_with_vat_n: |
264 | 141 | #~ total['vat_general_ncf']+=12.0 | 136 | #~ total['vat_general_ncf']+=12.0 |
265 | 142 | #~ if 8 == line.percent_with_vat_n: | 137 | #~ if 8 == line.percent_with_vat_n: |
266 | 143 | #~ total['vat_reduced_ncf']+=8.0 | 138 | #~ total['vat_reduced_ncf']+=8.0 |
267 | 144 | #~ if 22 == line.percent_with_vat_n: | 139 | #~ if 22 == line.percent_with_vat_n: |
268 | 145 | #~ total['vat_additional_ncf']+=22.0 | 140 | #~ total['vat_additional_ncf']+=22.0 |
269 | 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'], |
270 | 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'], |
271 | 148 | #~ 'vat_reduced_n':total['vat_reduced_n'], | 143 | #~ 'vat_reduced_n':total['vat_reduced_n'], |
272 | 149 | #~ }) | 144 | #~ }) |
273 | 150 | #~ return True | 145 | #~ return True |
274 | 151 | 146 | ||
275 | 152 | 147 | ||
233 | 153 | |||
276 | 154 | adjustment_book() | 148 | adjustment_book() |
277 | 155 | 149 | ||
278 | 156 | 150 | ||
279 | 157 | class adjustment_book_line(osv.osv): | 151 | class adjustment_book_line(osv.osv): |
290 | 158 | 152 | ||
291 | 159 | _name='adjustment.book.line' | 153 | _name = 'adjustment.book.line' |
292 | 160 | _columns={ | 154 | _columns = { |
293 | 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"), |
294 | 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"), |
295 | 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"), |
296 | 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"), |
297 | 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"), |
298 | 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"), |
299 | 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"), |
300 | 168 | 'type_doc': fields.selection([ | 162 | 'type_doc': fields.selection([ |
302 | 169 | ('F','Invoice'), | 163 | ('F', 'Invoice'), |
303 | 170 | ('ND', 'Debit Note'), | 164 | ('ND', 'Debit Note'), |
304 | 171 | ('NC', 'Credit Note'), | 165 | ('NC', 'Credit Note'), |
317 | 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)"), |
318 | 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"), |
319 | 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"), |
320 | 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"), |
321 | 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"), |
322 | 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"), |
323 | 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"), |
324 | 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"), |
325 | 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"), |
326 | 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"), |
327 | 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"), |
328 | 183 | 'adjustment_id':fields.many2one('adjustment.book','Adjustment Book') | 177 | 'adjustment_id': fields.many2one('adjustment.book', 'Adjustment Book') |
329 | 184 | } | 178 | } |
330 | 185 | _rec_rame = 'partner' | 179 | _rec_rame = 'partner' |
332 | 186 | 180 | ||
333 | 187 | adjustment_book_line() | 181 | adjustment_book_line() |
334 | 188 | |||
335 | 189 | |||
336 | 190 | |||
337 | 191 | 182 | ||
338 | === modified file 'l10n_ve_fiscal_book/model/__init__.py' | |||
339 | --- l10n_ve_fiscal_book/model/__init__.py 2013-06-10 19:36:18 +0000 | |||
340 | +++ l10n_ve_fiscal_book/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
341 | @@ -4,7 +4,7 @@ | |||
342 | 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. |
343 | 5 | # Javier Duran <javier@vauxoo.com> | 5 | # Javier Duran <javier@vauxoo.com> |
344 | 6 | # Nhomar Hernandéz <nhomar@vauxoo.com> | 6 | # Nhomar Hernandéz <nhomar@vauxoo.com> |
346 | 7 | # | 7 | # |
347 | 8 | # | 8 | # |
348 | 9 | # WARNING: This program as such is intended to be used by professional | 9 | # WARNING: This program as such is intended to be used by professional |
349 | 10 | # programmers who take the whole responsability of assessing all potential | 10 | # programmers who take the whole responsability of assessing all potential |
350 | @@ -29,8 +29,8 @@ | |||
351 | 29 | # | 29 | # |
352 | 30 | ############################################################################## | 30 | ############################################################################## |
353 | 31 | 31 | ||
358 | 32 | import invoice | 32 | from . import invoice |
359 | 33 | import fiscal_book | 33 | from . import fiscal_book |
360 | 34 | import wh_iva | 34 | from . import wh_iva |
361 | 35 | import customs_form | 35 | from . import customs_form |
362 | 36 | 36 | ||
363 | 37 | 37 | ||
364 | === modified file 'l10n_ve_fiscal_book/model/customs_form.py' | |||
365 | --- l10n_ve_fiscal_book/model/customs_form.py 2013-06-10 19:36:18 +0000 | |||
366 | +++ l10n_ve_fiscal_book/model/customs_form.py 2014-10-11 00:06:17 +0000 | |||
367 | @@ -24,14 +24,12 @@ | |||
368 | 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/>. |
369 | 25 | ############################################################################### | 25 | ############################################################################### |
370 | 26 | from openerp.osv import fields, osv | 26 | from openerp.osv import fields, osv |
371 | 27 | import openerp.pooler | ||
372 | 28 | 27 | ||
373 | 29 | 28 | ||
374 | 30 | class customs_form(osv.osv): | 29 | class customs_form(osv.osv): |
375 | 31 | _inherit = 'customs.form' | 30 | _inherit = 'customs.form' |
376 | 32 | _columns = { | 31 | _columns = { |
377 | 33 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', | 32 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', |
379 | 34 | help='Fiscal Book where this customs form' \ | 33 | help='Fiscal Book where this customs form' |
380 | 35 | ' is srelated to'), | 34 | ' is srelated to'), |
381 | 36 | } | 35 | } |
382 | 37 | |||
383 | 38 | 36 | ||
384 | === modified file 'l10n_ve_fiscal_book/model/fiscal_book.py' | |||
385 | --- l10n_ve_fiscal_book/model/fiscal_book.py 2014-10-07 06:41:36 +0000 | |||
386 | +++ l10n_ve_fiscal_book/model/fiscal_book.py 2014-10-11 00:06:17 +0000 | |||
387 | @@ -67,7 +67,7 @@ | |||
388 | 67 | #~ TODO: ASK: what company, fisal.book.company_id? | 67 | #~ TODO: ASK: what company, fisal.book.company_id? |
389 | 68 | ru_obj = self.pool.get('res.users') | 68 | ru_obj = self.pool.get('res.users') |
390 | 69 | rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id | 69 | rc_brw = ru_obj.browse(cr, uid, uid, context=context).company_id |
392 | 70 | addr = rp_obj._find_accounting_partner(rc_brw.partner_id) | 70 | addr = rp_obj._find_accounting_partner(rc_brw.partner_id) |
393 | 71 | for fb_id in ids: | 71 | for fb_id in ids: |
394 | 72 | if addr: | 72 | if addr: |
395 | 73 | res[fb_id] = (addr.street or '') + \ | 73 | res[fb_id] = (addr.street or '') + \ |
396 | @@ -88,8 +88,8 @@ | |||
397 | 88 | "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"] | 88 | "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"] |
398 | 89 | res = {}.fromkeys(ids, '') | 89 | res = {}.fromkeys(ids, '') |
399 | 90 | for fb_brw in self.browse(cr, uid, ids, context=context): | 90 | for fb_brw in self.browse(cr, uid, ids, context=context): |
402 | 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] |
403 | 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] |
404 | 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) |
405 | 94 | return res | 94 | return res |
406 | 95 | 95 | ||
407 | @@ -115,8 +115,8 @@ | |||
408 | 115 | fbl_brw.total_with_iva | 115 | fbl_brw.total_with_iva |
409 | 116 | 116 | ||
410 | 117 | res[fb_brw.id]['get_total_with_iva_sum'] = \ | 117 | res[fb_brw.id]['get_total_with_iva_sum'] = \ |
413 | 118 | sum( [ res[fb_brw.id]["get_total_with_iva_" + optype + "_sum"] | 118 | sum([res[fb_brw.id]["get_total_with_iva_" + optype + "_sum"] |
414 | 119 | for optype in op_types ] ) | 119 | for optype in op_types]) |
415 | 120 | return res | 120 | return res |
416 | 121 | 121 | ||
417 | 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): |
418 | @@ -147,14 +147,14 @@ | |||
419 | 147 | tax_types = ['reduced', 'general', 'additional'] | 147 | tax_types = ['reduced', 'general', 'additional'] |
420 | 148 | 148 | ||
421 | 149 | res[fb_brw.id]['get_total_tax_credit_debit_base_sum'] += \ | 149 | res[fb_brw.id]['get_total_tax_credit_debit_base_sum'] += \ |
425 | 150 | sum( [ getattr(fb_brw, op + '_' + ttax + '_vat_base_sum') | 150 | sum([getattr(fb_brw, op + '_' + ttax + '_vat_base_sum') |
426 | 151 | for ttax in tax_types | 151 | for ttax in tax_types |
427 | 152 | for op in op_types ] ) | 152 | for op in op_types]) |
428 | 153 | 153 | ||
429 | 154 | res[fb_brw.id]['get_total_tax_credit_debit_tax_sum'] += \ | 154 | res[fb_brw.id]['get_total_tax_credit_debit_tax_sum'] += \ |
433 | 155 | sum( [ getattr(fb_brw, op + '_' + ttax + '_vat_tax_sum') | 155 | sum([getattr(fb_brw, op + '_' + ttax + '_vat_tax_sum') |
434 | 156 | for ttax in tax_types | 156 | for ttax in tax_types |
435 | 157 | for op in op_types ] ) | 157 | for op in op_types]) |
436 | 158 | return res | 158 | return res |
437 | 159 | 159 | ||
438 | 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): |
439 | @@ -220,7 +220,7 @@ | |||
440 | 220 | string='Status', required=True, readonly=True), | 220 | string='Status', required=True, readonly=True), |
441 | 221 | 'type': fields.selection([('sale', 'Sale Book'), | 221 | 'type': fields.selection([('sale', 'Sale Book'), |
442 | 222 | ('purchase', 'Purchase Book')], | 222 | ('purchase', 'Purchase Book')], |
444 | 223 | help="Select Sale for Customers and" \ | 223 | help="Select Sale for Customers and" |
445 | 224 | " Purchase for Suppliers", | 224 | " Purchase for Suppliers", |
446 | 225 | string='Book Type', required=True), | 225 | string='Book Type', required=True), |
447 | 226 | 'base_amount': fields.float('Taxable Amount', | 226 | 'base_amount': fields.float('Taxable Amount', |
448 | @@ -234,47 +234,47 @@ | |||
449 | 234 | 'fbts_ids': fields.one2many('fiscal.book.taxes.summary', 'fb_id', | 234 | 'fbts_ids': fields.one2many('fiscal.book.taxes.summary', 'fb_id', |
450 | 235 | 'Tax Summary'), | 235 | 'Tax Summary'), |
451 | 236 | 'invoice_ids': fields.one2many('account.invoice', 'fb_id', 'Invoices', | 236 | 'invoice_ids': fields.one2many('account.invoice', 'fb_id', 'Invoices', |
453 | 237 | help="Invoices being recorded in a" \ | 237 | help="Invoices being recorded in a" |
454 | 238 | " Fiscal Book"), | 238 | " Fiscal Book"), |
455 | 239 | 'issue_invoice_ids': fields.one2many('account.invoice', 'issue_fb_id', | 239 | 'issue_invoice_ids': fields.one2many('account.invoice', 'issue_fb_id', |
456 | 240 | 'Issue Invoices', | 240 | 'Issue Invoices', |
458 | 241 | help="Invoices that are in" \ | 241 | help="Invoices that are in" |
459 | 242 | " pending state cancel or draft"), | 242 | " pending state cancel or draft"), |
460 | 243 | 'iwdl_ids': fields.one2many('account.wh.iva.line', 'fb_id', | 243 | 'iwdl_ids': fields.one2many('account.wh.iva.line', 'fb_id', |
461 | 244 | 'Vat Withholdings', | 244 | 'Vat Withholdings', |
463 | 245 | help="Vat Withholdings being recorded" \ | 245 | help="Vat Withholdings being recorded" |
464 | 246 | " in a Fiscal Book"), | 246 | " in a Fiscal Book"), |
465 | 247 | 'cf_ids': fields.one2many('customs.form', 'fb_id', 'Customs Form', | 247 | 'cf_ids': fields.one2many('customs.form', 'fb_id', 'Customs Form', |
467 | 248 | help="Customs Form being recorded in the" \ | 248 | help="Customs Form being recorded in the" |
468 | 249 | " Fiscal Book"), | 249 | " Fiscal Book"), |
469 | 250 | 'abl_ids': fields.one2many('adjustment.book.line', 'fb_id', | 250 | 'abl_ids': fields.one2many('adjustment.book.line', 'fb_id', |
470 | 251 | 'Adjustment Lines', | 251 | 'Adjustment Lines', |
472 | 252 | help="Adjustment Lines being recorded in " \ | 252 | help="Adjustment Lines being recorded in " |
473 | 253 | " a Fiscal Book"), | 253 | " a Fiscal Book"), |
474 | 254 | 'note': fields.text('Note'), | 254 | 'note': fields.text('Note'), |
475 | 255 | 'article_number': fields.selection( | 255 | 'article_number': fields.selection( |
476 | 256 | _get_article_number_types, | 256 | _get_article_number_types, |
478 | 257 | string = "Article Number", | 257 | string="Article Number", |
479 | 258 | required=True, | 258 | required=True, |
490 | 259 | help="Article number describing the fiscal book special features" \ | 259 | help="Article number describing the fiscal book special features" |
491 | 260 | " according to the Venezuelan RLIVA statement for fiscal" \ | 260 | " according to the Venezuelan RLIVA statement for fiscal" |
492 | 261 | " accounting books. Options:" \ | 261 | " accounting books. Options:" |
493 | 262 | " - Art. 75: Pruchase Book." \ | 262 | " - Art. 75: Pruchase Book." |
494 | 263 | " - Art. 76: Sale Book. Reflects every individual operation detail." \ | 263 | " - Art. 76: Sale Book. Reflects every individual operation detail." |
495 | 264 | " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " \ | 264 | " - Art. 77: Sale Book. Groups Non-Tax Payer operations in one " |
496 | 265 | " consolidated line. Only fiscal billing." \ | 265 | " consolidated line. Only fiscal billing." |
497 | 266 | " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" \ | 266 | " - Art. 78: Sale Book. Hybrid for 76 and 77 article. Show" |
498 | 267 | " automatic and mechanized operations in individual way, and " \ | 267 | " automatic and mechanized operations in individual way, and " |
499 | 268 | " groups fiscal billing operationss in one consolidated line." ), | 268 | " groups fiscal billing operationss in one consolidated line."), |
500 | 269 | 269 | ||
501 | 270 | #~ Withholding fields | 270 | #~ Withholding fields |
502 | 271 | 'get_wh_sum': fields.function( | 271 | 'get_wh_sum': fields.function( |
503 | 272 | _get_wh, | 272 | _get_wh, |
504 | 273 | type="float", method=True, store=True, multi="get_wh", | 273 | type="float", method=True, store=True, multi="get_wh", |
505 | 274 | string="Current Period Withholding", | 274 | string="Current Period Withholding", |
509 | 275 | help="Used at" \ | 275 | help="Used at" |
510 | 276 | " 1. Totalization row in Fiscal Book Line block at Withholding" \ | 276 | " 1. Totalization row in Fiscal Book Line block at Withholding" |
511 | 277 | " VAT Column" \ | 277 | " VAT Column" |
512 | 278 | " 2. Second row at the Withholding Summary block"), | 278 | " 2. Second row at the Withholding Summary block"), |
513 | 279 | 'get_previous_wh_sum': fields.function( | 279 | 'get_previous_wh_sum': fields.function( |
514 | 280 | _get_wh, | 280 | _get_wh, |
515 | @@ -290,7 +290,7 @@ | |||
516 | 290 | _get_wh, | 290 | _get_wh, |
517 | 291 | type="float", method=True, store=True, multi="get_wh", | 291 | type="float", method=True, store=True, multi="get_wh", |
518 | 292 | string="Based Tax Debit Sum", | 292 | string="Based Tax Debit Sum", |
520 | 293 | help="Totalization row in Fiscal Book Line block at" \ | 293 | help="Totalization row in Fiscal Book Line block at" |
521 | 294 | " Based Tax Debit Column"), | 294 | " Based Tax Debit Column"), |
522 | 295 | 295 | ||
523 | 296 | #~ Printable report data | 296 | #~ Printable report data |
524 | @@ -309,21 +309,21 @@ | |||
525 | 309 | type="float", method=True, store=True, | 309 | type="float", method=True, store=True, |
526 | 310 | multi="get_total_with_iva", | 310 | multi="get_total_with_iva", |
527 | 311 | string='Total amount with VAT', | 311 | string='Total amount with VAT', |
529 | 312 | help="Total with VAT Sum (Import/Export, Domestic, Tax Payer and" \ | 312 | help="Total with VAT Sum (Import/Export, Domestic, Tax Payer and" |
530 | 313 | " Non-Tax Payer"), | 313 | " Non-Tax Payer"), |
531 | 314 | 'get_vat_sdcf_sum': fields.function( | 314 | 'get_vat_sdcf_sum': fields.function( |
532 | 315 | _get_vat_sdcf_sum, | 315 | _get_vat_sdcf_sum, |
533 | 316 | type="float", method=True, store=True, | 316 | type="float", method=True, store=True, |
534 | 317 | string="Exempt and SDCF Tax Sum", | 317 | string="Exempt and SDCF Tax Sum", |
537 | 318 | help="Exempt and Non entitled to tax credit totalization. Sum of" \ | 318 | help="Exempt and Non entitled to tax credit totalization. Sum of" |
538 | 319 | " SDCF and Exempt Tax Totalization columns for all transaction" \ | 319 | " SDCF and Exempt Tax Totalization columns for all transaction" |
539 | 320 | " types"), | 320 | " types"), |
540 | 321 | 'get_total_tax_credit_debit_base_sum': fields.function( | 321 | 'get_total_tax_credit_debit_base_sum': fields.function( |
541 | 322 | _get_total_tax_credit_debit, | 322 | _get_total_tax_credit_debit, |
542 | 323 | type="float", method=True, store=True, | 323 | type="float", method=True, store=True, |
543 | 324 | multi="get_total_tax_credit_debit", | 324 | multi="get_total_tax_credit_debit", |
544 | 325 | string="Tax Credit Total Base Amount", | 325 | string="Tax Credit Total Base Amount", |
546 | 326 | help="Uses at 1. purchase: total row at summary taxes." \ | 326 | help="Uses at 1. purchase: total row at summary taxes." |
547 | 327 | " 2. sales: row at summary taxes."), | 327 | " 2. sales: row at summary taxes."), |
548 | 328 | 'get_total_tax_credit_debit_tax_sum': fields.function( | 328 | 'get_total_tax_credit_debit_tax_sum': fields.function( |
549 | 329 | _get_total_tax_credit_debit, | 329 | _get_total_tax_credit_debit, |
550 | @@ -333,8 +333,8 @@ | |||
551 | 333 | 'do_sdcf_and_exempt_sum': fields.float( | 333 | 'do_sdcf_and_exempt_sum': fields.float( |
552 | 334 | digits_compute=dp.get_precision('Account'), | 334 | digits_compute=dp.get_precision('Account'), |
553 | 335 | string="Domestic Untaxed VAT Sum", | 335 | string="Domestic Untaxed VAT Sum", |
556 | 336 | help="SDCF and Exempt sum for domestict transanctions." \ | 336 | help="SDCF and Exempt sum for domestict transanctions." |
557 | 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" |
558 | 338 | " transactions."), | 338 | " transactions."), |
559 | 339 | 339 | ||
560 | 340 | #~ Totalization fields for international transactions | 340 | #~ Totalization fields for international transactions |
561 | @@ -347,48 +347,48 @@ | |||
562 | 347 | 'imex_vat_base_sum': fields.float( | 347 | 'imex_vat_base_sum': fields.float( |
563 | 348 | digits_compute=dp.get_precision('Account'), | 348 | digits_compute=dp.get_precision('Account'), |
564 | 349 | string="International Taxable Amount", | 349 | string="International Taxable Amount", |
567 | 350 | help="Sum of International Tax Base Amounts (reduced, general" \ | 350 | help="Sum of International Tax Base Amounts (reduced, general" |
568 | 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" |
569 | 352 | " with Exports Sales title"), | 352 | " with Exports Sales title"), |
570 | 353 | 'imex_exempt_vat_sum': fields.float( | 353 | 'imex_exempt_vat_sum': fields.float( |
571 | 354 | digits_compute=dp.get_precision('Account'), | 354 | digits_compute=dp.get_precision('Account'), |
572 | 355 | string="Exempt Tax", | 355 | string="Exempt Tax", |
574 | 356 | help="Import/Export Exempt Tax Totalization: Sum of Exempt" \ | 356 | help="Import/Export Exempt Tax Totalization: Sum of Exempt" |
575 | 357 | " column for international transactions"), | 357 | " column for international transactions"), |
576 | 358 | 'imex_sdcf_vat_sum': fields.float( | 358 | 'imex_sdcf_vat_sum': fields.float( |
577 | 359 | digits_compute=dp.get_precision('Account'), | 359 | digits_compute=dp.get_precision('Account'), |
578 | 360 | string="SDCF Tax", | 360 | string="SDCF Tax", |
580 | 361 | help="Import/Export SDCF Tax Totalization: Sum of SDCF column" \ | 361 | help="Import/Export SDCF Tax Totalization: Sum of SDCF column" |
581 | 362 | " for international transactions"), | 362 | " for international transactions"), |
582 | 363 | 'imex_general_vat_base_sum': fields.float( | 363 | 'imex_general_vat_base_sum': fields.float( |
583 | 364 | digits_compute=dp.get_precision('Account'), | 364 | digits_compute=dp.get_precision('Account'), |
584 | 365 | string="General VAT Taxable Amount", | 365 | string="General VAT Taxable Amount", |
586 | 366 | help="General VAT Taxed Imports/Exports Base Amount. Sum of" \ | 366 | help="General VAT Taxed Imports/Exports Base Amount. Sum of" |
587 | 367 | " General VAT Base column for international transactions"), | 367 | " General VAT Base column for international transactions"), |
588 | 368 | 'imex_general_vat_tax_sum': fields.float( | 368 | 'imex_general_vat_tax_sum': fields.float( |
589 | 369 | digits_compute=dp.get_precision('Account'), | 369 | digits_compute=dp.get_precision('Account'), |
590 | 370 | string="General VAT Taxed Amount", | 370 | string="General VAT Taxed Amount", |
592 | 371 | help="General VAT Taxed Imports/Exports Tax Amount. Sum of" \ | 371 | help="General VAT Taxed Imports/Exports Tax Amount. Sum of" |
593 | 372 | " General VAT Tax column for international transactions"), | 372 | " General VAT Tax column for international transactions"), |
594 | 373 | 'imex_additional_vat_base_sum': fields.float( | 373 | 'imex_additional_vat_base_sum': fields.float( |
595 | 374 | digits_compute=dp.get_precision('Account'), | 374 | digits_compute=dp.get_precision('Account'), |
596 | 375 | string="Additional VAT Taxable Amount", | 375 | string="Additional VAT Taxable Amount", |
598 | 376 | help="Additional VAT Taxed Imports/Exports Base Amount. Sum of" \ | 376 | help="Additional VAT Taxed Imports/Exports Base Amount. Sum of" |
599 | 377 | " Additional VAT Base column for international transactions"), | 377 | " Additional VAT Base column for international transactions"), |
600 | 378 | 'imex_additional_vat_tax_sum': fields.float( | 378 | 'imex_additional_vat_tax_sum': fields.float( |
601 | 379 | digits_compute=dp.get_precision('Account'), | 379 | digits_compute=dp.get_precision('Account'), |
602 | 380 | string="Additional VAT Taxed Amount", | 380 | string="Additional VAT Taxed Amount", |
604 | 381 | help="Additional VAT Taxed Imports/Exports Tax Amount. Sum of " \ | 381 | help="Additional VAT Taxed Imports/Exports Tax Amount. Sum of " |
605 | 382 | " Additional VAT Tax column for international transactions"), | 382 | " Additional VAT Tax column for international transactions"), |
606 | 383 | 'imex_reduced_vat_base_sum': fields.float( | 383 | 'imex_reduced_vat_base_sum': fields.float( |
607 | 384 | digits_compute=dp.get_precision('Account'), | 384 | digits_compute=dp.get_precision('Account'), |
608 | 385 | string="Reduced VAT Taxable Amount", | 385 | string="Reduced VAT Taxable Amount", |
610 | 386 | help="Reduced VAT Taxed Imports/Exports Base Amount. Sum of " \ | 386 | help="Reduced VAT Taxed Imports/Exports Base Amount. Sum of " |
611 | 387 | " Reduced VAT Base column for international transactions"), | 387 | " Reduced VAT Base column for international transactions"), |
612 | 388 | 'imex_reduced_vat_tax_sum': fields.float( | 388 | 'imex_reduced_vat_tax_sum': fields.float( |
613 | 389 | digits_compute=dp.get_precision('Account'), | 389 | digits_compute=dp.get_precision('Account'), |
614 | 390 | string="Reduced VAT Taxed Amount", | 390 | string="Reduced VAT Taxed Amount", |
616 | 391 | help="Reduced VAT Taxed Imports/Exports Tax Amount. Sum of " \ | 391 | help="Reduced VAT Taxed Imports/Exports Tax Amount. Sum of " |
617 | 392 | " Reduced VAT Tax column for international transactions"), | 392 | " Reduced VAT Tax column for international transactions"), |
618 | 393 | 393 | ||
619 | 394 | #~ Totalization fields for domestic transactions | 394 | #~ Totalization fields for domestic transactions |
620 | @@ -401,61 +401,61 @@ | |||
621 | 401 | 'do_vat_base_sum': fields.float( | 401 | 'do_vat_base_sum': fields.float( |
622 | 402 | digits_compute=dp.get_precision('Account'), | 402 | digits_compute=dp.get_precision('Account'), |
623 | 403 | string="Domestic Taxable Amount", | 403 | string="Domestic Taxable Amount", |
625 | 404 | help="Sum of all domestic transaction base amounts (reduced," \ | 404 | help="Sum of all domestic transaction base amounts (reduced," |
626 | 405 | " general and additional)"), | 405 | " general and additional)"), |
627 | 406 | 'do_exempt_vat_sum': fields.float( | 406 | 'do_exempt_vat_sum': fields.float( |
628 | 407 | digits_compute=dp.get_precision('Account'), | 407 | digits_compute=dp.get_precision('Account'), |
629 | 408 | string="Exempt Tax", | 408 | string="Exempt Tax", |
632 | 409 | help="Domestic Exempt Tax Totalization. For Purchase Book it" \ | 409 | help="Domestic Exempt Tax Totalization. For Purchase Book it" |
633 | 410 | " sums Exempt column for domestic transactions. For Sale Book it" \ | 410 | " sums Exempt column for domestic transactions. For Sale Book it" |
634 | 411 | " sums Tax Payer and Non-Tax Payer Exempt columns"), | 411 | " sums Tax Payer and Non-Tax Payer Exempt columns"), |
635 | 412 | 'do_sdcf_vat_sum': fields.float( | 412 | 'do_sdcf_vat_sum': fields.float( |
636 | 413 | digits_compute=dp.get_precision('Account'), | 413 | digits_compute=dp.get_precision('Account'), |
637 | 414 | string="SDCF Tax", | 414 | string="SDCF Tax", |
640 | 415 | help="Domestic SDCF Tax Totalization. For Purchase Book it sums" \ | 415 | help="Domestic SDCF Tax Totalization. For Purchase Book it sums" |
641 | 416 | " SDCF column for domestic transactions. For Sale Book it sums" \ | 416 | " SDCF column for domestic transactions. For Sale Book it sums" |
642 | 417 | " Tax Payer and Non-Tax Payer SDCF columns"), | 417 | " Tax Payer and Non-Tax Payer SDCF columns"), |
643 | 418 | 'do_general_vat_base_sum': fields.float( | 418 | 'do_general_vat_base_sum': fields.float( |
644 | 419 | digits_compute=dp.get_precision('Account'), | 419 | digits_compute=dp.get_precision('Account'), |
645 | 420 | string="General VAT Taxable Amount", | 420 | string="General VAT Taxable Amount", |
649 | 421 | help="General VAT Taxed Domestic Base Amount Totalization." \ | 421 | help="General VAT Taxed Domestic Base Amount Totalization." |
650 | 422 | " For Purchase Book it sums General VAT Base column for domestic" \ | 422 | " For Purchase Book it sums General VAT Base column for domestic" |
651 | 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" |
652 | 424 | " General VAT Base columns"), | 424 | " General VAT Base columns"), |
653 | 425 | 'do_general_vat_tax_sum': fields.float( | 425 | 'do_general_vat_tax_sum': fields.float( |
654 | 426 | digits_compute=dp.get_precision('Account'), | 426 | digits_compute=dp.get_precision('Account'), |
655 | 427 | string="General VAT Taxed Amount", | 427 | string="General VAT Taxed Amount", |
659 | 428 | help="General VAT Taxed Domestic Tax Amount Totalization." \ | 428 | help="General VAT Taxed Domestic Tax Amount Totalization." |
660 | 429 | " For Purchase Book it sums General VAT Tax column for domestic" \ | 429 | " For Purchase Book it sums General VAT Tax column for domestic" |
661 | 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" |
662 | 431 | " General VAT Tax columns"), | 431 | " General VAT Tax columns"), |
663 | 432 | 'do_additional_vat_base_sum': fields.float( | 432 | 'do_additional_vat_base_sum': fields.float( |
664 | 433 | digits_compute=dp.get_precision('Account'), | 433 | digits_compute=dp.get_precision('Account'), |
665 | 434 | string="Additional VAT Taxable Amount", | 434 | string="Additional VAT Taxable Amount", |
669 | 435 | help="Additional VAT Taxed Domestic Base Amount Totalization." \ | 435 | help="Additional VAT Taxed Domestic Base Amount Totalization." |
670 | 436 | " For Purchase Book it sums Additional VAT Base column for" \ | 436 | " For Purchase Book it sums Additional VAT Base column for" |
671 | 437 | " domestic transactions. For Sale Book it sums Tax Payer and No" \ | 437 | " domestic transactions. For Sale Book it sums Tax Payer and No" |
672 | 438 | " Tax Payer Additional VAT Base columns"), | 438 | " Tax Payer Additional VAT Base columns"), |
673 | 439 | 'do_additional_vat_tax_sum': fields.float( | 439 | 'do_additional_vat_tax_sum': fields.float( |
674 | 440 | digits_compute=dp.get_precision('Account'), | 440 | digits_compute=dp.get_precision('Account'), |
675 | 441 | string="Additional VAT Taxed Amount", | 441 | string="Additional VAT Taxed Amount", |
679 | 442 | help="Additional VAT Taxed Domestic Tax Amount Totalization." \ | 442 | help="Additional VAT Taxed Domestic Tax Amount Totalization." |
680 | 443 | " For Purchase Book it sums Additional VAT Tax column for" \ | 443 | " For Purchase Book it sums Additional VAT Tax column for" |
681 | 444 | " domestic transactions. For Sale Book it sums Tax Payer and No" \ | 444 | " domestic transactions. For Sale Book it sums Tax Payer and No" |
682 | 445 | " Tax Payer Additional VAT Tax columns"), | 445 | " Tax Payer Additional VAT Tax columns"), |
683 | 446 | 'do_reduced_vat_base_sum': fields.float( | 446 | 'do_reduced_vat_base_sum': fields.float( |
684 | 447 | digits_compute=dp.get_precision('Account'), | 447 | digits_compute=dp.get_precision('Account'), |
685 | 448 | string="Reduced VAT Taxable Amount", | 448 | string="Reduced VAT Taxable Amount", |
689 | 449 | help="Reduced VAT Taxed Domestic Base Amount Totalization." \ | 449 | help="Reduced VAT Taxed Domestic Base Amount Totalization." |
690 | 450 | " For Purchase Book it sums Reduced VAT Base column for domestic" \ | 450 | " For Purchase Book it sums Reduced VAT Base column for domestic" |
691 | 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" |
692 | 452 | " Reduced VAT Base columns"), | 452 | " Reduced VAT Base columns"), |
693 | 453 | 'do_reduced_vat_tax_sum': fields.float( | 453 | 'do_reduced_vat_tax_sum': fields.float( |
694 | 454 | digits_compute=dp.get_precision('Account'), | 454 | digits_compute=dp.get_precision('Account'), |
695 | 455 | string="Reduced VAT Taxed Amount", | 455 | string="Reduced VAT Taxed Amount", |
699 | 456 | help="Reduced VAT Taxed Domestic Tax Amount Totalization." \ | 456 | help="Reduced VAT Taxed Domestic Tax Amount Totalization." |
700 | 457 | " For Purchase Book it sums Reduced VAT Tax column for domestic" \ | 457 | " For Purchase Book it sums Reduced VAT Tax column for domestic" |
701 | 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" |
702 | 459 | " Reduced VAT Tax columns"), | 459 | " Reduced VAT Tax columns"), |
703 | 460 | 'do_adjustment_vat_tax_sum': fields.function( | 460 | 'do_adjustment_vat_tax_sum': fields.function( |
704 | 461 | _get_do_adjustment_vat_tax_sum, method=True, type='float', | 461 | _get_do_adjustment_vat_tax_sum, method=True, type='float', |
705 | @@ -464,10 +464,10 @@ | |||
706 | 464 | #~ Apply only for sale book | 464 | #~ Apply only for sale book |
707 | 465 | #~ Totalization fields for tax payer and Non-Tax Payer transactions | 465 | #~ Totalization fields for tax payer and Non-Tax Payer transactions |
708 | 466 | 'ntp_fbl_ids': fields.one2many("fiscal.book.line", "ntp_fb_id", | 466 | 'ntp_fbl_ids': fields.one2many("fiscal.book.line", "ntp_fb_id", |
713 | 467 | string = "Non-Tax Payer Detail Lines", | 467 | string="Non-Tax Payer Detail Lines", |
714 | 468 | help="Non-Tax Payer Lines that are" \ | 468 | help="Non-Tax Payer Lines that are" |
715 | 469 | " grouped by the statement law that" \ | 469 | " grouped by the statement law that" |
716 | 470 | " represent the data of are" \ | 470 | " represent the data of are" |
717 | 471 | " consolidate book lines"), | 471 | " consolidate book lines"), |
718 | 472 | 'get_total_with_iva_tp_sum': fields.function( | 472 | 'get_total_with_iva_tp_sum': fields.function( |
719 | 473 | _get_total_with_iva_sum, | 473 | _get_total_with_iva_sum, |
720 | @@ -478,47 +478,47 @@ | |||
721 | 478 | 'tp_vat_base_sum': fields.float( | 478 | 'tp_vat_base_sum': fields.float( |
722 | 479 | digits_compute=dp.get_precision('Account'), | 479 | digits_compute=dp.get_precision('Account'), |
723 | 480 | string="Tax Payer Taxable Amount", | 480 | string="Tax Payer Taxable Amount", |
725 | 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" |
726 | 482 | " additional taxes)"), | 482 | " additional taxes)"), |
727 | 483 | 'tp_exempt_vat_sum': fields.float( | 483 | 'tp_exempt_vat_sum': fields.float( |
728 | 484 | digits_compute=dp.get_precision('Account'), | 484 | digits_compute=dp.get_precision('Account'), |
729 | 485 | string="Exempt Tax", | 485 | string="Exempt Tax", |
731 | 486 | help="Tax Payer Exempt Tax Totalization. Sum of Exempt column" \ | 486 | help="Tax Payer Exempt Tax Totalization. Sum of Exempt column" |
732 | 487 | " for tax payer transactions"), | 487 | " for tax payer transactions"), |
733 | 488 | 'tp_sdcf_vat_sum': fields.float( | 488 | 'tp_sdcf_vat_sum': fields.float( |
734 | 489 | digits_compute=dp.get_precision('Account'), | 489 | digits_compute=dp.get_precision('Account'), |
735 | 490 | string="SDCF Tax", | 490 | string="SDCF Tax", |
737 | 491 | help="Tax Payer SDCF Tax Totalization. Sum of SDCF column for" \ | 491 | help="Tax Payer SDCF Tax Totalization. Sum of SDCF column for" |
738 | 492 | " tax payer transactions"), | 492 | " tax payer transactions"), |
739 | 493 | 'tp_general_vat_base_sum': fields.float( | 493 | 'tp_general_vat_base_sum': fields.float( |
740 | 494 | digits_compute=dp.get_precision('Account'), | 494 | digits_compute=dp.get_precision('Account'), |
741 | 495 | string="General VAT Taxable Amount", | 495 | string="General VAT Taxable Amount", |
743 | 496 | help="General VAT Taxed Tax Payer Base Amount Totalization." \ | 496 | help="General VAT Taxed Tax Payer Base Amount Totalization." |
744 | 497 | " Sum of General VAT Base column for taxy payer transactions"), | 497 | " Sum of General VAT Base column for taxy payer transactions"), |
745 | 498 | 'tp_general_vat_tax_sum': fields.float( | 498 | 'tp_general_vat_tax_sum': fields.float( |
746 | 499 | digits_compute=dp.get_precision('Account'), | 499 | digits_compute=dp.get_precision('Account'), |
747 | 500 | string="General VAT Taxed Amount", | 500 | string="General VAT Taxed Amount", |
749 | 501 | help="General VAT Taxed Tax Payer Tax Amount Totalization." \ | 501 | help="General VAT Taxed Tax Payer Tax Amount Totalization." |
750 | 502 | " Sum of General VAT Tax column for tax payer transactions"), | 502 | " Sum of General VAT Tax column for tax payer transactions"), |
751 | 503 | 'tp_additional_vat_base_sum': fields.float( | 503 | 'tp_additional_vat_base_sum': fields.float( |
752 | 504 | digits_compute=dp.get_precision('Account'), | 504 | digits_compute=dp.get_precision('Account'), |
753 | 505 | string="Additional VAT Taxable Amount", | 505 | string="Additional VAT Taxable Amount", |
755 | 506 | help="Additional VAT Taxed Tax Payer Base Amount Totalization." \ | 506 | help="Additional VAT Taxed Tax Payer Base Amount Totalization." |
756 | 507 | " Sum of Additional VAT Base column for tax payer transactions"), | 507 | " Sum of Additional VAT Base column for tax payer transactions"), |
757 | 508 | 'tp_additional_vat_tax_sum': fields.float( | 508 | 'tp_additional_vat_tax_sum': fields.float( |
758 | 509 | digits_compute=dp.get_precision('Account'), | 509 | digits_compute=dp.get_precision('Account'), |
759 | 510 | string="Additional VAT Taxed Amount", | 510 | string="Additional VAT Taxed Amount", |
761 | 511 | help="Additional VAT Taxed Tax Payer Tax Amount Totalization." \ | 511 | help="Additional VAT Taxed Tax Payer Tax Amount Totalization." |
762 | 512 | " Sum of Additional VAT Tax column for tax payer transactions"), | 512 | " Sum of Additional VAT Tax column for tax payer transactions"), |
763 | 513 | 'tp_reduced_vat_base_sum': fields.float( | 513 | 'tp_reduced_vat_base_sum': fields.float( |
764 | 514 | digits_compute=dp.get_precision('Account'), | 514 | digits_compute=dp.get_precision('Account'), |
765 | 515 | string="Reduced VAT Taxable Amount", | 515 | string="Reduced VAT Taxable Amount", |
767 | 516 | help="Reduced VAT Taxed Tax Payer Base Amount Totalization." \ | 516 | help="Reduced VAT Taxed Tax Payer Base Amount Totalization." |
768 | 517 | " Sum of Reduced VAT Base column for tax payer transactions"), | 517 | " Sum of Reduced VAT Base column for tax payer transactions"), |
769 | 518 | 'tp_reduced_vat_tax_sum': fields.float( | 518 | 'tp_reduced_vat_tax_sum': fields.float( |
770 | 519 | digits_compute=dp.get_precision('Account'), | 519 | digits_compute=dp.get_precision('Account'), |
771 | 520 | string="Reduced VAT Taxed Amount", | 520 | string="Reduced VAT Taxed Amount", |
773 | 521 | help="Reduced VAT Taxed Tax Payer Tax Amount Totalization." \ | 521 | help="Reduced VAT Taxed Tax Payer Tax Amount Totalization." |
774 | 522 | " Sum of Reduced VAT Tax column for tax payer transactions"), | 522 | " Sum of Reduced VAT Tax column for tax payer transactions"), |
775 | 523 | 523 | ||
776 | 524 | 'get_total_with_iva_ntp_sum': fields.function( | 524 | 'get_total_with_iva_ntp_sum': fields.function( |
777 | @@ -530,55 +530,55 @@ | |||
778 | 530 | 'ntp_vat_base_sum': fields.float( | 530 | 'ntp_vat_base_sum': fields.float( |
779 | 531 | digits_compute=dp.get_precision('Account'), | 531 | digits_compute=dp.get_precision('Account'), |
780 | 532 | string="Non-Tax Payer Taxable Amount", | 532 | string="Non-Tax Payer Taxable Amount", |
782 | 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" |
783 | 534 | " payer tax bases (reduced, general and additional)"), | 534 | " payer tax bases (reduced, general and additional)"), |
784 | 535 | 'ntp_exempt_vat_sum': fields.float( | 535 | 'ntp_exempt_vat_sum': fields.float( |
785 | 536 | digits_compute=dp.get_precision('Account'), | 536 | digits_compute=dp.get_precision('Account'), |
786 | 537 | string="Exempt Tax", | 537 | string="Exempt Tax", |
788 | 538 | help="Non-Tax Payer Exempt Tax Totalization. Sum of Exempt" \ | 538 | help="Non-Tax Payer Exempt Tax Totalization. Sum of Exempt" |
789 | 539 | " column for Non-Tax Payer transactions"), | 539 | " column for Non-Tax Payer transactions"), |
790 | 540 | 'ntp_sdcf_vat_sum': fields.float( | 540 | 'ntp_sdcf_vat_sum': fields.float( |
791 | 541 | digits_compute=dp.get_precision('Account'), | 541 | digits_compute=dp.get_precision('Account'), |
792 | 542 | string="SDCF Tax", | 542 | string="SDCF Tax", |
794 | 543 | help="Non-Tax Payer SDCF Tax Totalization. Sum of SDCF column" \ | 543 | help="Non-Tax Payer SDCF Tax Totalization. Sum of SDCF column" |
795 | 544 | " for Non-Tax Payer transactions"), | 544 | " for Non-Tax Payer transactions"), |
796 | 545 | 'ntp_general_vat_base_sum': fields.float( | 545 | 'ntp_general_vat_base_sum': fields.float( |
797 | 546 | digits_compute=dp.get_precision('Account'), | 546 | digits_compute=dp.get_precision('Account'), |
798 | 547 | string="General VAT Taxable Amount", | 547 | string="General VAT Taxable Amount", |
800 | 548 | help="General VAT Taxed Non-Tax Payer Base Amount Totalization." \ | 548 | help="General VAT Taxed Non-Tax Payer Base Amount Totalization." |
801 | 549 | " Sum of General VAT Base column for taxy payer transactions"), | 549 | " Sum of General VAT Base column for taxy payer transactions"), |
802 | 550 | 'ntp_general_vat_tax_sum': fields.float( | 550 | 'ntp_general_vat_tax_sum': fields.float( |
803 | 551 | digits_compute=dp.get_precision('Account'), | 551 | digits_compute=dp.get_precision('Account'), |
804 | 552 | string="General VAT Taxed Amount", | 552 | string="General VAT Taxed Amount", |
806 | 553 | help="General VAT Taxed Non-Tax Payer Tax Amount Totalization." \ | 553 | help="General VAT Taxed Non-Tax Payer Tax Amount Totalization." |
807 | 554 | " Sum of General VAT Tax column for Non-Tax Payer transactions"), | 554 | " Sum of General VAT Tax column for Non-Tax Payer transactions"), |
808 | 555 | 'ntp_additional_vat_base_sum': fields.float( | 555 | 'ntp_additional_vat_base_sum': fields.float( |
809 | 556 | digits_compute=dp.get_precision('Account'), | 556 | digits_compute=dp.get_precision('Account'), |
810 | 557 | string="Additional VAT Taxable Amount", | 557 | string="Additional VAT Taxable Amount", |
812 | 558 | help="Additional VAT Taxed Non-Tax Payer Base Amount Totalization." \ | 558 | help="Additional VAT Taxed Non-Tax Payer Base Amount Totalization." |
813 | 559 | " Sum of Additional VAT Base column for Non-Tax Payer transactions"), | 559 | " Sum of Additional VAT Base column for Non-Tax Payer transactions"), |
814 | 560 | 'ntp_additional_vat_tax_sum': fields.float( | 560 | 'ntp_additional_vat_tax_sum': fields.float( |
815 | 561 | digits_compute=dp.get_precision('Account'), | 561 | digits_compute=dp.get_precision('Account'), |
816 | 562 | string="Additional VAT Taxed Amount", | 562 | string="Additional VAT Taxed Amount", |
818 | 563 | help="Additional VAT Taxed Non-Tax Payer Tax Amount Totalization." \ | 563 | help="Additional VAT Taxed Non-Tax Payer Tax Amount Totalization." |
819 | 564 | " Sum of Additional VAT Tax column for Non-Tax Payer transactions"), | 564 | " Sum of Additional VAT Tax column for Non-Tax Payer transactions"), |
820 | 565 | 'ntp_reduced_vat_base_sum': fields.float( | 565 | 'ntp_reduced_vat_base_sum': fields.float( |
821 | 566 | digits_compute=dp.get_precision('Account'), | 566 | digits_compute=dp.get_precision('Account'), |
822 | 567 | string="Reduced VAT Taxable Amount", | 567 | string="Reduced VAT Taxable Amount", |
824 | 568 | help="Reduced VAT Taxed Non-Tax Payer Base Amount Totalization." \ | 568 | help="Reduced VAT Taxed Non-Tax Payer Base Amount Totalization." |
825 | 569 | " Sum of Reduced VAT Base column for Non-Tax Payer transactions"), | 569 | " Sum of Reduced VAT Base column for Non-Tax Payer transactions"), |
826 | 570 | 'ntp_reduced_vat_tax_sum': fields.float( | 570 | 'ntp_reduced_vat_tax_sum': fields.float( |
827 | 571 | digits_compute=dp.get_precision('Account'), | 571 | digits_compute=dp.get_precision('Account'), |
828 | 572 | string="Reduced VAT Taxed Amount", | 572 | string="Reduced VAT Taxed Amount", |
830 | 573 | help="Reduced VAT Taxed Non-Tax Payer Tax Amount Totalization." \ | 573 | help="Reduced VAT Taxed Non-Tax Payer Tax Amount Totalization." |
831 | 574 | " Sum of Reduced VAT Tax column for Non-Tax Payer transactions"), | 574 | " Sum of Reduced VAT Tax column for Non-Tax Payer transactions"), |
832 | 575 | } | 575 | } |
833 | 576 | 576 | ||
834 | 577 | _defaults = { | 577 | _defaults = { |
835 | 578 | 'state': 'draft', | 578 | 'state': 'draft', |
836 | 579 | 'type': _get_type, | 579 | 'type': _get_type, |
839 | 580 | 'company_id': lambda s, c, u, ctx: \ | 580 | 'company_id': lambda s, c, u, ctx: |
840 | 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, |
841 | 582 | 'article_number': _get_article_number, | 582 | 'article_number': _get_article_number, |
842 | 583 | 'fortnight': None, | 583 | 'fortnight': None, |
843 | 584 | } | 584 | } |
844 | @@ -595,7 +595,7 @@ | |||
845 | 595 | """ It make clear all stuff of book. """ | 595 | """ It make clear all stuff of book. """ |
846 | 596 | context = context or {} | 596 | context = context or {} |
847 | 597 | self.clear_book(cr, uid, ids, context=context) | 597 | self.clear_book(cr, uid, ids, context=context) |
849 | 598 | return {'value':{}} | 598 | return {'value': {}} |
850 | 599 | 599 | ||
851 | 600 | #~ update book methods | 600 | #~ update book methods |
852 | 601 | 601 | ||
853 | @@ -717,7 +717,7 @@ | |||
854 | 717 | ['|', | 717 | ['|', |
855 | 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), |
856 | 719 | '&', '&', ('period_id', '=', fb_brw.period_id.id), ('type', 'in', inv_type), | 719 | '&', '&', ('period_id', '=', fb_brw.period_id.id), ('type', 'in', inv_type), |
858 | 720 | ('state', 'not in', inv_state)], | 720 | ('state', 'not in', inv_state)], |
859 | 721 | order='date_invoice asc', context=context) | 721 | order='date_invoice asc', context=context) |
860 | 722 | if fb_brw.fortnight: | 722 | if fb_brw.fortnight: |
861 | 723 | issue_inv_ids = self.get_invoices_from_fortnight( | 723 | issue_inv_ids = self.get_invoices_from_fortnight( |
862 | @@ -752,8 +752,8 @@ | |||
863 | 752 | awil_obj = self.pool.get('account.wh.iva.line') | 752 | awil_obj = self.pool.get('account.wh.iva.line') |
864 | 753 | fb_brw = self.browse(cr, uid, fb_id, context=context) | 753 | fb_brw = self.browse(cr, uid, fb_id, context=context) |
865 | 754 | awil_type = fb_brw.type == 'sale' \ | 754 | awil_type = fb_brw.type == 'sale' \ |
868 | 755 | and ['out_invoice', 'out_refund'] \ | 755 | and ['out_invoice', 'out_refund'] \ |
869 | 756 | or ['in_invoice', 'in_refund'] | 756 | or ['in_invoice', 'in_refund'] |
870 | 757 | #~ pull wh iva line data | 757 | #~ pull wh iva line data |
871 | 758 | awil_ids = [] | 758 | awil_ids = [] |
872 | 759 | awi_ids = awi_obj.search(cr, uid, | 759 | awi_ids = awi_obj.search(cr, uid, |
873 | @@ -763,7 +763,7 @@ | |||
874 | 763 | context=context) | 763 | context=context) |
875 | 764 | if fb_brw.fortnight: | 764 | if fb_brw.fortnight: |
876 | 765 | awi_ids = self.get_awi_from_fortnight( | 765 | awi_ids = self.get_awi_from_fortnight( |
878 | 766 | cr, uid, fb_id, awi_ids, context=context) | 766 | cr, uid, fb_id, awi_ids, context=context) |
879 | 767 | 767 | ||
880 | 768 | for awi_id in awi_ids: | 768 | for awi_id in awi_ids: |
881 | 769 | list_ids = awil_obj.search(cr, uid, | 769 | list_ids = awil_obj.search(cr, uid, |
882 | @@ -868,7 +868,6 @@ | |||
883 | 868 | and 'accounting_date asc, invoice_number asc' \ | 868 | and 'accounting_date asc, invoice_number asc' \ |
884 | 869 | or 'emission_date asc, invoice_number asc' | 869 | or 'emission_date asc, invoice_number asc' |
885 | 870 | 870 | ||
886 | 871 | |||
887 | 872 | def order_book_lines(self, cr, uid, fb_id, context=None): | 871 | def order_book_lines(self, cr, uid, fb_id, context=None): |
888 | 873 | """ It orders book lines by a set of criteria: | 872 | """ It orders book lines by a set of criteria: |
889 | 874 | - chronologically ascendant date (For purchase book by | 873 | - chronologically ascendant date (For purchase book by |
890 | @@ -885,16 +884,15 @@ | |||
891 | 885 | 884 | ||
892 | 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) |
893 | 887 | ajst_ordered_fbl_ids = \ | 886 | ajst_ordered_fbl_ids = \ |
895 | 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')], |
896 | 889 | order=ajst_order_criteria, context=context) | 888 | order=ajst_order_criteria, context=context) |
897 | 890 | 889 | ||
898 | 891 | for rank, fbl_id in enumerate(ajst_ordered_fbl_ids, 1): | 890 | for rank, fbl_id in enumerate(ajst_ordered_fbl_ids, 1): |
899 | 892 | fbl_obj.write(cr, uid, fbl_id, {'rank': rank}, context=context) | 891 | fbl_obj.write(cr, uid, fbl_id, {'rank': rank}, context=context) |
900 | 893 | 892 | ||
901 | 894 | |||
902 | 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) |
903 | 896 | ordered_fbl_ids = \ | 894 | ordered_fbl_ids = \ |
905 | 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')], |
906 | 898 | order=order_criteria, context=context) | 896 | order=order_criteria, context=context) |
907 | 899 | 897 | ||
908 | 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): |
909 | @@ -917,7 +915,7 @@ | |||
910 | 917 | context=context) | 915 | context=context) |
911 | 918 | if iwdl_id: | 916 | if iwdl_id: |
912 | 919 | if inv_brw.date_invoice != \ | 917 | if inv_brw.date_invoice != \ |
914 | 920 | iwdl_obj.browse(cr, uid, iwdl_id, context=context).date_ret: | 918 | iwdl_obj.browse(cr, uid, iwdl_id, context=context).date_ret: |
915 | 921 | res.append(iwdl_id) | 919 | res.append(iwdl_id) |
916 | 922 | return res | 920 | return res |
917 | 923 | 921 | ||
918 | @@ -927,7 +925,6 @@ | |||
919 | 927 | """ | 925 | """ |
920 | 928 | # TODO: make this method aware of fortnight. | 926 | # TODO: make this method aware of fortnight. |
921 | 929 | context = context or {} | 927 | context = context or {} |
922 | 930 | per_obj = self.pool.get('account.period') | ||
923 | 931 | cf_obj = self.pool.get('customs.form') | 928 | cf_obj = self.pool.get('customs.form') |
924 | 932 | 929 | ||
925 | 933 | ids = isinstance(ids, (int, long)) and [ids] or ids | 930 | ids = isinstance(ids, (int, long)) and [ids] or ids |
926 | @@ -936,9 +933,9 @@ | |||
927 | 936 | continue | 933 | continue |
928 | 937 | add_cf_ids = cf_obj.search( | 934 | add_cf_ids = cf_obj.search( |
929 | 938 | cr, uid, | 935 | cr, uid, |
933 | 939 | [('state','=', 'done'), | 936 | [('state', '=', 'done'), |
934 | 940 | ('date_liq','>=', fb_brw.period_id.date_start), | 937 | ('date_liq', '>=', fb_brw.period_id.date_start), |
935 | 941 | ('date_liq','<=', fb_brw.period_id.date_stop)], | 938 | ('date_liq', '<=', fb_brw.period_id.date_stop)], |
936 | 942 | context=context) | 939 | context=context) |
937 | 943 | add_cf_ids and self.write( | 940 | add_cf_ids and self.write( |
938 | 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]}, |
939 | @@ -953,7 +950,6 @@ | |||
940 | 953 | context = context or {} | 950 | context = context or {} |
941 | 954 | data = [] | 951 | data = [] |
942 | 955 | iwdl_obj = self.pool.get('account.wh.iva.line') | 952 | iwdl_obj = self.pool.get('account.wh.iva.line') |
943 | 956 | cf_obj = self.pool.get('customs.form') | ||
944 | 957 | fb_brw = self.browse(cr, uid, fb_id, context=context) | 953 | fb_brw = self.browse(cr, uid, fb_id, context=context) |
945 | 958 | rp_obj = self.pool.get('res.partner') | 954 | rp_obj = self.pool.get('res.partner') |
946 | 959 | 955 | ||
947 | @@ -968,7 +964,7 @@ | |||
948 | 968 | t_type = fb_brw.type == 'sale' and 'tp' or 'do' | 964 | t_type = fb_brw.type == 'sale' and 'tp' or 'do' |
949 | 969 | for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids, | 965 | for iwdl_brw in iwdl_obj.browse(cr, uid, iwdl_ids, |
950 | 970 | context=context): | 966 | context=context): |
952 | 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) |
953 | 972 | values = { | 968 | values = { |
954 | 973 | 'iwdl_id': iwdl_brw.id, | 969 | 'iwdl_id': iwdl_brw.id, |
955 | 974 | 'type': t_type, | 970 | 'type': t_type, |
956 | @@ -980,12 +976,12 @@ | |||
957 | 980 | 'partner_name': rp_brw.name or 'N/A', | 976 | 'partner_name': rp_brw.name or 'N/A', |
958 | 981 | 'partner_vat': rp_brw.vat or 'N/A', | 977 | 'partner_vat': rp_brw.vat or 'N/A', |
959 | 982 | 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer | 978 | 'affected_invoice': iwdl_brw.invoice_id.fiscal_printer |
966 | 983 | and iwdl_brw.invoice_id.invoice_printer | 979 | and iwdl_brw.invoice_id.invoice_printer |
967 | 984 | or (fb_brw.type == 'sale' | 980 | or (fb_brw.type == 'sale' |
968 | 985 | and iwdl_brw.invoice_id.number | 981 | and iwdl_brw.invoice_id.number |
969 | 986 | or iwdl_brw.invoice_id.supplier_invoice_number), | 982 | or iwdl_brw.invoice_id.supplier_invoice_number), |
970 | 987 | 'affected_invoice_date': iwdl_brw.invoice_id.date_document \ | 983 | 'affected_invoice_date': iwdl_brw.invoice_id.date_document |
971 | 988 | or iwdl_brw.invoice_id.date_invoice, | 984 | or iwdl_brw.invoice_id.date_invoice, |
972 | 989 | 'wh_rate': iwdl_brw.wh_iva_rate, | 985 | 'wh_rate': iwdl_brw.wh_iva_rate, |
973 | 990 | } | 986 | } |
974 | 991 | data.append((0, 0, values)) | 987 | data.append((0, 0, values)) |
975 | @@ -1000,45 +996,45 @@ | |||
976 | 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, |
977 | 1001 | fb_id=fb_id, context=context) | 997 | fb_id=fb_id, context=context) |
978 | 1002 | 998 | ||
980 | 1003 | rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id) | 999 | rp_brw = rp_obj._find_accounting_partner(inv_brw.partner_id) |
981 | 1004 | 1000 | ||
982 | 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 \ |
983 | 1006 | iwdl_id and iwdl_id not in no_match_dt_iwdl_ids else False | 1002 | iwdl_id and iwdl_id not in no_match_dt_iwdl_ids else False |
984 | 1007 | 1003 | ||
985 | 1008 | values = { | 1004 | values = { |
986 | 1009 | 'invoice_id': inv_brw.id, | 1005 | 'invoice_id': inv_brw.id, |
992 | 1010 | 'emission_date': (not imex_invoice) \ | 1006 | 'emission_date': (not imex_invoice) |
993 | 1011 | and (inv_brw.date_document or inv_brw.date_invoice) \ | 1007 | and (inv_brw.date_document or inv_brw.date_invoice) |
994 | 1012 | or False, | 1008 | or False, |
995 | 1013 | 'accounting_date': (not imex_invoice) and \ | 1009 | 'accounting_date': (not imex_invoice) and |
996 | 1014 | inv_brw.date_invoice or False, | 1010 | inv_brw.date_invoice or False, |
997 | 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, |
998 | 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, |
999 | 1017 | context=context), | 1013 | context=context), |
1007 | 1018 | 'debit_affected': inv_brw.parent_id \ | 1014 | 'debit_affected': inv_brw.parent_id |
1008 | 1019 | and inv_brw.parent_id.type in ['in_invoice', 'out_invoice'] \ | 1015 | and inv_brw.parent_id.type in ['in_invoice', 'out_invoice'] |
1009 | 1020 | and inv_brw.parent_id.parent_id \ | 1016 | and inv_brw.parent_id.parent_id |
1010 | 1021 | and inv_brw.parent_id.number or False, | 1017 | and inv_brw.parent_id.number or False, |
1011 | 1022 | 'credit_affected': inv_brw.parent_id and \ | 1018 | 'credit_affected': inv_brw.parent_id and |
1012 | 1023 | inv_brw.parent_id.type in ['in_refund', 'out_refund'] \ | 1019 | inv_brw.parent_id.type in ['in_refund', 'out_refund'] |
1013 | 1024 | and inv_brw.parent_id.number or False, | 1020 | and inv_brw.parent_id.number or False, |
1014 | 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, |
1018 | 1026 | 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") \ | 1022 | 'affected_invoice': (doc_type == "N/DE" or doc_type == "N/CR") |
1019 | 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) |
1020 | 1028 | or False, | 1024 | or False, |
1021 | 1029 | 'partner_name': rp_brw.name or 'N/A', | 1025 | 'partner_name': rp_brw.name or 'N/A', |
1024 | 1030 | 'partner_vat': rp_brw.vat \ | 1026 | 'partner_vat': rp_brw.vat |
1025 | 1031 | and rp_brw.vat[2:] or 'N/A', | 1027 | and rp_brw.vat[2:] or 'N/A', |
1026 | 1032 | 'invoice_number': inv_brw.fiscal_printer | 1028 | 'invoice_number': inv_brw.fiscal_printer |
1031 | 1033 | and inv_brw.invoice_printer | 1029 | and inv_brw.invoice_printer |
1032 | 1034 | or (fb_brw.type == 'sale' | 1030 | or (fb_brw.type == 'sale' |
1033 | 1035 | and inv_brw.number | 1031 | and inv_brw.number |
1034 | 1036 | or inv_brw.supplier_invoice_number), | 1032 | or inv_brw.supplier_invoice_number), |
1035 | 1037 | 'doc_type': doc_type, | 1033 | 'doc_type': doc_type, |
1040 | 1038 | 'void_form': inv_brw.name and \ | 1034 | 'void_form': inv_brw.name and |
1041 | 1039 | (inv_brw.name.find('PAPELANULADO') >= 0 \ | 1035 | (inv_brw.name.find('PAPELANULADO') >= 0 |
1042 | 1040 | and '03-ANU' or '01-REG') \ | 1036 | and '03-ANU' or '01-REG') |
1043 | 1041 | or '01-REG', | 1037 | or '01-REG', |
1044 | 1042 | 'fiscal_printer': inv_brw.fiscal_printer or False, | 1038 | 'fiscal_printer': inv_brw.fiscal_printer or False, |
1045 | 1043 | 'z_report': inv_brw.z_report or False, | 1039 | 'z_report': inv_brw.z_report or False, |
1046 | 1044 | 'custom_statement': inv_brw.customs_form_id.name or False, | 1040 | 'custom_statement': inv_brw.customs_form_id.name or False, |
1047 | @@ -1068,7 +1064,7 @@ | |||
1048 | 1068 | values = common_values.copy() | 1064 | values = common_values.copy() |
1049 | 1069 | values['partner_name'] = partner_brw.name or 'N/A' | 1065 | values['partner_name'] = partner_brw.name or 'N/A' |
1050 | 1070 | values['partner_vat'] = partner_brw.vat \ | 1066 | values['partner_vat'] = partner_brw.vat \ |
1052 | 1071 | and partner_brw.vat[2:] or 'N/A' | 1067 | and partner_brw.vat[2:] or 'N/A' |
1053 | 1072 | values['total_with_iva'] = \ | 1068 | values['total_with_iva'] = \ |
1054 | 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, |
1055 | 1074 | context=context) | 1070 | context=context) |
1056 | @@ -1094,14 +1090,14 @@ | |||
1057 | 1094 | @param cf_id: customs form id | 1090 | @param cf_id: customs form id |
1058 | 1095 | @param partner_id: partner id | 1091 | @param partner_id: partner id |
1059 | 1096 | """ | 1092 | """ |
1061 | 1097 | #KEEP AN EYE ON HERE, No check has been made on accounting partner | 1093 | # KEEP AN EYE ON HERE, No check has been made on accounting partner |
1062 | 1098 | context = context or {} | 1094 | context = context or {} |
1063 | 1099 | cf_obj = self.pool.get('customs.form') | 1095 | cf_obj = self.pool.get('customs.form') |
1064 | 1100 | cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids | 1096 | cfl_brws = cf_obj.browse(cr, uid, cf_id, context=context).cfl_ids |
1065 | 1101 | amount = sum([cfl_brw.amount | 1097 | amount = sum([cfl_brw.amount |
1066 | 1102 | for cfl_brw in cfl_brws | 1098 | for cfl_brw in cfl_brws |
1067 | 1103 | if cfl_brw.tax_code.partner_id.id == partner_id | 1099 | if cfl_brw.tax_code.partner_id.id == partner_id |
1069 | 1104 | and not cfl_brw.tax_code.vat_detail ]) | 1100 | and not cfl_brw.tax_code.vat_detail]) |
1070 | 1105 | return amount | 1101 | return amount |
1071 | 1106 | 1102 | ||
1072 | 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): |
1073 | @@ -1131,15 +1127,15 @@ | |||
1074 | 1131 | group_list.append(line_brw) | 1127 | group_list.append(line_brw) |
1075 | 1132 | else: | 1128 | else: |
1076 | 1133 | if group_list: | 1129 | if group_list: |
1078 | 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)) |
1079 | 1135 | group_value = line_brw.type | 1131 | group_value = line_brw.type |
1080 | 1136 | group_list = [line_brw] | 1132 | group_list = [line_brw] |
1081 | 1137 | else: | 1133 | else: |
1083 | 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])) |
1084 | 1139 | group_value = False | 1135 | group_value = False |
1085 | 1140 | 1136 | ||
1086 | 1141 | if group_list: | 1137 | if group_list: |
1088 | 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)) |
1089 | 1143 | 1139 | ||
1090 | 1144 | return res | 1140 | return res |
1091 | 1145 | 1141 | ||
1092 | @@ -1157,35 +1153,35 @@ | |||
1093 | 1157 | #~ separating groups | 1153 | #~ separating groups |
1094 | 1158 | lines_brws = fb_brw.fbl_ids | 1154 | lines_brws = fb_brw.fbl_ids |
1095 | 1159 | order_dict = dict() | 1155 | order_dict = dict() |
1097 | 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])) |
1098 | 1161 | date_values.sort() | 1157 | date_values.sort() |
1099 | 1162 | order_dict = {}.fromkeys(date_values) | 1158 | order_dict = {}.fromkeys(date_values) |
1100 | 1163 | for date in date_values: | 1159 | for date in date_values: |
1105 | 1164 | date_records = [ line_brw | 1160 | date_records = [line_brw |
1106 | 1165 | for line_brw in lines_brws | 1161 | for line_brw in lines_brws |
1107 | 1166 | if line_brw.emission_date == date ] | 1162 | if line_brw.emission_date == date] |
1108 | 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])) |
1109 | 1168 | printers_values.sort() | 1164 | printers_values.sort() |
1110 | 1169 | order_dict[date] = {}.fromkeys(printers_values) | 1165 | order_dict[date] = {}.fromkeys(printers_values) |
1111 | 1170 | for printer in printers_values: | 1166 | for printer in printers_values: |
1116 | 1171 | printer_records = [ line_brw | 1167 | printer_records = [line_brw |
1117 | 1172 | for line_brw in date_records | 1168 | for line_brw in date_records |
1118 | 1173 | if line_brw.fiscal_printer == printer ] | 1169 | if line_brw.fiscal_printer == printer] |
1119 | 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])) |
1120 | 1175 | z_report_values.sort() | 1171 | z_report_values.sort() |
1121 | 1176 | order_dict[date][printer] = {}.fromkeys(z_report_values) | 1172 | order_dict[date][printer] = {}.fromkeys(z_report_values) |
1122 | 1177 | for z_report in z_report_values: | 1173 | for z_report in z_report_values: |
1123 | 1178 | #~ this records needs to be order by invoice number | 1174 | #~ this records needs to be order by invoice number |
1124 | 1179 | z_records = \ | 1175 | z_records = \ |
1128 | 1180 | [ (line_brw.invoice_number, line_brw) | 1176 | [(line_brw.invoice_number, line_brw) |
1129 | 1181 | for line_brw in printer_records | 1177 | for line_brw in printer_records |
1130 | 1182 | if line_brw.z_report == z_report ] | 1178 | if line_brw.z_report == z_report] |
1131 | 1183 | z_records.sort() | 1179 | z_records.sort() |
1133 | 1184 | z_records = [ item[1] for item in z_records] | 1180 | z_records = [item[1] for item in z_records] |
1134 | 1185 | #~ group by type of line | 1181 | #~ group by type of line |
1135 | 1186 | order_dict[date][printer][z_report] = \ | 1182 | order_dict[date][printer][z_report] = \ |
1136 | 1187 | self.get_grouped_consecutive_lines_ids( | 1183 | self.get_grouped_consecutive_lines_ids( |
1138 | 1188 | cr, uid, [ item.id for item in z_records], | 1184 | cr, uid, [item.id for item in z_records], |
1139 | 1189 | context=context) | 1185 | context=context) |
1140 | 1190 | 1186 | ||
1141 | 1191 | #~ import pprint | 1187 | #~ import pprint |
1142 | @@ -1216,14 +1212,14 @@ | |||
1143 | 1216 | elif line[0] != line[1] and len(line[3]) > 1: | 1212 | elif line[0] != line[1] and len(line[3]) > 1: |
1144 | 1217 | ntp_groups_list.append( | 1213 | ntp_groups_list.append( |
1145 | 1218 | (rank, | 1214 | (rank, |
1147 | 1219 | 'Desde: '+line[0]+' ... Hasta: '+line[1], | 1215 | 'Desde: ' + line[0] + ' ... Hasta: ' + line[1], |
1148 | 1220 | line[3])) | 1216 | line[3])) |
1149 | 1221 | else: | 1217 | else: |
1150 | 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")) |
1151 | 1223 | elif line[2] != 'ntp': | 1219 | elif line[2] != 'ntp': |
1152 | 1224 | order_no_group_list.append( | 1220 | order_no_group_list.append( |
1153 | 1225 | (rank, line[3][0].id)) | 1221 | (rank, line[3][0].id)) |
1155 | 1226 | rank+= 1 | 1222 | rank += 1 |
1156 | 1227 | 1223 | ||
1157 | 1228 | #~ import pprint | 1224 | #~ import pprint |
1158 | 1229 | #~ print '\n ntp_no_group_list' | 1225 | #~ print '\n ntp_no_group_list' |
1159 | @@ -1233,11 +1229,11 @@ | |||
1160 | 1233 | #~ print '\n order_no_group_list' | 1229 | #~ print '\n order_no_group_list' |
1161 | 1234 | #~ pprint.pprint(order_no_group_list) | 1230 | #~ pprint.pprint(order_no_group_list) |
1162 | 1235 | 1231 | ||
1164 | 1236 | #~ # rank lines that have nothing to do with ntp. | 1232 | # ~ # rank lines that have nothing to do with ntp. |
1165 | 1237 | for line in order_no_group_list: | 1233 | for line in order_no_group_list: |
1166 | 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) |
1167 | 1239 | 1235 | ||
1169 | 1240 | #~ # rank ntp individual lines. | 1236 | # ~ # rank ntp individual lines. |
1170 | 1241 | for line in ntp_no_group_list: | 1237 | for line in ntp_no_group_list: |
1171 | 1242 | fbl_obj.write( | 1238 | fbl_obj.write( |
1172 | 1243 | cr, uid, line[1], | 1239 | cr, uid, line[1], |
1173 | @@ -1258,7 +1254,7 @@ | |||
1174 | 1258 | {'fb_id': False, | 1254 | {'fb_id': False, |
1175 | 1259 | 'ntp_fb_id': fb_id, | 1255 | 'ntp_fb_id': fb_id, |
1176 | 1260 | 'parent_id': consolidate_line_id, | 1256 | 'parent_id': consolidate_line_id, |
1178 | 1261 | 'rank': -1 }, | 1257 | 'rank': -1}, |
1179 | 1262 | context=context) | 1258 | context=context) |
1180 | 1263 | 1259 | ||
1181 | 1264 | return True | 1260 | return True |
1182 | @@ -1278,8 +1274,8 @@ | |||
1183 | 1278 | 'vat_general_base', 'vat_general_tax', | 1274 | 'vat_general_base', 'vat_general_tax', |
1184 | 1279 | 'vat_additional_base', 'vat_additional_tax'] | 1275 | 'vat_additional_base', 'vat_additional_tax'] |
1185 | 1280 | 1276 | ||
1188 | 1281 | rank, invoice_number, child_brws = line_tuple | 1277 | rank, invoice_number, child_brws = line_tuple |
1189 | 1282 | child_ids = [ line_brw.id for line_brw in child_brws ] | 1278 | child_ids = [line_brw.id for line_brw in child_brws] |
1190 | 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, |
1191 | 1284 | context=context) | 1280 | context=context) |
1192 | 1285 | # fill common value | 1281 | # fill common value |
1193 | @@ -1299,7 +1295,7 @@ | |||
1194 | 1299 | # fill totalization values | 1295 | # fill totalization values |
1195 | 1300 | for col in float_colums: | 1296 | for col in float_colums: |
1196 | 1301 | values[col] = \ | 1297 | values[col] = \ |
1198 | 1302 | sum([ getattr(line_brw, col) for line_brw in child_brws ]) | 1298 | sum([getattr(line_brw, col) for line_brw in child_brws]) |
1199 | 1303 | 1299 | ||
1200 | 1304 | return fbl_obj.create(cr, uid, values, context=context) | 1300 | return fbl_obj.create(cr, uid, values, context=context) |
1201 | 1305 | 1301 | ||
1202 | @@ -1321,7 +1317,7 @@ | |||
1203 | 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: |
1204 | 1322 | if fbl.invoice_id: | 1318 | if fbl.invoice_id: |
1205 | 1323 | sign = 1 if fbl.doc_type != 'N/CR' else -1 | 1319 | sign = 1 if fbl.doc_type != 'N/CR' else -1 |
1207 | 1324 | tax_lines = fbl.type in ['im','ex'] \ | 1320 | tax_lines = fbl.type in ['im', 'ex'] \ |
1208 | 1325 | and fbl.invoice_id.imex_tax_line \ | 1321 | and fbl.invoice_id.imex_tax_line \ |
1209 | 1326 | or fbl.invoice_id.tax_line | 1322 | or fbl.invoice_id.tax_line |
1210 | 1327 | for ait in tax_lines: | 1323 | for ait in tax_lines: |
1211 | @@ -1331,20 +1327,20 @@ | |||
1212 | 1331 | tax_sum[fbl.type][ait.tax_id.appl_type] += \ | 1327 | tax_sum[fbl.type][ait.tax_id.appl_type] += \ |
1213 | 1332 | ait.tax_amount * sign | 1328 | ait.tax_amount * sign |
1214 | 1333 | else: | 1329 | else: |
1216 | 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)) |
1217 | 1335 | elif fbl.cf_id: | 1331 | elif fbl.cf_id: |
1218 | 1336 | if fbl.type != 'do': | 1332 | if fbl.type != 'do': |
1219 | 1337 | raise osv.except_osv(_('Programing Error!'), | 1333 | raise osv.except_osv(_('Programing Error!'), |
1220 | 1338 | _("Customs form lines are domestic transactions")) | 1334 | _("Customs form lines are domestic transactions")) |
1221 | 1339 | base_sum['do']['sdcf'] += fbl.vat_sdcf | 1335 | base_sum['do']['sdcf'] += fbl.vat_sdcf |
1222 | 1340 | 1336 | ||
1226 | 1341 | data = [ (0, 0, {'tax_type': ttype, 'op_type': optype, | 1337 | data = [(0, 0, {'tax_type': ttype, 'op_type': optype, |
1227 | 1342 | 'base_amount_sum': base_sum[optype][ttype], | 1338 | 'base_amount_sum': base_sum[optype][ttype], |
1228 | 1343 | 'tax_amount_sum': tax_sum[optype][ttype] | 1339 | 'tax_amount_sum': tax_sum[optype][ttype] |
1229 | 1344 | }) | 1340 | }) |
1233 | 1345 | for ttype in tax_types | 1341 | for ttype in tax_types |
1234 | 1346 | for optype in op_types | 1342 | for optype in op_types |
1235 | 1347 | ] | 1343 | ] |
1236 | 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}, |
1237 | 1349 | context=context) | 1345 | context=context) |
1238 | 1350 | 1346 | ||
1239 | @@ -1361,9 +1357,9 @@ | |||
1240 | 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: |
1241 | 1362 | sign = 1 if fbl_brw.doc_type != 'N/CR' else -1 | 1358 | sign = 1 if fbl_brw.doc_type != 'N/CR' else -1 |
1242 | 1363 | if fbl_brw.invoice_id: | 1359 | if fbl_brw.invoice_id: |
1246 | 1364 | taxes = fbl_brw.type in ['im','ex'] \ | 1360 | taxes = fbl_brw.type in ['im', 'ex'] \ |
1247 | 1365 | and fbl_brw.invoice_id.imex_tax_line \ | 1361 | and fbl_brw.invoice_id.imex_tax_line \ |
1248 | 1366 | or fbl_brw.invoice_id.tax_line | 1362 | or fbl_brw.invoice_id.tax_line |
1249 | 1367 | for ait in taxes: | 1363 | for ait in taxes: |
1250 | 1368 | if ait.tax_id: | 1364 | if ait.tax_id: |
1251 | 1369 | base_amount += ait.base_amount * sign | 1365 | base_amount += ait.base_amount * sign |
1252 | @@ -1408,7 +1404,7 @@ | |||
1253 | 1408 | 'ntp_additional_vat_tax_sum', | 1404 | 'ntp_additional_vat_tax_sum', |
1254 | 1409 | 'ntp_reduced_vat_base_sum', | 1405 | 'ntp_reduced_vat_base_sum', |
1255 | 1410 | 'ntp_reduced_vat_tax_sum', | 1406 | 'ntp_reduced_vat_tax_sum', |
1257 | 1411 | ] | 1407 | ] |
1258 | 1412 | for field_name in vat_fields: | 1408 | for field_name in vat_fields: |
1259 | 1413 | data[field_name] = \ | 1409 | data[field_name] = \ |
1260 | 1414 | self.update_vat_fields(cr, uid, fb_id, field_name, | 1410 | self.update_vat_fields(cr, uid, fb_id, field_name, |
1261 | @@ -1418,14 +1414,14 @@ | |||
1262 | 1418 | fb_brw = self.browse(cr, uid, fb_id, context=context) | 1414 | fb_brw = self.browse(cr, uid, fb_id, context=context) |
1263 | 1419 | 1415 | ||
1264 | 1420 | data['do_sdcf_and_exempt_sum'] = fb_brw.type == 'sale' \ | 1416 | data['do_sdcf_and_exempt_sum'] = fb_brw.type == 'sale' \ |
1266 | 1421 | and ( data['tp_exempt_vat_sum'] + data['tp_sdcf_vat_sum'] + \ | 1417 | and (data['tp_exempt_vat_sum'] + data['tp_sdcf_vat_sum'] + |
1267 | 1422 | data['ntp_exempt_vat_sum'] + data['ntp_sdcf_vat_sum'] ) \ | 1418 | data['ntp_exempt_vat_sum'] + data['ntp_sdcf_vat_sum'] ) \ |
1269 | 1423 | or ( data['do_exempt_vat_sum'] + data['do_sdcf_vat_sum'] ) | 1419 | or (data['do_exempt_vat_sum'] + data['do_sdcf_vat_sum']) |
1270 | 1424 | 1420 | ||
1271 | 1425 | for optype in ['imex', 'do', 'tp', 'ntp']: | 1421 | for optype in ['imex', 'do', 'tp', 'ntp']: |
1272 | 1426 | data[optype + '_vat_base_sum'] = \ | 1422 | data[optype + '_vat_base_sum'] = \ |
1275 | 1427 | sum( [ data[optype + '_' + ttax + "_vat_base_sum"] | 1423 | sum([data[optype + '_' + ttax + "_vat_base_sum"] |
1276 | 1428 | for ttax in ["general", "additional", "reduced"] ] ) | 1424 | for ttax in ["general", "additional", "reduced"]]) |
1277 | 1429 | 1425 | ||
1278 | 1430 | data['imex_vat_base_sum'] += \ | 1426 | data['imex_vat_base_sum'] += \ |
1279 | 1431 | data['imex_exempt_vat_sum'] + data['imex_sdcf_vat_sum'] | 1427 | data['imex_exempt_vat_sum'] + data['imex_sdcf_vat_sum'] |
1280 | @@ -1439,14 +1435,14 @@ | |||
1281 | 1439 | for ttax in ["general", "additional", "reduced"]: | 1435 | for ttax in ["general", "additional", "reduced"]: |
1282 | 1440 | for amttype in ["base", "tax"]: | 1436 | for amttype in ["base", "tax"]: |
1283 | 1441 | data['do_' + ttax + '_vat_' + amttype + '_sum'] = \ | 1437 | data['do_' + ttax + '_vat_' + amttype + '_sum'] = \ |
1287 | 1442 | sum( [ data[ optype + "_" + ttax + "_vat_" + amttype + "_sum"] | 1438 | sum([data[optype + "_" + ttax + "_vat_" + amttype + "_sum"] |
1288 | 1443 | for optype in ["ntp", "tp"] | 1439 | for optype in ["ntp", "tp"] |
1289 | 1444 | ] ) | 1440 | ]) |
1290 | 1445 | for ttax in ["exempt", "sdcf"]: | 1441 | for ttax in ["exempt", "sdcf"]: |
1291 | 1446 | data['do_' + ttax + '_vat_sum'] = \ | 1442 | data['do_' + ttax + '_vat_sum'] = \ |
1295 | 1447 | sum( [ data[ optype + "_" + ttax + "_vat_sum"] | 1443 | sum([data[optype + "_" + ttax + "_vat_sum"] |
1296 | 1448 | for optype in ["ntp", "tp"] | 1444 | for optype in ["ntp", "tp"] |
1297 | 1449 | ] ) | 1445 | ]) |
1298 | 1450 | 1446 | ||
1299 | 1451 | return self.write(cr, uid, fb_id, data, context=context) | 1447 | return self.write(cr, uid, fb_id, data, context=context) |
1300 | 1452 | 1448 | ||
1301 | @@ -1534,9 +1530,9 @@ | |||
1302 | 1534 | fbl.invoice_id.date_invoice) | 1530 | fbl.invoice_id.date_invoice) |
1303 | 1535 | sign = 1 if fbl.doc_type != 'N/CR' else -1 | 1531 | sign = 1 if fbl.doc_type != 'N/CR' else -1 |
1304 | 1536 | amount_field_data = \ | 1532 | amount_field_data = \ |
1308 | 1537 | { 'total_with_iva': f_xc(fbl.invoice_id.amount_untaxed) * sign, | 1533 | {'total_with_iva': f_xc(fbl.invoice_id.amount_untaxed) * sign, |
1309 | 1538 | 'vat_sdcf': 0.0, 'vat_exempt': 0.0 } | 1534 | 'vat_sdcf': 0.0, 'vat_exempt': 0.0} |
1310 | 1539 | taxes = fbl.type in ['im','ex'] \ | 1535 | taxes = fbl.type in ['im', 'ex'] \ |
1311 | 1540 | and fbl.invoice_id.imex_tax_line \ | 1536 | and fbl.invoice_id.imex_tax_line \ |
1312 | 1541 | or fbl.invoice_id.tax_line | 1537 | or fbl.invoice_id.tax_line |
1313 | 1542 | for ait in taxes: | 1538 | for ait in taxes: |
1314 | @@ -1683,7 +1679,7 @@ | |||
1315 | 1683 | 'ntp_additional_vat_tax_sum', | 1679 | 'ntp_additional_vat_tax_sum', |
1316 | 1684 | 'ntp_reduced_vat_base_sum', | 1680 | 'ntp_reduced_vat_base_sum', |
1317 | 1685 | 'ntp_reduced_vat_tax_sum', | 1681 | 'ntp_reduced_vat_tax_sum', |
1319 | 1686 | ] | 1682 | ] |
1320 | 1687 | 1683 | ||
1321 | 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), |
1322 | 1689 | context=context) | 1685 | context=context) |
1323 | @@ -1800,7 +1796,7 @@ | |||
1324 | 1800 | inv_obj = self.pool.get('account.invoice') | 1796 | inv_obj = self.pool.get('account.invoice') |
1325 | 1801 | rp_obj = self.pool.get('res.partner') | 1797 | rp_obj = self.pool.get('res.partner') |
1326 | 1802 | inv_brw = inv_obj.browse(cr, uid, inv_id, context=context) | 1798 | inv_brw = inv_obj.browse(cr, uid, inv_id, context=context) |
1328 | 1803 | rp_id = rp_obj._find_accounting_partner(inv_brw.partner_id) | 1799 | rp_id = rp_obj._find_accounting_partner(inv_brw.partner_id) |
1329 | 1804 | rp_brw = rp_obj.browse(cr, uid, rp_id, context=context) | 1800 | rp_brw = rp_obj.browse(cr, uid, rp_id, context=context) |
1330 | 1805 | fb_brw = self.browse(cr, uid, fb_id, context=context) | 1801 | fb_brw = self.browse(cr, uid, fb_id, context=context) |
1331 | 1806 | if inv_brw.customs_form_id: | 1802 | if inv_brw.customs_form_id: |
1332 | @@ -1820,7 +1816,7 @@ | |||
1333 | 1820 | raise osv.except_osv("Invalid Procedure!!", | 1816 | raise osv.except_osv("Invalid Procedure!!", |
1334 | 1821 | "Your book needs to be in cancel state to be deleted.") | 1817 | "Your book needs to be in cancel state to be deleted.") |
1335 | 1822 | else: | 1818 | else: |
1337 | 1823 | super(fiscal_book,self).unlink(cr, uid, ids, context=context) | 1819 | super(fiscal_book, self).unlink(cr, uid, ids, context=context) |
1338 | 1824 | return True | 1820 | return True |
1339 | 1825 | 1821 | ||
1340 | 1826 | 1822 | ||
1341 | @@ -1848,7 +1844,6 @@ | |||
1342 | 1848 | #~ TODO: for all taxes realted? only a tax type group? | 1844 | #~ TODO: for all taxes realted? only a tax type group? |
1343 | 1849 | context = context or {} | 1845 | context = context or {} |
1344 | 1850 | res = {}.fromkeys(ids, 0.0) | 1846 | res = {}.fromkeys(ids, 0.0) |
1345 | 1851 | awilt_obj = self.pool.get("account.wh.iva.line.tax") | ||
1346 | 1852 | for fbl_brw in self.browse(cr, uid, ids, context=context): | 1847 | for fbl_brw in self.browse(cr, uid, ids, context=context): |
1347 | 1853 | if fbl_brw.iwdl_id: | 1848 | if fbl_brw.iwdl_id: |
1348 | 1854 | sign = 1 if fbl_brw.doc_type != 'AJST' else -1 | 1849 | sign = 1 if fbl_brw.doc_type != 'AJST' else -1 |
1349 | @@ -1861,12 +1856,12 @@ | |||
1350 | 1861 | for item in self.browse(cr, uid, ids, context=context): | 1856 | for item in self.browse(cr, uid, ids, context=context): |
1351 | 1862 | res[item.id] = { | 1857 | res[item.id] = { |
1352 | 1863 | 'vat_reduced_rate': item.vat_reduced_base and | 1858 | 'vat_reduced_rate': item.vat_reduced_base and |
1354 | 1864 | item.vat_reduced_tax * 100 / item.vat_reduced_base, | 1859 | item.vat_reduced_tax * 100 / item.vat_reduced_base, |
1355 | 1865 | 'vat_general_rate': item.vat_general_base and | 1860 | 'vat_general_rate': item.vat_general_base and |
1357 | 1866 | item.vat_general_tax * 100 / item.vat_general_base, | 1861 | item.vat_general_tax * 100 / item.vat_general_base, |
1358 | 1867 | 'vat_additional_rate': item.vat_additional_base and | 1862 | 'vat_additional_rate': item.vat_additional_base and |
1361 | 1868 | item.vat_additional_tax * 100 / item.vat_additional_base, | 1863 | item.vat_additional_tax * 100 / item.vat_additional_base, |
1362 | 1869 | } | 1864 | } |
1363 | 1870 | return res | 1865 | return res |
1364 | 1871 | 1866 | ||
1365 | 1872 | _description = "Venezuela's Sale & Purchase Fiscal Book Lines" | 1867 | _description = "Venezuela's Sale & Purchase Fiscal Book Lines" |
1366 | @@ -1878,25 +1873,25 @@ | |||
1367 | 1878 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', | 1873 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', |
1368 | 1879 | help='Fiscal Book that owns this book line', ondelete='cascade'), | 1874 | help='Fiscal Book that owns this book line', ondelete='cascade'), |
1369 | 1880 | 'ntp_fb_id': fields.many2one("fiscal.book", "Non-Tax Payer Detail", | 1875 | 'ntp_fb_id': fields.many2one("fiscal.book", "Non-Tax Payer Detail", |
1371 | 1881 | help="Fiscal Book that owns this book line" \ | 1876 | help="Fiscal Book that owns this book line" |
1372 | 1882 | " This Book is only for Non-Tax Payer lines"), | 1877 | " This Book is only for Non-Tax Payer lines"), |
1373 | 1883 | 'fbt_ids': fields.one2many('fiscal.book.taxes', 'fbl_id', | 1878 | 'fbt_ids': fields.one2many('fiscal.book.taxes', 'fbl_id', |
1375 | 1884 | string='Tax Lines', help="Tax Lines being" \ | 1879 | string='Tax Lines', help="Tax Lines being" |
1376 | 1885 | " recorded in a Fiscal Book"), | 1880 | " recorded in a Fiscal Book"), |
1377 | 1886 | 'invoice_id': fields.many2one('account.invoice', 'Invoice', | 1881 | 'invoice_id': fields.many2one('account.invoice', 'Invoice', |
1379 | 1887 | help="Invoice related to this book" \ | 1882 | help="Invoice related to this book" |
1380 | 1888 | " line"), | 1883 | " line"), |
1381 | 1889 | 'iwdl_id': fields.many2one('account.wh.iva.line', 'Vat Withholding', | 1884 | 'iwdl_id': fields.many2one('account.wh.iva.line', 'Vat Withholding', |
1383 | 1890 | help="Withholding iva line related to" \ | 1885 | help="Withholding iva line related to" |
1384 | 1891 | " this book line"), | 1886 | " this book line"), |
1385 | 1892 | 'cf_id': fields.many2one('customs.form', 'Customs Form', | 1887 | 'cf_id': fields.many2one('customs.form', 'Customs Form', |
1388 | 1893 | help="Customs Form being recorded to this" \ | 1888 | help="Customs Form being recorded to this" |
1389 | 1894 | " book line"), | 1889 | " book line"), |
1390 | 1895 | 'parent_id': fields.many2one( | 1890 | 'parent_id': fields.many2one( |
1391 | 1896 | "fiscal.book.line", | 1891 | "fiscal.book.line", |
1392 | 1897 | string="Consolidated Line", | 1892 | string="Consolidated Line", |
1393 | 1898 | ondelete='cascade', | 1893 | ondelete='cascade', |
1395 | 1899 | help="Non-Tax Payer Consolidated Line. Indicate the id of the" \ | 1894 | help="Non-Tax Payer Consolidated Line. Indicate the id of the" |
1396 | 1900 | " consolidated line where this Non-Tax Payer line belongs"), | 1895 | " consolidated line where this Non-Tax Payer line belongs"), |
1397 | 1901 | 'parent_left': fields.integer('Left Parent', select=1), | 1896 | 'parent_left': fields.integer('Left Parent', select=1), |
1398 | 1902 | 'parent_right': fields.integer('Right Parent', select=1), | 1897 | 'parent_right': fields.integer('Right Parent', select=1), |
1399 | @@ -1913,7 +1908,7 @@ | |||
1400 | 1913 | help='Invoice Document Date / Wh IVA Line Voucher Date'), | 1908 | help='Invoice Document Date / Wh IVA Line Voucher Date'), |
1401 | 1914 | 'accounting_date': fields.date( | 1909 | 'accounting_date': fields.date( |
1402 | 1915 | string='Accounting Date', | 1910 | string='Accounting Date', |
1404 | 1916 | help="The day of the accounting record [(invoice, date_invoice)," \ | 1911 | help="The day of the accounting record [(invoice, date_invoice)," |
1405 | 1917 | " (wh iva line, date_ret)]"), | 1912 | " (wh iva line, date_ret)]"), |
1406 | 1918 | 'doc_type': fields.char('Doc. Type', size=8, help='Document Type'), | 1913 | 'doc_type': fields.char('Doc. Type', size=8, help='Document Type'), |
1407 | 1919 | 'partner_name': fields.char(size=128, string='Partner Name', help=''), | 1914 | 'partner_name': fields.char(size=128, string='Partner Name', help=''), |
1408 | @@ -1921,8 +1916,8 @@ | |||
1409 | 1921 | 'affected_invoice': fields.char( | 1916 | 'affected_invoice': fields.char( |
1410 | 1922 | string='Affected Invoice', | 1917 | string='Affected Invoice', |
1411 | 1923 | size=64, | 1918 | size=64, |
1414 | 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" |
1415 | 1925 | " or Credit Note. For an withholding line type means the invoice" \ | 1920 | " or Credit Note. For an withholding line type means the invoice" |
1416 | 1926 | " number related to the withholding"), | 1921 | " number related to the withholding"), |
1417 | 1927 | #~ Apply for wh iva lines | 1922 | #~ Apply for wh iva lines |
1418 | 1928 | 'get_wh_vat': fields.function(_get_wh_vat, | 1923 | 'get_wh_vat': fields.function(_get_wh_vat, |
1419 | @@ -1939,16 +1934,16 @@ | |||
1420 | 1939 | _get_based_tax_debit, | 1934 | _get_based_tax_debit, |
1421 | 1940 | type="float", method=True, store=True, | 1935 | type="float", method=True, store=True, |
1422 | 1941 | string="Based Tax Debit", | 1936 | string="Based Tax Debit", |
1424 | 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" |
1425 | 1943 | " line."), | 1938 | " line."), |
1426 | 1944 | 1939 | ||
1427 | 1945 | #~ Apply for invoice lines | 1940 | #~ Apply for invoice lines |
1428 | 1946 | 'ctrl_number': fields.char(string='Invoice Control number', size=64, | 1941 | 'ctrl_number': fields.char(string='Invoice Control number', size=64, |
1429 | 1947 | help=''), | 1942 | help=''), |
1430 | 1948 | 'invoice_number': fields.char(string='Invoice number', size=64, | 1943 | 'invoice_number': fields.char(string='Invoice number', size=64, |
1434 | 1949 | help="Invoice Number. In case of use" \ | 1944 | help="Invoice Number. In case of use" |
1435 | 1950 | " of fiscal printer this field will" \ | 1945 | " of fiscal printer this field will" |
1436 | 1951 | " store the invoice number generate" \ | 1946 | " store the invoice number generate" |
1437 | 1952 | " by the fiscal printer machine"), | 1947 | " by the fiscal printer machine"), |
1438 | 1953 | 'imex_date': fields.date(string='Imex Date', | 1948 | 'imex_date': fields.date(string='Imex Date', |
1439 | 1954 | help='Invoice Imports/Exports Date'), | 1949 | help='Invoice Imports/Exports Date'), |
1440 | @@ -1964,9 +1959,9 @@ | |||
1441 | 1964 | ('ex', 'Exports'), | 1959 | ('ex', 'Exports'), |
1442 | 1965 | ('tp', 'Tax Payer'), | 1960 | ('tp', 'Tax Payer'), |
1443 | 1966 | ('ntp', 'Non-Tax Payer')], | 1961 | ('ntp', 'Non-Tax Payer')], |
1447 | 1967 | string = 'Transaction Type', required=True, | 1962 | string='Transaction Type', required=True, |
1448 | 1968 | help="Book line transtaction type:" \ | 1963 | help="Book line transtaction type:" |
1449 | 1969 | " - Purchase: Import or Domestic." \ | 1964 | " - Purchase: Import or Domestic." |
1450 | 1970 | " - Sales: Expertation, Tax Payer, Non-Tax Payer."), | 1965 | " - Sales: Expertation, Tax Payer, Non-Tax Payer."), |
1451 | 1971 | 'void_form': fields.char(string='Transaction type', size=192, | 1966 | 'void_form': fields.char(string='Transaction type', size=192, |
1452 | 1972 | help="Operation Type"), | 1967 | help="Operation Type"), |
1453 | @@ -1976,25 +1971,25 @@ | |||
1454 | 1976 | 'custom_statement': fields.char(string="Custom Statement", | 1971 | 'custom_statement': fields.char(string="Custom Statement", |
1455 | 1977 | size=192, help=""), | 1972 | size=192, help=""), |
1456 | 1978 | #~ -- taxes fields | 1973 | #~ -- taxes fields |
1459 | 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" |
1460 | 1980 | " the invoice (untaxed amount) plus" \ | 1975 | " the invoice (untaxed amount) plus" |
1461 | 1981 | " all tax amount of the related taxes"), | 1976 | " all tax amount of the related taxes"), |
1464 | 1982 | 'vat_sdcf': fields.float("SDCF", help="Not entitled to tax credit" \ | 1977 | 'vat_sdcf': fields.float("SDCF", help="Not entitled to tax credit" |
1465 | 1983 | " (The field name correspond to the spanih" \ | 1978 | " (The field name correspond to the spanih" |
1466 | 1984 | " acronym for 'Sin Derecho a Credito Fiscal')"), | 1979 | " acronym for 'Sin Derecho a Credito Fiscal')"), |
1468 | 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" |
1469 | 1986 | " tax percentage"), | 1981 | " tax percentage"), |
1479 | 1987 | 'vat_reduced_base': fields.float("RED BASE", help="Vat Reduced Base" \ | 1982 | 'vat_reduced_base': fields.float("RED BASE", help="Vat Reduced Base" |
1480 | 1988 | " Amount"), | 1983 | " Amount"), |
1481 | 1989 | 'vat_reduced_tax': fields.float("RED TAX", help="Vat Reduced Tax" \ | 1984 | 'vat_reduced_tax': fields.float("RED TAX", help="Vat Reduced Tax" |
1482 | 1990 | " Amount"), | 1985 | " Amount"), |
1483 | 1991 | 'vat_general_base': fields.float("GRAL BASE",help="Vat General Base" \ | 1986 | 'vat_general_base': fields.float("GRAL BASE", help="Vat General Base" |
1484 | 1992 | " Amount"), | 1987 | " Amount"), |
1485 | 1993 | 'vat_general_tax': fields.float("GRAL TAX", help="Vat General Tax" \ | 1988 | 'vat_general_tax': fields.float("GRAL TAX", help="Vat General Tax" |
1486 | 1994 | " Amount"), | 1989 | " Amount"), |
1487 | 1995 | 'vat_additional_base': fields.float("ADD BASE", help="Vat Generald" \ | 1990 | 'vat_additional_base': fields.float("ADD BASE", help="Vat Generald" |
1488 | 1996 | " plus Additional Base Amount"), | 1991 | " plus Additional Base Amount"), |
1490 | 1997 | 'vat_additional_tax': fields.float("ADD TAX", help="Vat General plus" \ | 1992 | 'vat_additional_tax': fields.float("ADD TAX", help="Vat General plus" |
1491 | 1998 | " Additional Tax Amount"), | 1993 | " Additional Tax Amount"), |
1492 | 1999 | 'vat_reduced_rate': fields.function( | 1994 | 'vat_reduced_rate': fields.function( |
1493 | 2000 | _compute_vat_rates, method=True, type='float', | 1995 | _compute_vat_rates, method=True, type='float', |
1494 | @@ -2012,7 +2007,8 @@ | |||
1495 | 2012 | 2007 | ||
1496 | 2013 | _defaults = { | 2008 | _defaults = { |
1497 | 2014 | 'rank': 0, | 2009 | 'rank': 0, |
1499 | 2015 | } | 2010 | } |
1500 | 2011 | |||
1501 | 2016 | 2012 | ||
1502 | 2017 | class fiscal_book_taxes(orm.Model): | 2013 | class fiscal_book_taxes(orm.Model): |
1503 | 2018 | 2014 | ||
1504 | @@ -2065,14 +2061,15 @@ | |||
1505 | 2065 | ('ex', 'Exports'), | 2061 | ('ex', 'Exports'), |
1506 | 2066 | ('tp', 'Tax Payer'), | 2062 | ('tp', 'Tax Payer'), |
1507 | 2067 | ('ntp', 'Non-Tax Payer')], | 2063 | ('ntp', 'Non-Tax Payer')], |
1511 | 2068 | string = 'Operation Type', | 2064 | string='Operation Type', |
1512 | 2069 | help="Operation Type:" \ | 2065 | help="Operation Type:" |
1513 | 2070 | " - Purchase: Import or Domestic." \ | 2066 | " - Purchase: Import or Domestic." |
1514 | 2071 | " - Sales: Expertation, Tax Payer, Non-Tax Payer."), | 2067 | " - Sales: Expertation, Tax Payer, Non-Tax Payer."), |
1515 | 2072 | 'base_amount_sum': fields.float('Taxable Amount Sum'), | 2068 | 'base_amount_sum': fields.float('Taxable Amount Sum'), |
1516 | 2073 | 'tax_amount_sum': fields.float('Taxed Amount Sum'), | 2069 | 'tax_amount_sum': fields.float('Taxed Amount Sum'), |
1517 | 2074 | } | 2070 | } |
1518 | 2075 | 2071 | ||
1519 | 2072 | |||
1520 | 2076 | class adjustment_book_line(orm.Model): | 2073 | class adjustment_book_line(orm.Model): |
1521 | 2077 | 2074 | ||
1522 | 2078 | _name = 'adjustment.book.line' | 2075 | _name = 'adjustment.book.line' |
1523 | 2079 | 2076 | ||
1524 | === modified file 'l10n_ve_fiscal_book/model/invoice.py' | |||
1525 | --- l10n_ve_fiscal_book/model/invoice.py 2014-07-31 18:26:14 +0000 | |||
1526 | +++ l10n_ve_fiscal_book/model/invoice.py 2014-10-11 00:06:17 +0000 | |||
1527 | @@ -32,10 +32,10 @@ | |||
1528 | 32 | 32 | ||
1529 | 33 | _columns = { | 33 | _columns = { |
1530 | 34 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', | 34 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', |
1532 | 35 | help='Fiscal Book where this line is ' \ | 35 | help='Fiscal Book where this line is ' |
1533 | 36 | 'related to'), | 36 | 'related to'), |
1534 | 37 | 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book', | 37 | 'issue_fb_id': fields.many2one('fiscal.book', 'Fiscal Book', |
1536 | 38 | help='Fiscal Book where this invoice ' \ | 38 | help='Fiscal Book where this invoice ' |
1537 | 39 | 'needs to be add'), | 39 | 'needs to be add'), |
1538 | 40 | } | 40 | } |
1539 | 41 | 41 | ||
1540 | 42 | 42 | ||
1541 | === modified file 'l10n_ve_fiscal_book/model/wh_iva.py' | |||
1542 | --- l10n_ve_fiscal_book/model/wh_iva.py 2013-04-30 13:53:01 +0000 | |||
1543 | +++ l10n_ve_fiscal_book/model/wh_iva.py 2014-10-11 00:06:17 +0000 | |||
1544 | @@ -23,13 +23,14 @@ | |||
1545 | 23 | # You should have received a copy of the GNU Affero General Public License | 23 | # You should have received a copy of the GNU Affero General Public License |
1546 | 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/>. |
1547 | 25 | ############################################################################## | 25 | ############################################################################## |
1550 | 26 | from openerp.osv import osv, orm, fields | 26 | from openerp.osv import fields |
1551 | 27 | from openerp.tools.translate import _ | 27 | from openerp.osv import orm |
1552 | 28 | |||
1553 | 28 | 29 | ||
1554 | 29 | class account_wh_iva_line(orm.Model): | 30 | class account_wh_iva_line(orm.Model): |
1556 | 30 | _inherit= "account.wh.iva.line" | 31 | _inherit = "account.wh.iva.line" |
1557 | 31 | _columns = { | 32 | _columns = { |
1559 | 32 | 'fb_id':fields.many2one('fiscal.book','Fiscal Book', | 33 | 'fb_id': fields.many2one('fiscal.book', 'Fiscal Book', |
1560 | 33 | help='Fiscal Book where this line is related to'), | 34 | help='Fiscal Book where this line is related to'), |
1561 | 34 | } | 35 | } |
1562 | 35 | 36 | ||
1563 | @@ -41,7 +42,6 @@ | |||
1564 | 41 | inv_obj = self.pool.get('account.invoice') | 42 | inv_obj = self.pool.get('account.invoice') |
1565 | 42 | inv = inv_obj.browse(cr, uid, inv_id, context=context) | 43 | inv = inv_obj.browse(cr, uid, inv_id, context=context) |
1566 | 43 | if inv.wh_iva and inv.wh_iva_id: | 44 | if inv.wh_iva and inv.wh_iva_id: |
1569 | 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) |
1570 | 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) |
1571 | 46 | return True | 47 | return True |
1572 | 47 | |||
1573 | 48 | 48 | ||
1574 | === modified file 'l10n_ve_fiscal_book/wizard/__init__.py' | |||
1575 | --- l10n_ve_fiscal_book/wizard/__init__.py 2014-09-19 14:57:59 +0000 | |||
1576 | +++ l10n_ve_fiscal_book/wizard/__init__.py 2014-10-11 00:06:17 +0000 | |||
1577 | @@ -3,7 +3,7 @@ | |||
1578 | 3 | # | 3 | # |
1579 | 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. |
1580 | 5 | # Javier Duran <javier@vauxoo.com> | 5 | # Javier Duran <javier@vauxoo.com> |
1582 | 6 | # | 6 | # |
1583 | 7 | # | 7 | # |
1584 | 8 | # WARNING: This program as such is intended to be used by professional | 8 | # WARNING: This program as such is intended to be used by professional |
1585 | 9 | # programmers who take the whole responsability of assessing all potential | 9 | # programmers who take the whole responsability of assessing all potential |
1586 | @@ -28,5 +28,5 @@ | |||
1587 | 28 | # | 28 | # |
1588 | 29 | ############################################################################## | 29 | ############################################################################## |
1589 | 30 | 30 | ||
1592 | 31 | import fiscal_book_wizard | 31 | from . import fiscal_book_wizard |
1593 | 32 | import change_invoice_sin_cred | 32 | from . import change_invoice_sin_cred |
1594 | 33 | 33 | ||
1595 | === modified file 'l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py' | |||
1596 | --- l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py 2014-09-19 16:14:51 +0000 | |||
1597 | +++ l10n_ve_fiscal_book/wizard/change_invoice_sin_cred.py 2014-10-11 00:06:17 +0000 | |||
1598 | @@ -25,7 +25,6 @@ | |||
1599 | 25 | 25 | ||
1600 | 26 | from openerp.osv import osv, fields | 26 | from openerp.osv import osv, fields |
1601 | 27 | from openerp.tools.translate import _ | 27 | from openerp.tools.translate import _ |
1602 | 28 | import decimal_precision as dp | ||
1603 | 29 | 28 | ||
1604 | 30 | 29 | ||
1605 | 31 | class change_invoice_sin_credwizard(osv.TransientModel): | 30 | class change_invoice_sin_credwizard(osv.TransientModel): |
1606 | @@ -47,7 +46,7 @@ | |||
1607 | 47 | def set_sin_cred(self, cr, uid, ids, context=None): | 46 | def set_sin_cred(self, cr, uid, ids, context=None): |
1608 | 48 | """ | 47 | """ |
1609 | 49 | Change the sin cred field in the invoice | 48 | Change the sin cred field in the invoice |
1611 | 50 | @return | 49 | @return |
1612 | 51 | """ | 50 | """ |
1613 | 52 | context = context or {} | 51 | context = context or {} |
1614 | 53 | ids = isinstance(ids, (int, long)) and [ids] or ids | 52 | ids = isinstance(ids, (int, long)) and [ids] or ids |
1615 | 54 | 53 | ||
1616 | === modified file 'l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py' | |||
1617 | --- l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2014-10-07 22:02:14 +0000 | |||
1618 | +++ l10n_ve_fiscal_book/wizard/fiscal_book_wizard.py 2014-10-11 00:06:17 +0000 | |||
1619 | @@ -25,14 +25,13 @@ | |||
1620 | 25 | # along with this program; if not, write to the Free Software | 25 | # along with this program; if not, write to the Free Software |
1621 | 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. |
1622 | 27 | ############################################################################### | 27 | ############################################################################### |
1626 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
1624 | 29 | from openerp.osv import fields | ||
1625 | 30 | import sys | ||
1627 | 31 | from openerp.tools.translate import _ | 29 | from openerp.tools.translate import _ |
1628 | 32 | import time | 30 | import time |
1629 | 33 | 31 | ||
1630 | 34 | 32 | ||
1631 | 35 | class fiscal_book_wizard(osv.osv_memory): | 33 | class fiscal_book_wizard(osv.osv_memory): |
1632 | 34 | |||
1633 | 36 | """ | 35 | """ |
1634 | 37 | Sales book wizard implemented using the osv_memory wizard system | 36 | Sales book wizard implemented using the osv_memory wizard system |
1635 | 38 | """ | 37 | """ |
1636 | @@ -44,7 +43,7 @@ | |||
1637 | 44 | ids = self.pool.get('account.period').search( | 43 | ids = self.pool.get('account.period').search( |
1638 | 45 | cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)]) | 44 | cr, uid, [('date_start', '<=', dt), ('date_stop', '>=', dt)]) |
1639 | 46 | if not ids: | 45 | if not ids: |
1641 | 47 | raise osv.except_osv(_('Error !'), _('No period defined for this' \ | 46 | raise osv.except_osv(_('Error !'), _('No period defined for this' |
1642 | 48 | ' date !\nPlease create a fiscal year.')) | 47 | ' date !\nPlease create a fiscal year.')) |
1643 | 49 | return ids | 48 | return ids |
1644 | 50 | 49 | ||
1645 | @@ -88,7 +87,7 @@ | |||
1646 | 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] |
1647 | 89 | amount = (invoice.amount_tax * invoice.p_ret) / 100 | 88 | amount = (invoice.amount_tax * invoice.p_ret) / 100 |
1648 | 90 | rp_obj = self.pool.get('res.partner') | 89 | rp_obj = self.pool.get('res.partner') |
1650 | 91 | rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id, | 90 | rp_brw = rp_obj._find_accounting_partner(invoice.partner_id).id, |
1651 | 92 | return (invoice.date_invoice, | 91 | return (invoice.date_invoice, |
1652 | 93 | invoice.date_document, | 92 | invoice.date_document, |
1653 | 94 | rp_brw.vat, | 93 | rp_brw.vat, |
1654 | @@ -151,17 +150,17 @@ | |||
1655 | 151 | 150 | ||
1656 | 152 | fiscal_book_obj = self.pool.get('fiscal.book') | 151 | fiscal_book_obj = self.pool.get('fiscal.book') |
1657 | 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'])]) |
1659 | 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]) |
1660 | 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) |
1661 | 156 | res.update({'type': fiscal_book_o.type}) | 155 | res.update({'type': fiscal_book_o.type}) |
1662 | 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 ''}) |
1663 | 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 ''}) |
1664 | 159 | if fiscal_book_o.fortnight == 'first': | 158 | if fiscal_book_o.fortnight == 'first': |
1667 | 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') |
1668 | 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)}) |
1669 | 162 | elif fiscal_book_o.fortnight == 'second': | 161 | elif fiscal_book_o.fortnight == 'second': |
1672 | 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') |
1673 | 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)}) |
1674 | 165 | return res | 164 | return res |
1675 | 166 | 165 | ||
1676 | 167 | def check_report(self, cr, uid, ids, context=None): | 166 | def check_report(self, cr, uid, ids, context=None): |
1677 | @@ -190,14 +189,12 @@ | |||
1678 | 190 | "control_start": fields.integer("Control Start"), | 189 | "control_start": fields.integer("Control Start"), |
1679 | 191 | "control_end": fields.integer("Control End"), | 190 | "control_end": fields.integer("Control End"), |
1680 | 192 | "type": fields.selection([ | 191 | "type": fields.selection([ |
1683 | 193 | ("sale", _("Sale")), | 192 | ("sale", _("Sale")), |
1684 | 194 | ("purchase", _("Purchase")), | 193 | ("purchase", _("Purchase")), |
1685 | 195 | ], "Type", required=True, | 194 | ], "Type", required=True, |
1686 | 196 | ), | 195 | ), |
1687 | 197 | } | 196 | } |
1688 | 198 | 197 | ||
1689 | 199 | |||
1690 | 200 | |||
1691 | 201 | _defaults = { | 198 | _defaults = { |
1692 | 202 | 'date_start': lambda *a: time.strftime('%Y-%m-%d'), | 199 | 'date_start': lambda *a: time.strftime('%Y-%m-%d'), |
1693 | 203 | 'date_end': lambda *a: time.strftime('%Y-%m-%d'), | 200 | 'date_end': lambda *a: time.strftime('%Y-%m-%d'), |
1694 | 204 | 201 | ||
1695 | === modified file 'l10n_ve_fiscal_requirements/__init__.py' | |||
1696 | --- l10n_ve_fiscal_requirements/__init__.py 2012-11-29 21:05:06 +0000 | |||
1697 | +++ l10n_ve_fiscal_requirements/__init__.py 2014-10-11 00:06:17 +0000 | |||
1698 | @@ -5,7 +5,7 @@ | |||
1699 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1700 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1701 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1703 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1704 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1705 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1706 | 11 | ############################################################################# | 11 | ############################################################################# |
1707 | @@ -22,6 +22,6 @@ | |||
1708 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
1709 | 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/>. |
1710 | 24 | ################################################################################ | 24 | ################################################################################ |
1713 | 25 | import model | 25 | from . import model |
1714 | 26 | import wizard | 26 | from . import wizard |
1715 | 27 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 27 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1716 | 28 | 28 | ||
1717 | === modified file 'l10n_ve_fiscal_requirements/__openerp__.py' | |||
1718 | --- l10n_ve_fiscal_requirements/__openerp__.py 2014-04-21 20:00:21 +0000 | |||
1719 | +++ l10n_ve_fiscal_requirements/__openerp__.py 2014-10-11 00:06:17 +0000 | |||
1720 | @@ -5,7 +5,7 @@ | |||
1721 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1722 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1723 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1725 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1726 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1727 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1728 | 11 | ############################################################################# | 11 | ############################################################################# |
1729 | @@ -50,7 +50,7 @@ | |||
1730 | 50 | create the corresponding journal and account. | 50 | create the corresponding journal and account. |
1731 | 51 | TODO : Include this on wizard configuration. | 51 | TODO : Include this on wizard configuration. |
1732 | 52 | 52 | ||
1734 | 53 | If you install this module with invoice data on the database, the concept_id will be | 53 | If you install this module with invoice data on the database, the concept_id will be |
1735 | 54 | Empty for all those invoices, so, when you try to modify them you have to add a value on | 54 | Empty for all those invoices, so, when you try to modify them you have to add a value on |
1736 | 55 | that field | 55 | that field |
1737 | 56 | 56 | ||
1738 | @@ -65,7 +65,7 @@ | |||
1739 | 65 | * Addons-vauxoo: lp:addons-vauxoo/7.0 | 65 | * Addons-vauxoo: lp:addons-vauxoo/7.0 |
1740 | 66 | """, | 66 | """, |
1741 | 67 | "depends" : [ | 67 | "depends" : [ |
1743 | 68 | "account", | 68 | "account", |
1744 | 69 | "base_vat", | 69 | "base_vat", |
1745 | 70 | "account_accountant", | 70 | "account_accountant", |
1746 | 71 | "account_voucher", | 71 | "account_voucher", |
1747 | 72 | 72 | ||
1748 | === modified file 'l10n_ve_fiscal_requirements/installer.py' | |||
1749 | --- l10n_ve_fiscal_requirements/installer.py 2013-02-13 19:39:18 +0000 | |||
1750 | +++ l10n_ve_fiscal_requirements/installer.py 2014-10-11 00:06:17 +0000 | |||
1751 | @@ -5,7 +5,7 @@ | |||
1752 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1753 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1754 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1756 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1757 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1758 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1759 | 11 | ############################################################################# | 11 | ############################################################################# |
1760 | @@ -23,45 +23,46 @@ | |||
1761 | 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/>. |
1762 | 24 | ################################################################################ | 24 | ################################################################################ |
1763 | 25 | from openerp.osv import osv, fields | 25 | from openerp.osv import osv, fields |
1765 | 26 | from openerp.tools.translate import _ | 26 | |
1766 | 27 | 27 | ||
1767 | 28 | class fiscal_requirements_config(osv.osv_memory): | 28 | class fiscal_requirements_config(osv.osv_memory): |
1768 | 29 | |||
1769 | 29 | """ | 30 | """ |
1770 | 30 | Fiscal Requirements installer wizard | 31 | Fiscal Requirements installer wizard |
1771 | 31 | """ | 32 | """ |
1772 | 32 | _name = 'fiscal.requirements.config' | 33 | _name = 'fiscal.requirements.config' |
1773 | 33 | _inherit = 'res.config' | 34 | _inherit = 'res.config' |
1775 | 34 | _description= __doc__ | 35 | _description = __doc__ |
1776 | 35 | 36 | ||
1777 | 36 | def onchange_update_rif(self, cr, uid, ids, vat): | 37 | def onchange_update_rif(self, cr, uid, ids, vat): |
1778 | 37 | context = {'exec_wizard': True, 'vat': vat} | 38 | context = {'exec_wizard': True, 'vat': vat} |
1780 | 38 | 39 | ||
1781 | 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) |
1782 | 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')} |
1783 | 41 | return {'value': v} | 42 | return {'value': v} |
1784 | 42 | 43 | ||
1785 | 43 | def execute(self, cr, uid, ids, context=None): | 44 | def execute(self, cr, uid, ids, context=None): |
1786 | 44 | ''' | 45 | ''' |
1788 | 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 |
1789 | 46 | fiscal requirement and Venezuela Laws | 47 | fiscal requirement and Venezuela Laws |
1790 | 47 | and update all your partners information. | 48 | and update all your partners information. |
1791 | 48 | ''' | 49 | ''' |
1792 | 49 | wiz_data = self.browse(cr, uid, ids[0]) | 50 | wiz_data = self.browse(cr, uid, ids[0]) |
1793 | 50 | partner = self.pool.get('res.users').browse(cr, uid, uid).company_id.partner_id | 51 | partner = self.pool.get('res.users').browse(cr, uid, uid).company_id.partner_id |
1803 | 51 | #Data on res partner address - Invoice | 52 | # Data on res partner address - Invoice |
1804 | 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], { |
1805 | 53 | 'street':wiz_data.add, | 54 | 'street': wiz_data.add, |
1806 | 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], |
1807 | 55 | 'name': wiz_data.name, | 56 | 'name': wiz_data.name, |
1808 | 56 | 'vat': "VE%s" % wiz_data.vat.upper(), | 57 | 'vat': "VE%s" % wiz_data.vat.upper(), |
1809 | 57 | 'vat_subjected': wiz_data.vat_subjected, | 58 | 'vat_subjected': wiz_data.vat_subjected, |
1810 | 58 | 59 | ||
1811 | 59 | }) | 60 | }) |
1812 | 60 | 61 | ||
1813 | 61 | _columns = { | 62 | _columns = { |
1814 | 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'), |
1815 | 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"), |
1817 | 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), |
1818 | 65 | 'vat_subjected': fields.boolean("Apply VAT?"), | 66 | 'vat_subjected': fields.boolean("Apply VAT?"), |
1819 | 66 | } | 67 | } |
1820 | 67 | fiscal_requirements_config() | 68 | fiscal_requirements_config() |
1821 | 68 | 69 | ||
1822 | === modified file 'l10n_ve_fiscal_requirements/model/__init__.py' | |||
1823 | --- l10n_ve_fiscal_requirements/model/__init__.py 2013-04-26 08:34:02 +0000 | |||
1824 | +++ l10n_ve_fiscal_requirements/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
1825 | @@ -5,7 +5,7 @@ | |||
1826 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1827 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1828 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1830 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1831 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1832 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1833 | 11 | ############################################################################# | 11 | ############################################################################# |
1834 | @@ -22,12 +22,12 @@ | |||
1835 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
1836 | 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/>. |
1837 | 24 | ################################################################################ | 24 | ################################################################################ |
1846 | 25 | import res_company | 25 | from . import res_company |
1847 | 26 | import account | 26 | from . import account |
1848 | 27 | import partner | 27 | from . import partner |
1849 | 28 | import invoice | 28 | from . import invoice |
1850 | 29 | import res_users | 29 | from . import res_users |
1851 | 30 | import seniat_url | 30 | from . import seniat_url |
1852 | 31 | import l10n_ut | 31 | from . import l10n_ut |
1853 | 32 | import account_tax | 32 | from . import account_tax |
1854 | 33 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 33 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1855 | 34 | 34 | ||
1856 | === modified file 'l10n_ve_fiscal_requirements/model/account.py' | |||
1857 | --- l10n_ve_fiscal_requirements/model/account.py 2013-11-17 22:53:12 +0000 | |||
1858 | +++ l10n_ve_fiscal_requirements/model/account.py 2014-10-11 00:06:17 +0000 | |||
1859 | @@ -5,7 +5,7 @@ | |||
1860 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1861 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1862 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1864 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1865 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1866 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1867 | 11 | ############################################################################# | 11 | ############################################################################# |
1868 | @@ -25,20 +25,21 @@ | |||
1869 | 25 | 25 | ||
1870 | 26 | from openerp.osv import fields, osv | 26 | from openerp.osv import fields, osv |
1871 | 27 | 27 | ||
1872 | 28 | |||
1873 | 28 | class account_journal(osv.osv): | 29 | class account_journal(osv.osv): |
1874 | 29 | _inherit = 'account.journal' | 30 | _inherit = 'account.journal' |
1875 | 30 | 31 | ||
1876 | 31 | _columns = { | 32 | _columns = { |
1890 | 32 | 'type': fields.selection([('sale', 'Sale'),('sale_refund','Sale Refund'), | 33 | 'type': fields.selection([('sale', 'Sale'), ('sale_refund', 'Sale Refund'), |
1891 | 33 | ('purchase', 'Purchase'), ('purchase_refund','Purchase Refund'), | 34 | ('purchase', 'Purchase'), ('purchase_refund', 'Purchase Refund'), |
1892 | 34 | ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), | 35 | ('cash', 'Cash'), ('bank', 'Bank and Cheques'), ('general', 'General'), |
1893 | 35 | ('situation', 'Opening/Closing Situation'),('sale_debit', 'Sale Debit'), | 36 | ('situation', 'Opening/Closing Situation'), ('sale_debit', 'Sale Debit'), |
1894 | 36 | ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True, | 37 | ('purchase_debit', 'Purchase Debit')], 'Type', size=32, required=True, |
1895 | 37 | help = "Select 'Sale' for customer invoices journals."\ | 38 | help="Select 'Sale' for customer invoices journals." |
1896 | 38 | " Select 'Purchase' for supplier invoices journals."\ | 39 | " Select 'Purchase' for supplier invoices journals." |
1897 | 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." |
1898 | 40 | " Select 'General' for miscellaneous operations journals."\ | 41 | " Select 'General' for miscellaneous operations journals." |
1899 | 41 | " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\ | 42 | " Select 'Opening/Closing Situation' for entries generated for new fiscal years." |
1900 | 42 | " Select 'Sale Debit' for customer debit note journals."\ | 43 | " Select 'Sale Debit' for customer debit note journals." |
1901 | 43 | " Select 'Purchase Debit' for supplier debit note journals.") | 44 | " Select 'Purchase Debit' for supplier debit note journals.") |
1902 | 44 | } | 45 | } |
1903 | 45 | 46 | ||
1904 | === modified file 'l10n_ve_fiscal_requirements/model/account_tax.py' | |||
1905 | --- l10n_ve_fiscal_requirements/model/account_tax.py 2013-11-21 04:33:16 +0000 | |||
1906 | +++ l10n_ve_fiscal_requirements/model/account_tax.py 2014-10-11 00:06:17 +0000 | |||
1907 | @@ -5,7 +5,7 @@ | |||
1908 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1909 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1910 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1912 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1913 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1914 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1915 | 11 | ############################################################################# | 11 | ############################################################################# |
1916 | @@ -30,12 +30,12 @@ | |||
1917 | 30 | _inherit = 'account.tax' | 30 | _inherit = 'account.tax' |
1918 | 31 | _columns = { | 31 | _columns = { |
1919 | 32 | 'appl_type': fields.selection( | 32 | 'appl_type': fields.selection( |
1922 | 33 | [('exento', 'Exempt'), | 33 | [('exento', 'Exempt'), |
1923 | 34 | ('sdcf', 'Not entitled to tax credit'), | 34 | ('sdcf', 'Not entitled to tax credit'), |
1924 | 35 | ('general', 'General Aliquot'), | 35 | ('general', 'General Aliquot'), |
1925 | 36 | ('reducido', 'Reducted Aliquot'), | 36 | ('reducido', 'Reducted Aliquot'), |
1931 | 37 | ('adicional', 'General Aliquot + Additional')], | 37 | ('adicional', 'General Aliquot + Additional')], |
1932 | 38 | 'Aliquot Type', | 38 | 'Aliquot Type', |
1933 | 39 | required=False, | 39 | required=False, |
1934 | 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'), |
1935 | 41 | } | 41 | } |
1936 | 42 | 42 | ||
1937 | === modified file 'l10n_ve_fiscal_requirements/model/invoice.py' | |||
1938 | --- l10n_ve_fiscal_requirements/model/invoice.py 2014-09-19 16:34:33 +0000 | |||
1939 | +++ l10n_ve_fiscal_requirements/model/invoice.py 2014-10-11 00:06:17 +0000 | |||
1940 | @@ -5,7 +5,7 @@ | |||
1941 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
1942 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
1943 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
1945 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
1946 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
1947 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
1948 | 11 | ############################################################################# | 11 | ############################################################################# |
1949 | @@ -25,45 +25,49 @@ | |||
1950 | 25 | 25 | ||
1951 | 26 | from openerp.osv import fields, osv | 26 | from openerp.osv import fields, osv |
1952 | 27 | from openerp.tools.translate import _ | 27 | from openerp.tools.translate import _ |
1953 | 28 | |||
1954 | 29 | |||
1955 | 28 | class account_invoice(osv.osv): | 30 | class account_invoice(osv.osv): |
1956 | 29 | 31 | ||
1957 | 30 | def _get_journal(self, cr, uid, context=None): | 32 | def _get_journal(self, cr, uid, context=None): |
1959 | 31 | """ Return the journal which is | 33 | """ Return the journal which is |
1960 | 32 | used in the current user's company, otherwise | 34 | used in the current user's company, otherwise |
1961 | 33 | it does not exist, return false | 35 | it does not exist, return false |
1962 | 34 | """ | 36 | """ |
1964 | 35 | 37 | ||
1965 | 36 | context = context or {} | 38 | context = context or {} |
1966 | 37 | res = super(account_invoice, self)._get_journal(cr, uid, context=context) | 39 | res = super(account_invoice, self)._get_journal(cr, uid, context=context) |
1968 | 38 | if res: return res | 40 | if res: |
1969 | 41 | return res | ||
1970 | 39 | type_inv = context.get('type', 'sale') | 42 | type_inv = context.get('type', 'sale') |
1971 | 40 | if type_inv in ('sale_debit', 'purchase_debit'): | 43 | if type_inv in ('sale_debit', 'purchase_debit'): |
1972 | 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) |
1973 | 42 | company_id = context.get('company_id', user.company_id.id) | 45 | company_id = context.get('company_id', user.company_id.id) |
1974 | 43 | journal_obj = self.pool.get('account.journal') | 46 | journal_obj = self.pool.get('account.journal') |
1976 | 44 | domain = [('company_id', '=', company_id),('type', '=',type_inv)] | 47 | domain = [('company_id', '=', company_id), ('type', '=', type_inv)] |
1977 | 45 | res = journal_obj.search(cr, uid, domain, limit=1) | 48 | res = journal_obj.search(cr, uid, domain, limit=1) |
1978 | 46 | return res and res[0] or False | 49 | return res and res[0] or False |
1979 | 47 | 50 | ||
1980 | 48 | def _unique_invoice_per_partner(self, cr, uid, ids, context=None): | 51 | def _unique_invoice_per_partner(self, cr, uid, ids, context=None): |
1982 | 49 | """ Return false when it is found | 52 | """ Return false when it is found |
1983 | 50 | that the bill is not out_invoice or out_refund, | 53 | that the bill is not out_invoice or out_refund, |
1984 | 51 | and it is not unique to the partner. | 54 | and it is not unique to the partner. |
1985 | 52 | """ | 55 | """ |
1988 | 53 | 56 | ||
1989 | 54 | if context is None: context={} | 57 | if context is None: |
1990 | 58 | context = {} | ||
1991 | 55 | inv_brw = self.browse(cr, uid, ids, context=context) | 59 | inv_brw = self.browse(cr, uid, ids, context=context) |
1992 | 56 | ids_ivo = [] | 60 | ids_ivo = [] |
1993 | 57 | for inv in inv_brw: | 61 | for inv in inv_brw: |
1994 | 58 | ids_ivo.append(inv.id) | 62 | ids_ivo.append(inv.id) |
1996 | 59 | if inv.type in ('out_invoice','out_refund'): | 63 | if inv.type in ('out_invoice', 'out_refund'): |
1997 | 60 | return True | 64 | return True |
2004 | 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, |
2005 | 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()), |
2006 | 63 | ('type','=',inv.type), | 67 | ('type', '=', inv.type), |
2007 | 64 | ('partner_id','=',inv.partner_id.id)], | 68 | ('partner_id', '=', inv.partner_id.id)], |
2008 | 65 | context=context) or [] | 69 | context=context) or [] |
2009 | 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: |
2010 | 67 | return False | 71 | return False |
2011 | 68 | return True | 72 | return True |
2012 | 69 | 73 | ||
2013 | @@ -73,36 +77,35 @@ | |||
2014 | 73 | """ | 77 | """ |
2015 | 74 | context = context or {} | 78 | context = context or {} |
2016 | 75 | res = True | 79 | res = True |
2018 | 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) |
2019 | 77 | rc_obj = self.pool.get('res.company') | 81 | rc_obj = self.pool.get('res.company') |
2020 | 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) |
2022 | 79 | 83 | ||
2023 | 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: |
2024 | 81 | res = False | 85 | res = False |
2025 | 82 | return res | 86 | return res |
2026 | 83 | 87 | ||
2027 | 84 | _inherit = 'account.invoice' | 88 | _inherit = 'account.invoice' |
2028 | 85 | _columns = { | 89 | _columns = { |
2030 | 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."), |
2031 | 87 | 'sin_cred': fields.boolean('Exclude this document from fiscal book', | 91 | 'sin_cred': fields.boolean('Exclude this document from fiscal book', |
2032 | 88 | readonly=False, | 92 | readonly=False, |
2033 | 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)"), |
2039 | 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), |
2040 | 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"), |
2041 | 92 | #TODO": maybe it must be a many2one to declared FiscalPrinter when FiscalV is ready | 96 | # TODO": maybe it must be a many2one to declared FiscalPrinter when FiscalV is ready |
2042 | 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."), |
2043 | 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'), |
2044 | 95 | 'z_report': fields.char(string='Report Z', size=64, help=""), | 99 | 'z_report': fields.char(string='Report Z', size=64, help=""), |
2045 | 96 | } | 100 | } |
2046 | 97 | 101 | ||
2048 | 98 | _defaults ={ | 102 | _defaults = { |
2049 | 99 | 'loc_req': _get_loc_req | 103 | 'loc_req': _get_loc_req |
2052 | 100 | } | 104 | } |
2051 | 101 | |||
2053 | 102 | 105 | ||
2054 | 103 | _constraints = [ | 106 | _constraints = [ |
2057 | 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)']), |
2058 | 105 | ] | 108 | ] |
2059 | 106 | 109 | ||
2060 | 107 | def copy(self, cr, uid, id, default={}, context=None): | 110 | def copy(self, cr, uid, id, default={}, context=None): |
2061 | 108 | """ Allows you to duplicate a record, | 111 | """ Allows you to duplicate a record, |
2062 | @@ -112,33 +115,34 @@ | |||
2063 | 112 | if context is None: | 115 | if context is None: |
2064 | 113 | context = {} | 116 | context = {} |
2065 | 114 | default.update({ | 117 | default.update({ |
2068 | 115 | 'nro_ctrl':None, | 118 | 'nro_ctrl': None, |
2069 | 116 | 'supplier_invoice_number':None, | 119 | 'supplier_invoice_number': None, |
2070 | 117 | 'sin_cred': False, | 120 | 'sin_cred': False, |
2071 | 118 | # No cleaned in this copy because it is related to the previous | 121 | # No cleaned in this copy because it is related to the previous |
2072 | 119 | # document, if previous document says so this too | 122 | # document, if previous document says so this too |
2073 | 120 | 'date_document': False, | 123 | 'date_document': False, |
2076 | 121 | 'invoice_printer' : '', | 124 | 'invoice_printer': '', |
2077 | 122 | 'fiscal_printer' : '', | 125 | 'fiscal_printer': '', |
2078 | 123 | # No cleaned in this copy because it is related to the previous | 126 | # No cleaned in this copy because it is related to the previous |
2079 | 124 | # document, if previous document says so this too | 127 | # document, if previous document says so this too |
2081 | 125 | #'loc_req':False, | 128 | #'loc_req':False, |
2082 | 126 | 'z_report': '', | 129 | 'z_report': '', |
2083 | 127 | }) | 130 | }) |
2084 | 128 | return super(account_invoice, self).copy(cr, uid, id, default, context) | 131 | return super(account_invoice, self).copy(cr, uid, id, default, context) |
2085 | 129 | 132 | ||
2086 | 130 | def write(self, cr, uid, ids, vals, context=None): | 133 | def write(self, cr, uid, ids, vals, context=None): |
2087 | 131 | context = context or {} | 134 | context = context or {} |
2091 | 132 | if vals.get('type') in ('out_invoice','out_refund') and \ | 135 | if vals.get('type') in ('out_invoice', 'out_refund') and \ |
2092 | 133 | vals.get('date_invoice') and not vals.get('date_document'): | 136 | vals.get('date_invoice') and not vals.get('date_document'): |
2093 | 134 | vals['date_document']=vals['date_invoice'] | 137 | vals['date_document'] = vals['date_invoice'] |
2094 | 135 | return super(account_invoice, self).write(cr, uid, ids, vals, | 138 | return super(account_invoice, self).write(cr, uid, ids, vals, |
2096 | 136 | context=context) | 139 | context=context) |
2097 | 140 | |||
2098 | 137 | 141 | ||
2099 | 138 | class account_invoice_tax(osv.osv): | 142 | class account_invoice_tax(osv.osv): |
2100 | 139 | _inherit = 'account.invoice.tax' | 143 | _inherit = 'account.invoice.tax' |
2101 | 140 | _columns = { | 144 | _columns = { |
2103 | 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', |
2104 | 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."), |
2105 | 143 | } | 147 | } |
2106 | 144 | 148 | ||
2107 | 145 | 149 | ||
2108 | === modified file 'l10n_ve_fiscal_requirements/model/l10n_ut.py' | |||
2109 | --- l10n_ve_fiscal_requirements/model/l10n_ut.py 2014-09-24 04:18:40 +0000 | |||
2110 | +++ l10n_ve_fiscal_requirements/model/l10n_ut.py 2014-10-11 00:06:17 +0000 | |||
2111 | @@ -24,8 +24,6 @@ | |||
2112 | 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/>. |
2113 | 25 | ############################################################################## | 25 | ############################################################################## |
2114 | 26 | from openerp.osv import osv, fields | 26 | from openerp.osv import osv, fields |
2115 | 27 | from openerp.tools import config | ||
2116 | 28 | from openerp.tools.translate import _ | ||
2117 | 29 | import time | 27 | import time |
2118 | 30 | from openerp.addons import decimal_precision as dp | 28 | from openerp.addons import decimal_precision as dp |
2119 | 31 | 29 | ||
2120 | @@ -46,7 +44,7 @@ | |||
2121 | 46 | help="Amount of the tax unit in bs", required=True), | 44 | help="Amount of the tax unit in bs", required=True), |
2122 | 47 | 'user_id': fields.many2one('res.users', 'Salesman', | 45 | 'user_id': fields.many2one('res.users', 'Salesman', |
2123 | 48 | readonly=True, states={'draft': [('readonly', False)]}, | 46 | readonly=True, states={'draft': [('readonly', False)]}, |
2125 | 49 | help="Vendor user"), | 47 | help="Vendor user"), |
2126 | 50 | } | 48 | } |
2127 | 51 | _defaults = { | 49 | _defaults = { |
2128 | 52 | 'name': lambda *a: None, | 50 | 'name': lambda *a: None, |
2129 | 53 | 51 | ||
2130 | === modified file 'l10n_ve_fiscal_requirements/model/partner.py' | |||
2131 | --- l10n_ve_fiscal_requirements/model/partner.py 2014-09-04 19:22:17 +0000 | |||
2132 | +++ l10n_ve_fiscal_requirements/model/partner.py 2014-10-11 00:06:17 +0000 | |||
2133 | @@ -1,12 +1,12 @@ | |||
2134 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
2135 | 2 | ############################################################################## | 2 | ############################################################################## |
2136 | 3 | # | 3 | # |
2138 | 4 | # | 4 | # |
2139 | 5 | # Programmed by: Alexander Olivares <olivaresa@gmail.com> | 5 | # Programmed by: Alexander Olivares <olivaresa@gmail.com> |
2140 | 6 | # | 6 | # |
2142 | 7 | # This the script to connect with Seniat website | 7 | # This the script to connect with Seniat website |
2143 | 8 | # for consult the rif asociated with a partner was taken from: | 8 | # for consult the rif asociated with a partner was taken from: |
2145 | 9 | # | 9 | # |
2146 | 10 | # http://siv.cenditel.gob.ve/svn/sigesic/ramas/sigesic-1.1.x/sigesic/apps/comun/seniat.py | 10 | # http://siv.cenditel.gob.ve/svn/sigesic/ramas/sigesic-1.1.x/sigesic/apps/comun/seniat.py |
2147 | 11 | # | 11 | # |
2148 | 12 | # This script was modify by: | 12 | # This script was modify by: |
2149 | @@ -38,6 +38,7 @@ | |||
2150 | 38 | from openerp.addons import decimal_precision as dp | 38 | from openerp.addons import decimal_precision as dp |
2151 | 39 | import re | 39 | import re |
2152 | 40 | 40 | ||
2153 | 41 | |||
2154 | 41 | class res_partner(osv.osv): | 42 | class res_partner(osv.osv): |
2155 | 42 | _inherit = 'res.partner' | 43 | _inherit = 'res.partner' |
2156 | 43 | 44 | ||
2157 | @@ -47,14 +48,14 @@ | |||
2158 | 47 | context = context or {} | 48 | context = context or {} |
2159 | 48 | user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id | 49 | user_company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id |
2160 | 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 \ |
2162 | 50 | and user_company.partner_id.country_id.code or 'XX' | 51 | and user_company.partner_id.country_id.code or 'XX' |
2163 | 51 | 52 | ||
2164 | 52 | def default_get(self, cr, uid, fields, context=None): | 53 | def default_get(self, cr, uid, fields, context=None): |
2165 | 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. |
2166 | 54 | """ | 55 | """ |
2167 | 55 | context = context or {} | 56 | context = context or {} |
2168 | 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) |
2170 | 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)}) |
2171 | 58 | return res | 59 | return res |
2172 | 59 | 60 | ||
2173 | 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): |
2174 | @@ -62,9 +63,9 @@ | |||
2175 | 62 | of the user company. | 63 | of the user company. |
2176 | 63 | """ | 64 | """ |
2177 | 64 | context = context or {} | 65 | context = context or {} |
2179 | 65 | res= {}.fromkeys(ids,self._get_country_code(cr,uid,context=context)) | 66 | res = {}.fromkeys(ids, self._get_country_code(cr, uid, context=context)) |
2180 | 66 | return res | 67 | return res |
2182 | 67 | 68 | ||
2183 | 68 | _columns = { | 69 | _columns = { |
2184 | 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"), |
2185 | 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"), |
2186 | @@ -72,57 +73,59 @@ | |||
2187 | 72 | string='Rate', | 73 | string='Rate', |
2188 | 73 | digits_compute=dp.get_precision('Withhold'), | 74 | digits_compute=dp.get_precision('Withhold'), |
2189 | 74 | help="Vat Withholding rate"), | 75 | help="Vat Withholding rate"), |
2191 | 75 | 'wh_iva_agent': fields.boolean('Wh. Agent', | 76 | 'wh_iva_agent': fields.boolean('Wh. Agent', |
2192 | 76 | help="Indicate if the partner is a withholding vat agent"), | 77 | help="Indicate if the partner is a withholding vat agent"), |
2193 | 77 | } | 78 | } |
2195 | 78 | 79 | ||
2196 | 79 | _default = { | 80 | _default = { |
2197 | 80 | 'seniat_updated': False, | 81 | 'seniat_updated': False, |
2198 | 81 | } | 82 | } |
2199 | 82 | 83 | ||
2201 | 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): |
2202 | 84 | """ Gets el id of the partner with the vat or the name and return the name | 85 | """ Gets el id of the partner with the vat or the name and return the name |
2203 | 85 | """ | 86 | """ |
2207 | 86 | if context is None: | 87 | if context is None: |
2208 | 87 | context={} | 88 | context = {} |
2209 | 88 | ids= [] | 89 | ids = [] |
2210 | 89 | if len(name) >= 2: | 90 | if len(name) >= 2: |
2212 | 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) |
2213 | 91 | if not ids: | 92 | if not ids: |
2217 | 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) |
2218 | 93 | return self.name_get(cr,uid,ids,context=context) | 94 | return self.name_get(cr, uid, ids, context=context) |
2219 | 94 | 95 | ||
2220 | 95 | ''' | 96 | ''' |
2221 | 96 | Required Invoice Address | 97 | Required Invoice Address |
2222 | 97 | ''' | 98 | ''' |
2224 | 98 | def _check_partner_invoice_addr(self,cr,uid,ids,context={}): | 99 | |
2225 | 100 | def _check_partner_invoice_addr(self, cr, uid, ids, context={}): | ||
2226 | 99 | """ Return true if the partner is a company of Venezuela and if the | 101 | """ Return true if the partner is a company of Venezuela and if the |
2227 | 100 | address is for billing. | 102 | address is for billing. |
2228 | 101 | """ | 103 | """ |
2230 | 102 | partner_obj = self.browse(cr,uid,ids[0]) | 104 | partner_obj = self.browse(cr, uid, ids[0]) |
2231 | 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: |
2238 | 104 | res = partner_obj.type == 'invoice' | 106 | res = partner_obj.type == 'invoice' |
2239 | 105 | if res: | 107 | if res: |
2234 | 106 | return True | ||
2235 | 107 | else: | ||
2236 | 108 | return False | ||
2237 | 109 | else: | ||
2240 | 110 | return True | 108 | return True |
2241 | 109 | else: | ||
2242 | 110 | return False | ||
2243 | 111 | else: | ||
2244 | 112 | return True | ||
2245 | 111 | return True | 113 | return True |
2246 | 112 | 114 | ||
2247 | 113 | def _check_vat_uniqueness(self, cr, uid, ids, context=None): | 115 | def _check_vat_uniqueness(self, cr, uid, ids, context=None): |
2248 | 114 | """ Check that the vat is unique in the level where the partner in the tree | 116 | """ Check that the vat is unique in the level where the partner in the tree |
2249 | 115 | """ | 117 | """ |
2252 | 116 | if context is None: context = {} | 118 | if context is None: |
2253 | 117 | 119 | context = {} | |
2254 | 120 | |||
2255 | 118 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id | 121 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
2256 | 119 | acc_part_brw = self._find_accounting_partner(user_company.partner_id) | 122 | acc_part_brw = self._find_accounting_partner(user_company.partner_id) |
2259 | 120 | 123 | ||
2260 | 121 | #User must be of VE | 124 | # User must be of VE |
2261 | 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': |
2262 | 123 | return True | 126 | return True |
2265 | 124 | 127 | ||
2266 | 125 | for rp_brw in self.browse(cr, uid,ids): | 128 | for rp_brw in self.browse(cr, uid, ids): |
2267 | 126 | acc_part_brw = self._find_accounting_partner(rp_brw) | 129 | acc_part_brw = self._find_accounting_partner(rp_brw) |
2268 | 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': |
2269 | 128 | continue | 131 | continue |
2270 | @@ -131,39 +134,41 @@ | |||
2271 | 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: |
2272 | 132 | return False | 135 | return False |
2273 | 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: |
2276 | 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)]) |
2277 | 135 | if duplicates: return False | 138 | if duplicates: |
2278 | 139 | return False | ||
2279 | 136 | continue | 140 | continue |
2281 | 137 | return True | 141 | return True |
2282 | 138 | 142 | ||
2283 | 139 | def _check_vat_mandatory(self, cr, uid, ids, context=None): | 143 | def _check_vat_mandatory(self, cr, uid, ids, context=None): |
2284 | 140 | """ This method will check the vat mandatoriness in partners | 144 | """ This method will check the vat mandatoriness in partners |
2285 | 141 | for those user logged on with a Venezuelan Company | 145 | for those user logged on with a Venezuelan Company |
2287 | 142 | 146 | ||
2288 | 143 | The method will return True when: | 147 | The method will return True when: |
2289 | 144 | *) The user's company is not from Venezuela | 148 | *) The user's company is not from Venezuela |
2290 | 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] |
2292 | 146 | 150 | ||
2293 | 147 | The method will return False when: | 151 | The method will return False when: |
2294 | 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: |
2295 | 149 | +) partner is_company=True AND parent_id is not NULL | 153 | +) partner is_company=True AND parent_id is not NULL |
2298 | 150 | +) partner with parent_id is NULL | 154 | +) partner with parent_id is NULL |
2299 | 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 |
2300 | 152 | """ | 156 | """ |
2302 | 153 | if context is None: context = {} | 157 | if context is None: |
2303 | 158 | context = {} | ||
2304 | 154 | # Avoiding Egg-Chicken Syndrome | 159 | # Avoiding Egg-Chicken Syndrome |
2305 | 155 | # TODO: Refine this approach this is big exception | 160 | # TODO: Refine this approach this is big exception |
2306 | 156 | # One that can be handle by end user, I hope so!!! | 161 | # One that can be handle by end user, I hope so!!! |
2308 | 157 | if context.get('create_company',False): | 162 | if context.get('create_company', False): |
2309 | 158 | return True | 163 | return True |
2311 | 159 | 164 | ||
2312 | 160 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id | 165 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
2313 | 161 | acc_part_brw = self._find_accounting_partner(user_company.partner_id) | 166 | acc_part_brw = self._find_accounting_partner(user_company.partner_id) |
2315 | 162 | #Check if the user is not from a VE Company | 167 | # Check if the user is not from a VE Company |
2316 | 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': |
2317 | 164 | return True | 169 | return True |
2320 | 165 | 170 | ||
2321 | 166 | for rp_brw in self.browse(cr, uid,ids): | 171 | for rp_brw in self.browse(cr, uid, ids): |
2322 | 167 | acc_part_brw = self._find_accounting_partner(rp_brw) | 172 | acc_part_brw = self._find_accounting_partner(rp_brw) |
2323 | 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': |
2324 | 169 | continue | 174 | continue |
2325 | @@ -176,11 +181,11 @@ | |||
2326 | 176 | def _validate(self, cr, uid, ids, context=None): | 181 | def _validate(self, cr, uid, ids, context=None): |
2327 | 177 | """ Validates the fields | 182 | """ Validates the fields |
2328 | 178 | """ | 183 | """ |
2332 | 179 | 184 | ||
2333 | 180 | #In the original orm.py openerp does not allow using | 185 | # In the original orm.py openerp does not allow using |
2334 | 181 | #context within the constraint because we have to yield | 186 | # context within the constraint because we have to yield |
2335 | 182 | # the same result always, | 187 | # the same result always, |
2337 | 183 | # we have overridden this behaviour | 188 | # we have overridden this behaviour |
2338 | 184 | # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER | 189 | # TO ALLOW PASSING CONTEXT TO THE RESTRICTION IN RES.PARTNER |
2339 | 185 | context = context or {} | 190 | context = context or {} |
2340 | 186 | lng = context.get('lang') | 191 | lng = context.get('lang') |
2341 | @@ -203,7 +208,7 @@ | |||
2342 | 203 | else: | 208 | else: |
2343 | 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) |
2344 | 205 | error_msgs.append( | 210 | error_msgs.append( |
2346 | 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) |
2347 | 207 | ) | 212 | ) |
2348 | 208 | self._invalids.update(fields) | 213 | self._invalids.update(fields) |
2349 | 209 | if error_msgs: | 214 | if error_msgs: |
2350 | @@ -216,34 +221,34 @@ | |||
2351 | 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"), []), |
2352 | 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.'), []), |
2353 | 218 | ] | 223 | ] |
2355 | 219 | 224 | ||
2356 | 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): |
2357 | 221 | """ Checks the syntax of the vat | 226 | """ Checks the syntax of the vat |
2358 | 222 | """ | 227 | """ |
2359 | 223 | if context is None: | 228 | if context is None: |
2361 | 224 | context={} | 229 | context = {} |
2362 | 225 | if not value: | 230 | if not value: |
2364 | 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) |
2365 | 227 | res = self.search(cr, uid, [('vat', 'ilike', value)]) | 232 | res = self.search(cr, uid, [('vat', 'ilike', value)]) |
2366 | 228 | if res: | 233 | if res: |
2375 | 229 | rp = self.browse(cr, uid, res[0],context=context) | 234 | rp = self.browse(cr, uid, res[0], context=context) |
2376 | 230 | return {'warning': { | 235 | return {'warning': { |
2377 | 231 | 'title':_('Vat Error !'), | 236 | 'title': _('Vat Error !'), |
2378 | 232 | 'message':_('The VAT [%s] looks like '%value + | 237 | 'message': _('The VAT [%s] looks like ' % value + |
2379 | 233 | '[%s] which is'%rp.vat.upper()+ | 238 | '[%s] which is' % rp.vat.upper() + |
2380 | 234 | ' already being used by: %s'%rp.name.upper()) | 239 | ' already being used by: %s' % rp.name.upper()) |
2381 | 235 | } | 240 | } |
2382 | 236 | } | 241 | } |
2383 | 237 | else: | 242 | else: |
2385 | 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) |
2386 | 239 | 244 | ||
2388 | 240 | def check_vat_ve(self, vat, context = None): | 245 | def check_vat_ve(self, vat, context=None): |
2389 | 241 | """ Check Venezuelan VAT number, locally called RIF. | 246 | """ Check Venezuelan VAT number, locally called RIF. |
2390 | 242 | RIF: JXXXXXXXXX RIF VENEZOLAN IDENTIFICATION CARD: VXXXXXXXXX FOREIGN IDENTIFICATION CARD: EXXXXXXXXX | 247 | RIF: JXXXXXXXXX RIF VENEZOLAN IDENTIFICATION CARD: VXXXXXXXXX FOREIGN IDENTIFICATION CARD: EXXXXXXXXX |
2391 | 243 | """ | 248 | """ |
2392 | 244 | 249 | ||
2393 | 245 | if context is None: | 250 | if context is None: |
2395 | 246 | context={} | 251 | context = {} |
2396 | 247 | if re.search(r'^[VJEGP][0-9]{9}$', vat): | 252 | if re.search(r'^[VJEGP][0-9]{9}$', vat): |
2397 | 248 | return True | 253 | return True |
2398 | 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): |
2399 | @@ -255,10 +260,10 @@ | |||
2400 | 255 | Validate against VAT Information Exchange System (VIES) | 260 | Validate against VAT Information Exchange System (VIES) |
2401 | 256 | """ | 261 | """ |
2402 | 257 | if country_code.upper() != "VE": | 262 | if country_code.upper() != "VE": |
2404 | 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) |
2405 | 259 | else: | 264 | else: |
2406 | 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) |
2408 | 261 | 266 | ||
2409 | 262 | def update_rif(self, cr, uid, ids, context=None): | 267 | def update_rif(self, cr, uid, ids, context=None): |
2410 | 263 | """ Load the rif and name of the partner from the database seniat | 268 | """ Load the rif and name of the partner from the database seniat |
2411 | 264 | """ | 269 | """ |
2412 | @@ -268,11 +273,12 @@ | |||
2413 | 268 | return su_obj.update_rif(cr, uid, ids, context=context) | 273 | return su_obj.update_rif(cr, uid, ids, context=context) |
2414 | 269 | 274 | ||
2415 | 270 | def button_check_vat(self, cr, uid, ids, context=None): | 275 | def button_check_vat(self, cr, uid, ids, context=None): |
2417 | 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 |
2418 | 272 | SENIAT | 277 | SENIAT |
2419 | 273 | """ | 278 | """ |
2422 | 274 | if context is None: context = {} | 279 | if context is None: |
2423 | 275 | context.update({'update_fiscal_information':True}) | 280 | context = {} |
2424 | 281 | context.update({'update_fiscal_information': True}) | ||
2425 | 276 | super(res_partner, self).check_vat(cr, uid, ids, context=context) | 282 | super(res_partner, self).check_vat(cr, uid, ids, context=context) |
2426 | 277 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id | 283 | user_company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
2427 | 278 | if user_company.vat_check_vies: | 284 | if user_company.vat_check_vies: |
2428 | 279 | 285 | ||
2429 | === modified file 'l10n_ve_fiscal_requirements/model/res_company.py' | |||
2430 | --- l10n_ve_fiscal_requirements/model/res_company.py 2013-04-26 23:55:44 +0000 | |||
2431 | +++ l10n_ve_fiscal_requirements/model/res_company.py 2014-10-11 00:06:17 +0000 | |||
2432 | @@ -26,9 +26,6 @@ | |||
2433 | 26 | ############################################################################## | 26 | ############################################################################## |
2434 | 27 | 27 | ||
2435 | 28 | from openerp.osv import fields, osv | 28 | from openerp.osv import fields, osv |
2436 | 29 | import openerp.tools | ||
2437 | 30 | from openerp.tools.translate import _ | ||
2438 | 31 | from openerp.tools import config | ||
2439 | 32 | 29 | ||
2440 | 33 | 30 | ||
2441 | 34 | class res_company(osv.osv): | 31 | class res_company(osv.osv): |
2442 | @@ -36,8 +33,8 @@ | |||
2443 | 36 | _columns = { | 33 | _columns = { |
2444 | 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"), |
2445 | 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"), |
2448 | 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'), |
2449 | 40 | } | 37 | } |
2450 | 41 | 38 | ||
2451 | 42 | def create(self, cr, uid, vals, context=None): | 39 | def create(self, cr, uid, vals, context=None): |
2452 | 43 | """ To create a new record, | 40 | """ To create a new record, |
2453 | 44 | 41 | ||
2454 | === modified file 'l10n_ve_fiscal_requirements/model/res_users.py' | |||
2455 | --- l10n_ve_fiscal_requirements/model/res_users.py 2013-04-10 17:33:44 +0000 | |||
2456 | +++ l10n_ve_fiscal_requirements/model/res_users.py 2014-10-11 00:06:17 +0000 | |||
2457 | @@ -26,30 +26,29 @@ | |||
2458 | 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/>. |
2459 | 27 | ############################################################################## | 27 | ############################################################################## |
2460 | 28 | 28 | ||
2465 | 29 | from openerp.osv import fields, osv | 29 | from openerp.osv import osv |
2466 | 30 | import openerp.tools | 30 | |
2463 | 31 | from openerp.tools.translate import _ | ||
2464 | 32 | from openerp.tools import config | ||
2467 | 33 | 31 | ||
2468 | 34 | class res_users(osv.osv): | 32 | class res_users(osv.osv): |
2469 | 35 | _inherit = 'res.users' | 33 | _inherit = 'res.users' |
2471 | 36 | 34 | ||
2472 | 37 | def create(self, cr, uid, vals, context=None): | 35 | def create(self, cr, uid, vals, context=None): |
2473 | 38 | """ To create a new record, | 36 | """ To create a new record, |
2475 | 39 | adds a Boolean field to true | 37 | adds a Boolean field to true |
2476 | 40 | indicates that the partner is a company | 38 | indicates that the partner is a company |
2477 | 41 | """ | 39 | """ |
2480 | 42 | if context is None: context = {} | 40 | if context is None: |
2481 | 43 | context.update({'create_company':True}) | 41 | context = {} |
2482 | 42 | context.update({'create_company': True}) | ||
2483 | 44 | return super(res_users, self).create(cr, uid, vals, context=context) | 43 | return super(res_users, self).create(cr, uid, vals, context=context) |
2485 | 45 | 44 | ||
2486 | 46 | def write(self, cr, uid, ids, values, context=None): | 45 | def write(self, cr, uid, ids, values, context=None): |
2487 | 47 | """ To write a new record, | 46 | """ To write a new record, |
2489 | 48 | adds a Boolean field to true | 47 | adds a Boolean field to true |
2490 | 49 | indicates that the partner is a company | 48 | indicates that the partner is a company |
2491 | 50 | """ | 49 | """ |
2492 | 51 | context = context or {} | 50 | context = context or {} |
2494 | 52 | context.update({'create_company':True}) | 51 | context.update({'create_company': True}) |
2495 | 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) |
2496 | 54 | 53 | ||
2497 | 55 | res_users() | 54 | res_users() |
2498 | 56 | 55 | ||
2499 | === modified file 'l10n_ve_fiscal_requirements/model/seniat_url.py' | |||
2500 | --- l10n_ve_fiscal_requirements/model/seniat_url.py 2013-12-17 02:32:33 +0000 | |||
2501 | +++ l10n_ve_fiscal_requirements/model/seniat_url.py 2014-10-11 00:06:17 +0000 | |||
2502 | @@ -23,9 +23,7 @@ | |||
2503 | 23 | ########################################################################## | 23 | ########################################################################## |
2504 | 24 | 24 | ||
2505 | 25 | from openerp.osv import fields, osv | 25 | from openerp.osv import fields, osv |
2506 | 26 | import openerp.tools | ||
2507 | 27 | from openerp.tools.translate import _ | 26 | from openerp.tools.translate import _ |
2508 | 28 | from openerp.tools import config | ||
2509 | 29 | import urllib | 27 | import urllib |
2510 | 30 | from xml.dom.minidom import parseString | 28 | from xml.dom.minidom import parseString |
2511 | 31 | import re | 29 | import re |
2512 | @@ -33,6 +31,7 @@ | |||
2513 | 33 | 31 | ||
2514 | 34 | 32 | ||
2515 | 35 | class seniat_url(osv.osv): | 33 | class seniat_url(osv.osv): |
2516 | 34 | |||
2517 | 36 | """ OpenERP Model : seniat_url | 35 | """ OpenERP Model : seniat_url |
2518 | 37 | """ | 36 | """ |
2519 | 38 | _name = 'seniat.url' | 37 | _name = 'seniat.url' |
2520 | @@ -54,32 +53,32 @@ | |||
2521 | 54 | } | 53 | } |
2522 | 55 | 54 | ||
2523 | 56 | # Update Partner Information | 55 | # Update Partner Information |
2526 | 57 | 56 | ||
2527 | 58 | def _get_valid_digit(self, cr, uid,vat, context=None): | 57 | def _get_valid_digit(self, cr, uid, vat, context=None): |
2528 | 59 | ''' | 58 | ''' |
2529 | 60 | @param vat: string | 59 | @param vat: string |
2530 | 61 | returns validating digit | 60 | returns validating digit |
2531 | 62 | ''' | 61 | ''' |
2532 | 63 | divisor = 11 | 62 | divisor = 11 |
2535 | 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} |
2536 | 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} |
2537 | 66 | valid_digit = None | 65 | valid_digit = None |
2538 | 67 | 66 | ||
2539 | 68 | vat_type = vat_type.get(vat[0].upper()) | 67 | vat_type = vat_type.get(vat[0].upper()) |
2540 | 69 | if vat_type: | 68 | if vat_type: |
2541 | 70 | sum = vat_type * 4 | 69 | sum = vat_type * 4 |
2542 | 71 | for i in range(8): | 70 | for i in range(8): |
2544 | 72 | sum += int(vat[i+1]) * mapper[i+1] | 71 | sum += int(vat[i + 1]) * mapper[i + 1] |
2545 | 73 | 72 | ||
2547 | 74 | valid_digit = divisor - sum%divisor | 73 | valid_digit = divisor - sum % divisor |
2548 | 75 | if valid_digit >= 10: | 74 | if valid_digit >= 10: |
2549 | 76 | valid_digit = 0 | 75 | valid_digit = 0 |
2551 | 77 | return valid_digit | 76 | return valid_digit |
2552 | 78 | 77 | ||
2555 | 79 | def _validate_rif(self, cr, uid,vat, context=None): | 78 | def _validate_rif(self, cr, uid, vat, context=None): |
2556 | 80 | '''validates if the VE VAT NUMBER is right | 79 | '''validates if the VE VAT NUMBER is right |
2557 | 81 | @param vat: string: Vat number to Check | 80 | @param vat: string: Vat number to Check |
2559 | 82 | returns vat when right otherwise returns False | 81 | returns vat when right otherwise returns False |
2560 | 83 | 82 | ||
2561 | 84 | ''' | 83 | ''' |
2562 | 85 | if not vat: | 84 | if not vat: |
2563 | @@ -89,17 +88,17 @@ | |||
2564 | 89 | vat = vat[2:] | 88 | vat = vat[2:] |
2565 | 90 | 89 | ||
2566 | 91 | if re.search(r'^[VJEGP][0-9]{9}$', vat): | 90 | if re.search(r'^[VJEGP][0-9]{9}$', vat): |
2568 | 92 | valid_digit = self._get_valid_digit(cr, uid,vat, | 91 | valid_digit = self._get_valid_digit(cr, uid, vat, |
2569 | 93 | context=context) | 92 | context=context) |
2570 | 94 | if valid_digit is None: | 93 | if valid_digit is None: |
2571 | 95 | return False | 94 | return False |
2573 | 96 | if int(vat[9])==valid_digit: | 95 | if int(vat[9]) == valid_digit: |
2574 | 97 | return vat | 96 | return vat |
2575 | 98 | else: | 97 | else: |
2576 | 99 | self._print_error(_('Vat Error !'), _('Invalid VAT!')) | 98 | self._print_error(_('Vat Error !'), _('Invalid VAT!')) |
2577 | 100 | elif re.search(r'^([VE][0-9]{1,8})$', vat): | 99 | elif re.search(r'^([VE][0-9]{1,8})$', vat): |
2578 | 101 | vat = vat[0] + vat[1:].rjust(8, '0') | 100 | vat = vat[0] + vat[1:].rjust(8, '0') |
2580 | 102 | valid_digit = self._get_valid_digit(cr, uid,vat, | 101 | valid_digit = self._get_valid_digit(cr, uid, vat, |
2581 | 103 | context=context) | 102 | context=context) |
2582 | 104 | vat += str(valid_digit) | 103 | vat += str(valid_digit) |
2583 | 105 | return vat | 104 | return vat |
2584 | @@ -119,7 +118,6 @@ | |||
2585 | 119 | return r | 118 | return r |
2586 | 120 | except: | 119 | except: |
2587 | 121 | self.logger.warning("Url could not be loaded %s" % str_error) | 120 | self.logger.warning("Url could not be loaded %s" % str_error) |
2588 | 122 | pass | ||
2589 | 123 | retries -= 1 | 121 | retries -= 1 |
2590 | 124 | return str_error | 122 | return str_error |
2591 | 125 | 123 | ||
2592 | @@ -169,7 +167,7 @@ | |||
2593 | 169 | else: | 167 | else: |
2594 | 170 | return False | 168 | return False |
2595 | 171 | 169 | ||
2597 | 172 | def _get_rif(self, cr, uid, vat, url1, url2, context=None): | 170 | def _get_rif(self, cr, uid, vat, url1, url2, context=None): |
2598 | 173 | """ Partner information transforms XML to string and returns. | 171 | """ Partner information transforms XML to string and returns. |
2599 | 174 | """ | 172 | """ |
2600 | 175 | if context is None: | 173 | if context is None: |
2601 | @@ -179,7 +177,7 @@ | |||
2602 | 179 | if not self._eval_seniat_data(xml_data, vat, context=context): | 177 | if not self._eval_seniat_data(xml_data, vat, context=context): |
2603 | 180 | dom = parseString(xml_data) | 178 | dom = parseString(xml_data) |
2604 | 181 | return self._parse_dom(cr, uid, dom, vat, url2, context=context) | 179 | return self._parse_dom(cr, uid, dom, vat, url2, context=context) |
2606 | 182 | 180 | ||
2607 | 183 | def check_rif(self, cr, uid, vat, context=None): | 181 | def check_rif(self, cr, uid, vat, context=None): |
2608 | 184 | context = context or {} | 182 | context = context or {} |
2609 | 185 | return self._dom_giver(cr, uid, vat, context=context) | 183 | return self._dom_giver(cr, uid, vat, context=context) |
2610 | @@ -195,13 +193,12 @@ | |||
2611 | 195 | url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0] | 193 | url_obj = self.browse(cr, uid, self.search(cr, uid, []))[0] |
2612 | 196 | url1 = url_obj.name + '%s' | 194 | url1 = url_obj.name + '%s' |
2613 | 197 | url2 = url_obj.url_seniat + '%s' | 195 | url2 = url_obj.url_seniat + '%s' |
2616 | 198 | url3 = url_obj.url_seniat2 + '%s' | 196 | vat = self._validate_rif(cr, uid, vat, context=None) |
2615 | 199 | vat = self._validate_rif(cr, uid,vat,context=None) | ||
2617 | 200 | if vat: | 197 | if vat: |
2618 | 201 | return self._get_rif(cr, uid, vat, url1, url2, context=context) | 198 | return self._get_rif(cr, uid, vat, url1, url2, context=context) |
2619 | 202 | else: | 199 | else: |
2620 | 203 | return False | 200 | return False |
2622 | 204 | 201 | ||
2623 | 205 | def _update_partner(self, cr, uid, id, context=None): | 202 | def _update_partner(self, cr, uid, id, context=None): |
2624 | 206 | """ Indicates that the partner was updated with information provided by seniat | 203 | """ Indicates that the partner was updated with information provided by seniat |
2625 | 207 | """ | 204 | """ |
2626 | @@ -211,7 +208,6 @@ | |||
2627 | 211 | def update_rif(self, cr, uid, ids, context={}): | 208 | def update_rif(self, cr, uid, ids, context={}): |
2628 | 212 | """ Updates the partner info if it have a vat | 209 | """ Updates the partner info if it have a vat |
2629 | 213 | """ | 210 | """ |
2630 | 214 | aux = [] | ||
2631 | 215 | rp_obj = self.pool.get('res.partner') | 211 | rp_obj = self.pool.get('res.partner') |
2632 | 216 | if context.get('exec_wizard'): | 212 | if context.get('exec_wizard'): |
2633 | 217 | res = self._dom_giver(cr, uid, context['vat'], context=context) | 213 | res = self._dom_giver(cr, uid, context['vat'], context=context) |
2634 | 218 | 214 | ||
2635 | === modified file 'l10n_ve_fiscal_requirements/wizard/__init__.py' | |||
2636 | --- l10n_ve_fiscal_requirements/wizard/__init__.py 2014-01-20 13:03:50 +0000 | |||
2637 | +++ l10n_ve_fiscal_requirements/wizard/__init__.py 2014-10-11 00:06:17 +0000 | |||
2638 | @@ -23,11 +23,11 @@ | |||
2639 | 23 | # You should have received a copy of the GNU Affero General Public License | 23 | # You should have received a copy of the GNU Affero General Public License |
2640 | 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/>. |
2641 | 25 | ############################################################################## | 25 | ############################################################################## |
2650 | 26 | import wizard_nro_ctrl | 26 | from . import wizard_nro_ctrl |
2651 | 27 | import wizard_invoice_nro_ctrl | 27 | from . import wizard_invoice_nro_ctrl |
2652 | 28 | import wizard_url_seniat | 28 | from . import wizard_url_seniat |
2653 | 29 | import wizard_update_name | 29 | from . import wizard_update_name |
2654 | 30 | import update_info_partner | 30 | from . import update_info_partner |
2655 | 31 | import account_invoice_refund | 31 | from . import account_invoice_refund |
2656 | 32 | import account_invoice_debit | 32 | from . import account_invoice_debit |
2657 | 33 | import search_info_partner_seniat | 33 | from . import search_info_partner_seniat |
2658 | 34 | 34 | ||
2659 | === modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py' | |||
2660 | --- l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2013-05-10 17:56:25 +0000 | |||
2661 | +++ l10n_ve_fiscal_requirements/wizard/account_invoice_debit.py 2014-10-11 00:06:17 +0000 | |||
2662 | @@ -25,6 +25,7 @@ | |||
2663 | 25 | from openerp.tools.translate import _ | 25 | from openerp.tools.translate import _ |
2664 | 26 | from openerp import netsvc | 26 | from openerp import netsvc |
2665 | 27 | 27 | ||
2666 | 28 | |||
2667 | 28 | class account_invoice_debit(osv.osv_memory): | 29 | class account_invoice_debit(osv.osv_memory): |
2668 | 29 | 30 | ||
2669 | 30 | """Debits Note from Invoice""" | 31 | """Debits Note from Invoice""" |
2670 | @@ -32,11 +33,11 @@ | |||
2671 | 32 | _name = "account.invoice.debit" | 33 | _name = "account.invoice.debit" |
2672 | 33 | _description = "Invoice Debit Note" | 34 | _description = "Invoice Debit Note" |
2673 | 34 | _columns = { | 35 | _columns = { |
2679 | 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!'), |
2680 | 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.'), |
2681 | 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.'), |
2682 | 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'), |
2683 | 39 | 'comment': fields.text('Comment', required=True, help='Additional Information'), | 40 | 'comment': fields.text('Comment', required=True, help='Additional Information'), |
2684 | 40 | } | 41 | } |
2685 | 41 | 42 | ||
2686 | 42 | def _get_journal(self, cr, uid, context=None): | 43 | def _get_journal(self, cr, uid, context=None): |
2687 | @@ -49,11 +50,11 @@ | |||
2688 | 49 | company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id | 50 | company_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.id |
2689 | 50 | company_id = context.get('company_id', company_id) | 51 | company_id = context.get('company_id', company_id) |
2690 | 51 | if context.get('type', False) in ('out_invoice', 'out_refund'): | 52 | if context.get('type', False) in ('out_invoice', 'out_refund'): |
2692 | 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)]) |
2693 | 53 | elif context.get('type', False) in ('in_invoice', 'in_refund'): | 54 | elif context.get('type', False) in ('in_invoice', 'in_refund'): |
2695 | 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)]) |
2696 | 55 | if not journal: | 56 | if not journal: |
2698 | 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")) |
2699 | 57 | return journal[0] | 58 | return journal[0] |
2700 | 58 | 59 | ||
2701 | 59 | _defaults = { | 60 | _defaults = { |
2702 | @@ -63,14 +64,14 @@ | |||
2703 | 63 | } | 64 | } |
2704 | 64 | 65 | ||
2705 | 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): |
2707 | 66 | """ Change fields position in the view | 67 | """ Change fields position in the view |
2708 | 67 | """ | 68 | """ |
2709 | 68 | if context is None: | 69 | if context is None: |
2710 | 69 | context = {} | 70 | context = {} |
2712 | 70 | 71 | ||
2713 | 71 | journal_obj = self.pool.get('account.journal') | 72 | journal_obj = self.pool.get('account.journal') |
2716 | 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) |
2717 | 73 | #Debit note only from customer o purchase invoice | 74 | # Debit note only from customer o purchase invoice |
2718 | 74 | #type = context.get('journal_type', 'sale_refund') | 75 | #type = context.get('journal_type', 'sale_refund') |
2719 | 75 | type = context.get('journal_type', 'sale') | 76 | type = context.get('journal_type', 'sale') |
2720 | 76 | if type in ('sale', 'sale_refund'): | 77 | if type in ('sale', 'sale_refund'): |
2721 | @@ -81,7 +82,7 @@ | |||
2722 | 81 | company_id = context.get('company_id', company_id) | 82 | company_id = context.get('company_id', company_id) |
2723 | 82 | for field in res['fields']: | 83 | for field in res['fields']: |
2724 | 83 | if field == 'journal_id': | 84 | if field == 'journal_id': |
2726 | 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) |
2727 | 85 | res['fields'][field]['selection'] = journal_select | 86 | res['fields'][field]['selection'] = journal_select |
2728 | 86 | return res | 87 | return res |
2729 | 87 | 88 | ||
2730 | @@ -93,7 +94,7 @@ | |||
2731 | 93 | nro_ref = ref | 94 | nro_ref = ref |
2732 | 94 | if inv.type == 'out_invoice': | 95 | if inv.type == 'out_invoice': |
2733 | 95 | nro_ref = inv.number | 96 | nro_ref = inv.number |
2735 | 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 '') |
2736 | 97 | return orig | 98 | return orig |
2737 | 98 | 99 | ||
2738 | 99 | def compute_debit(self, cr, uid, ids, context=None): | 100 | def compute_debit(self, cr, uid, ids, context=None): |
2739 | @@ -103,29 +104,23 @@ | |||
2740 | 103 | @param ids: The account invoice refund’s ID or list of IDs | 104 | @param ids: The account invoice refund’s ID or list of IDs |
2741 | 104 | """ | 105 | """ |
2742 | 105 | inv_obj = self.pool.get('account.invoice') | 106 | inv_obj = self.pool.get('account.invoice') |
2743 | 106 | reconcile_obj = self.pool.get('account.move.reconcile') | ||
2744 | 107 | account_m_line_obj = self.pool.get('account.move.line') | ||
2745 | 108 | mod_obj = self.pool.get('ir.model.data') | 107 | mod_obj = self.pool.get('ir.model.data') |
2746 | 109 | act_obj = self.pool.get('ir.actions.act_window') | 108 | act_obj = self.pool.get('ir.actions.act_window') |
2747 | 110 | wf_service = netsvc.LocalService('workflow') | ||
2748 | 111 | inv_tax_obj = self.pool.get('account.invoice.tax') | ||
2749 | 112 | inv_line_obj = self.pool.get('account.invoice.line') | ||
2750 | 113 | res_users_obj = self.pool.get('res.users') | ||
2751 | 114 | if context is None: | 109 | if context is None: |
2752 | 115 | context = {} | 110 | context = {} |
2753 | 116 | 111 | ||
2755 | 117 | form = self.browse(cr, uid, ids[0], context = context) | 112 | form = self.browse(cr, uid, ids[0], context=context) |
2756 | 118 | created_inv = [] | 113 | created_inv = [] |
2757 | 119 | date = False | 114 | date = False |
2758 | 120 | period = False | 115 | period = False |
2759 | 121 | description = False | 116 | description = False |
2760 | 122 | 117 | ||
2762 | 123 | journal_id = form.journal_id and form.journal_id.id or False | 118 | journal_id = form.journal_id and form.journal_id.id or False |
2763 | 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) |
2764 | 125 | #~ TODOK: no seria mejor ids=context.get(active_id) | 120 | #~ TODOK: no seria mejor ids=context.get(active_id) |
2765 | 126 | 121 | ||
2766 | 127 | company_id = inv.company_id.id | 122 | company_id = inv.company_id.id |
2768 | 128 | context.update({'company_id':company_id}) | 123 | context.update({'company_id': company_id}) |
2769 | 129 | 124 | ||
2770 | 130 | if inv.state in ['draft', 'proforma2', 'cancel']: | 125 | if inv.state in ['draft', 'proforma2', 'cancel']: |
2771 | 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.')) |
2772 | @@ -134,18 +129,18 @@ | |||
2773 | 134 | if inv.type not in ['in_invoice', 'out_invoice']: | 129 | if inv.type not in ['in_invoice', 'out_invoice']: |
2774 | 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.')) |
2775 | 136 | 131 | ||
2777 | 137 | #Check for the form fields | 132 | # Check for the form fields |
2778 | 138 | 133 | ||
2779 | 139 | if form.period: | 134 | if form.period: |
2780 | 140 | period = form.period.id | 135 | period = form.period.id |
2781 | 141 | else: | 136 | else: |
2783 | 142 | #Take period from the current date | 137 | # Take period from the current date |
2784 | 143 | period = self.pool.get('account.period').find(cr, uid, context=context) | 138 | period = self.pool.get('account.period').find(cr, uid, context=context) |
2785 | 144 | period = period and period[0] or False | 139 | period = period and period[0] or False |
2786 | 145 | if not period: | 140 | if not period: |
2790 | 146 | raise osv.except_osv(_('No Pediod Defined'), \ | 141 | raise osv.except_osv(_('No Pediod Defined'), |
2791 | 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')) |
2792 | 148 | self.write(cr, uid, ids, {'period': period }, context=context) | 143 | self.write(cr, uid, ids, {'period': period}, context=context) |
2793 | 149 | 144 | ||
2794 | 150 | if not journal_id: | 145 | if not journal_id: |
2795 | 151 | journal_id = inv.journal_id.id | 146 | journal_id = inv.journal_id.id |
2796 | @@ -153,7 +148,7 @@ | |||
2797 | 153 | if form.date: | 148 | if form.date: |
2798 | 154 | date = form.date | 149 | date = form.date |
2799 | 155 | else: | 150 | else: |
2801 | 156 | #Take current date | 151 | # Take current date |
2802 | 157 | #date = inv.date_invoice | 152 | #date = inv.date_invoice |
2803 | 158 | date = time.strftime('%Y-%m-%d') | 153 | date = time.strftime('%Y-%m-%d') |
2804 | 159 | if form.description: | 154 | if form.description: |
2805 | @@ -161,7 +156,7 @@ | |||
2806 | 161 | else: | 156 | else: |
2807 | 162 | description = inv.name | 157 | description = inv.name |
2808 | 163 | 158 | ||
2810 | 164 | #we get original data of invoice to create a new invoice that is the copy of the original | 159 | # we get original data of invoice to create a new invoice that is the copy of the original |
2811 | 165 | invoice = inv_obj.read(cr, uid, [inv.id], | 160 | invoice = inv_obj.read(cr, uid, [inv.id], |
2812 | 166 | ['name', 'type', 'number', 'supplier_invoice_number', | 161 | ['name', 'type', 'number', 'supplier_invoice_number', |
2813 | 167 | 'comment', 'date_due', 'partner_id', | 162 | 'comment', 'date_due', 'partner_id', |
2814 | @@ -173,7 +168,7 @@ | |||
2815 | 173 | del invoice['id'] | 168 | del invoice['id'] |
2816 | 174 | invoice_lines = [] | 169 | invoice_lines = [] |
2817 | 175 | tax_lines = [] | 170 | tax_lines = [] |
2819 | 176 | #Add origin, parent and comment values | 171 | # Add origin, parent and comment values |
2820 | 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) |
2821 | 178 | invoice.update({ | 173 | invoice.update({ |
2822 | 179 | 'type': inv.type, | 174 | 'type': inv.type, |
2823 | @@ -183,16 +178,16 @@ | |||
2824 | 183 | 'invoice_line': invoice_lines, | 178 | 'invoice_line': invoice_lines, |
2825 | 184 | 'tax_line': tax_lines, | 179 | 'tax_line': tax_lines, |
2826 | 185 | 'period_id': period, | 180 | 'period_id': period, |
2828 | 186 | 'parent_id':inv.id, | 181 | 'parent_id': inv.id, |
2829 | 187 | 'name': description, | 182 | 'name': description, |
2830 | 188 | 'origin': orig, | 183 | 'origin': orig, |
2833 | 189 | 'comment':form.comment, | 184 | 'comment': form.comment, |
2834 | 190 | 'journal_id':journal_id | 185 | 'journal_id': journal_id |
2835 | 191 | }) | 186 | }) |
2837 | 192 | #take the id part of the tuple returned for many2one fields | 187 | # take the id part of the tuple returned for many2one fields |
2838 | 193 | for field in ('partner_id', | 188 | for field in ('partner_id', |
2839 | 194 | 'account_id', 'currency_id', 'payment_term'): | 189 | 'account_id', 'currency_id', 'payment_term'): |
2841 | 195 | invoice[field] = invoice[field] and invoice[field][0] | 190 | invoice[field] = invoice[field] and invoice[field][0] |
2842 | 196 | # create the new invoice | 191 | # create the new invoice |
2843 | 197 | inv_id = inv_obj.create(cr, uid, invoice, {}) | 192 | inv_id = inv_obj.create(cr, uid, invoice, {}) |
2844 | 198 | # we compute due date | 193 | # we compute due date |
2845 | @@ -201,12 +196,12 @@ | |||
2846 | 201 | if 'value' in data and data['value']: | 196 | if 'value' in data and data['value']: |
2847 | 202 | inv_obj.write(cr, uid, [inv_id], data['value']) | 197 | inv_obj.write(cr, uid, [inv_id], data['value']) |
2848 | 203 | created_inv.append(inv_id) | 198 | created_inv.append(inv_id) |
2850 | 204 | #we get the view id | 199 | # we get the view id |
2851 | 205 | if inv.type in ('out_invoice', 'out_refund'): | 200 | if inv.type in ('out_invoice', 'out_refund'): |
2852 | 206 | xml_id = 'action_sale_debit_tree' | 201 | xml_id = 'action_sale_debit_tree' |
2853 | 207 | else: | 202 | else: |
2854 | 208 | xml_id = 'action_purchase_debit_tree' | 203 | xml_id = 'action_purchase_debit_tree' |
2856 | 209 | #we get the model | 204 | # we get the model |
2857 | 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) |
2858 | 211 | id = result and result[1] or False | 206 | id = result and result[1] or False |
2859 | 212 | # we read the act window | 207 | # we read the act window |
2860 | 213 | 208 | ||
2861 | === modified file 'l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py' | |||
2862 | --- l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2014-01-13 19:38:55 +0000 | |||
2863 | +++ l10n_ve_fiscal_requirements/wizard/account_invoice_refund.py 2014-10-11 00:06:17 +0000 | |||
2864 | @@ -25,11 +25,13 @@ | |||
2865 | 25 | from openerp.tools.translate import _ | 25 | from openerp.tools.translate import _ |
2866 | 26 | from openerp import netsvc | 26 | from openerp import netsvc |
2867 | 27 | 27 | ||
2868 | 28 | |||
2869 | 28 | class account_invoice_refund(osv.osv_memory): | 29 | class account_invoice_refund(osv.osv_memory): |
2870 | 30 | |||
2871 | 29 | """Refunds invoice""" | 31 | """Refunds invoice""" |
2872 | 30 | 32 | ||
2873 | 31 | _inherit = 'account.invoice.refund' | 33 | _inherit = 'account.invoice.refund' |
2875 | 32 | 34 | ||
2876 | 33 | def default_get(self, cr, uid, fields, context=None): | 35 | def default_get(self, cr, uid, fields, context=None): |
2877 | 34 | """ Get default values | 36 | """ Get default values |
2878 | 35 | @param fields: List of fields for default value | 37 | @param fields: List of fields for default value |
2879 | @@ -40,12 +42,12 @@ | |||
2880 | 40 | if context.get('active_id'): | 42 | if context.get('active_id'): |
2881 | 41 | code = datetime.datetime.today().strftime('%m/%Y') | 43 | code = datetime.datetime.today().strftime('%m/%Y') |
2882 | 42 | period_obj = self.pool.get('account.period') | 44 | period_obj = self.pool.get('account.period') |
2884 | 43 | period_ids = period_obj.search(cr,uid,[('code','=',code)],context=context) | 45 | period_ids = period_obj.search(cr, uid, [('code', '=', code)], context=context) |
2885 | 44 | period_id = period_ids and period_ids[0] | 46 | period_id = period_ids and period_ids[0] |
2887 | 45 | 47 | ||
2888 | 46 | res.update({'period': period_id}) | 48 | res.update({'period': period_id}) |
2889 | 47 | return res | 49 | return res |
2891 | 48 | 50 | ||
2892 | 49 | def _get_loc_req(self, cr, uid, context=None): | 51 | def _get_loc_req(self, cr, uid, context=None): |
2893 | 50 | """Get if a field is required or not by a Localization | 52 | """Get if a field is required or not by a Localization |
2894 | 51 | @param uid: Integer value of the user | 53 | @param uid: Integer value of the user |
2895 | @@ -56,18 +58,17 @@ | |||
2896 | 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) |
2897 | 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) |
2898 | 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': |
2900 | 59 | res= True | 61 | res = True |
2901 | 60 | return res | 62 | return res |
2904 | 61 | 63 | ||
2903 | 62 | |||
2905 | 63 | _columns = { | 64 | _columns = { |
2908 | 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"), |
2909 | 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'), |
2910 | 66 | } | 67 | } |
2911 | 67 | 68 | ||
2913 | 68 | _defaults ={ | 69 | _defaults = { |
2914 | 69 | 'loc_req': _get_loc_req | 70 | 'loc_req': _get_loc_req |
2916 | 70 | } | 71 | } |
2917 | 71 | 72 | ||
2918 | 72 | def _get_journal(self, cr, uid, context=None): | 73 | def _get_journal(self, cr, uid, context=None): |
2919 | 73 | """ Return journal depending of the invoice type | 74 | """ Return journal depending of the invoice type |
2920 | @@ -86,9 +87,9 @@ | |||
2921 | 86 | """ | 87 | """ |
2922 | 87 | if context is None: | 88 | if context is None: |
2923 | 88 | context = {} | 89 | context = {} |
2925 | 89 | 90 | ||
2926 | 90 | journal_obj = self.pool.get('account.journal') | 91 | journal_obj = self.pool.get('account.journal') |
2928 | 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) |
2929 | 92 | type = context.get('journal_type', 'sale_refund') | 93 | type = context.get('journal_type', 'sale_refund') |
2930 | 93 | if type in ('sale', 'sale_refund'): | 94 | if type in ('sale', 'sale_refund'): |
2931 | 94 | type = 'sale_refund' | 95 | type = 'sale_refund' |
2932 | @@ -106,48 +107,47 @@ | |||
2933 | 106 | nro_ref = ref | 107 | nro_ref = ref |
2934 | 107 | if inv.type == 'out_invoice': | 108 | if inv.type == 'out_invoice': |
2935 | 108 | nro_ref = inv.number | 109 | nro_ref = inv.number |
2937 | 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 '') |
2938 | 110 | return orig | 111 | return orig |
2939 | 111 | 112 | ||
2942 | 112 | 113 | def cn_iva_validate(self, cr, uid, invoice, context=None): | |
2941 | 113 | def cn_iva_validate(self, cr, uid,invoice,context=None): | ||
2943 | 114 | """ Validates if retentions have been changes to move the state confirmed and done | 114 | """ Validates if retentions have been changes to move the state confirmed and done |
2944 | 115 | """ | 115 | """ |
2945 | 116 | if context is None: | 116 | if context is None: |
2951 | 117 | context={} | 117 | context = {} |
2952 | 118 | ret_iva_id=False | 118 | ret_iva_id = False |
2953 | 119 | ret_islr_id=False | 119 | ret_islr_id = False |
2954 | 120 | im_obj=self.pool.get('ir.model') | 120 | im_obj = self.pool.get('ir.model') |
2955 | 121 | res = im_obj.browse(cr,uid,im_obj.search(cr, uid, [('model', '=','account.invoice')], context=context),context=context)[0].field_id | 121 | res = im_obj.browse(cr, uid, im_obj.search(cr, uid, [('model', '=', 'account.invoice')], context=context), context=context)[0].field_id |
2956 | 122 | for i in res: | 122 | for i in res: |
2957 | 123 | if i.name == 'wh_iva_id': | 123 | if i.name == 'wh_iva_id': |
2960 | 124 | if invoice.wh_iva_id: | 124 | if invoice.wh_iva_id: |
2961 | 125 | ret_iva_id = invoice.wh_iva_id.id | 125 | ret_iva_id = invoice.wh_iva_id.id |
2962 | 126 | if i.name == 'islr_wh_doc_id': | 126 | if i.name == 'islr_wh_doc_id': |
2963 | 127 | if invoice.islr_wh_doc_id: | 127 | if invoice.islr_wh_doc_id: |
2968 | 128 | ret_islr_id = invoice.islr_wh_doc_id.id | 128 | ret_islr_id = invoice.islr_wh_doc_id.id |
2969 | 129 | 129 | ||
2970 | 130 | awi_obj=self.pool.get('account.wh.iva') | 130 | awi_obj = self.pool.get('account.wh.iva') |
2971 | 131 | iwd_obj=self.pool.get('islr.wh.doc') | 131 | iwd_obj = self.pool.get('islr.wh.doc') |
2972 | 132 | wf_service = netsvc.LocalService("workflow") | 132 | wf_service = netsvc.LocalService("workflow") |
2974 | 133 | 133 | ||
2975 | 134 | if ret_iva_id: | 134 | if ret_iva_id: |
2977 | 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) |
2978 | 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) |
2979 | 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) |
2981 | 138 | 138 | ||
2982 | 139 | if ret_islr_id: | 139 | if ret_islr_id: |
2984 | 140 | iwd_obj.action_confirm1(cr,uid,[ret_islr_id],context=context) | 140 | iwd_obj.action_confirm1(cr, uid, [ret_islr_id], context=context) |
2985 | 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) |
2987 | 142 | 142 | ||
2988 | 143 | return True | 143 | return True |
2989 | 144 | 144 | ||
2990 | 145 | def compute_refund(self, cr, uid, ids, mode='refund', context=None): | 145 | def compute_refund(self, cr, uid, ids, mode='refund', context=None): |
2992 | 146 | """ | 146 | """ |
2993 | 147 | @param ids: the account invoice refund’s ID or list of IDs | 147 | @param ids: the account invoice refund’s ID or list of IDs |
2994 | 148 | """ | 148 | """ |
2997 | 149 | wzd_brw = self.browse(cr,uid,ids[0],context=context) | 149 | wzd_brw = self.browse(cr, uid, ids[0], context=context) |
2998 | 150 | brw = self.browse(cr,uid,ids[0],context=context) | 150 | brw = self.browse(cr, uid, ids[0], context=context) |
2999 | 151 | inv_obj = self.pool.get('account.invoice') | 151 | inv_obj = self.pool.get('account.invoice') |
3000 | 152 | reconcile_obj = self.pool.get('account.move.reconcile') | 152 | reconcile_obj = self.pool.get('account.move.reconcile') |
3001 | 153 | account_m_line_obj = self.pool.get('account.move.line') | 153 | account_m_line_obj = self.pool.get('account.move.line') |
3002 | @@ -159,7 +159,7 @@ | |||
3003 | 159 | res_users_obj = self.pool.get('res.users') | 159 | res_users_obj = self.pool.get('res.users') |
3004 | 160 | if context is None: | 160 | if context is None: |
3005 | 161 | context = {} | 161 | context = {} |
3007 | 162 | for form in self.read(cr, uid, ids, context=context): | 162 | for form in self.read(cr, uid, ids, context=context): |
3008 | 163 | created_inv = [] | 163 | created_inv = [] |
3009 | 164 | date = False | 164 | date = False |
3010 | 165 | period = False | 165 | period = False |
3011 | @@ -174,65 +174,65 @@ | |||
3012 | 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)) |
3013 | 175 | period = form.get('period') and form.get('period')[0] or False | 175 | period = form.get('period') and form.get('period')[0] or False |
3014 | 176 | if not period: | 176 | if not period: |
3016 | 177 | #Take period from the current date | 177 | # Take period from the current date |
3017 | 178 | period = self.pool.get('account.period').find(cr, uid, context=context) | 178 | period = self.pool.get('account.period').find(cr, uid, context=context) |
3018 | 179 | period = period and period[0] or False | 179 | period = period and period[0] or False |
3019 | 180 | if not period: | 180 | if not period: |
3021 | 181 | raise osv.except_osv(_('No Pediod Defined'), \ | 181 | raise osv.except_osv(_('No Pediod Defined'), |
3022 | 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')) |
3024 | 183 | self.write(cr, uid, ids, {'period': period }, context=context) | 183 | self.write(cr, uid, ids, {'period': period}, context=context) |
3025 | 184 | 184 | ||
3026 | 185 | if not journal_brw: | 185 | if not journal_brw: |
3027 | 186 | journal_id = inv.journal_id.id | 186 | journal_id = inv.journal_id.id |
3028 | 187 | else: | 187 | else: |
3030 | 188 | journal_id=journal_brw[0] | 188 | journal_id = journal_brw[0] |
3031 | 189 | 189 | ||
3032 | 190 | if form['date']: | 190 | if form['date']: |
3033 | 191 | date = form['date'] | 191 | date = form['date'] |
3034 | 192 | if not form['period']: | 192 | if not form['period']: |
3036 | 193 | cr.execute("select name from ir_model_fields \ | 193 | cr.execute("select name from ir_model_fields \ |
3037 | 194 | where model = 'account.period' \ | 194 | where model = 'account.period' \ |
3038 | 195 | and name = 'company_id'") | 195 | and name = 'company_id'") |
3042 | 196 | result_query = cr.fetchone() | 196 | result_query = cr.fetchone() |
3043 | 197 | if result_query: | 197 | if result_query: |
3044 | 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 \ |
3045 | 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,)) |
3048 | 200 | else: | 200 | else: |
3049 | 201 | cr.execute("""SELECT id | 201 | cr.execute("""SELECT id |
3050 | 202 | from account_period where date(%s) | 202 | from account_period where date(%s) |
3051 | 203 | between date_start AND date_stop \ | 203 | between date_start AND date_stop \ |
3052 | 204 | limit 1 """, (date,)) | 204 | limit 1 """, (date,)) |
3056 | 205 | res = cr.fetchone() | 205 | res = cr.fetchone() |
3057 | 206 | if res: | 206 | if res: |
3058 | 207 | period = res[0] | 207 | period = res[0] |
3059 | 208 | else: | 208 | else: |
3061 | 209 | #Take current date | 209 | # Take current date |
3062 | 210 | #date = inv.date_invoice | 210 | #date = inv.date_invoice |
3063 | 211 | date = time.strftime('%Y-%m-%d') | 211 | date = time.strftime('%Y-%m-%d') |
3064 | 212 | if form['description']: | 212 | if form['description']: |
3065 | 213 | description = form['description'] | 213 | description = form['description'] |
3066 | 214 | else: | 214 | else: |
3067 | 215 | description = inv.name | 215 | description = inv.name |
3070 | 216 | 216 | ||
3071 | 217 | if inv.type in ('in_invoice','in_refund'): | 217 | if inv.type in ('in_invoice', 'in_refund'): |
3072 | 218 | if form['nro_ctrl']: | 218 | if form['nro_ctrl']: |
3073 | 219 | nroctrl = form['nro_ctrl'] | 219 | nroctrl = form['nro_ctrl'] |
3074 | 220 | else: | 220 | else: |
3076 | 221 | raise osv.except_osv(_('Control Number !'), \ | 221 | raise osv.except_osv(_('Control Number !'), |
3077 | 222 | _('Missing Control Number on Invoice Refund!')) | 222 | _('Missing Control Number on Invoice Refund!')) |
3078 | 223 | 223 | ||
3079 | 224 | if not period: | 224 | if not period: |
3083 | 225 | raise osv.except_osv(_('Data Insufficient !'), \ | 225 | raise osv.except_osv(_('Data Insufficient !'), |
3084 | 226 | _('No Period found on Invoice!')) | 226 | _('No Period found on Invoice!')) |
3085 | 227 | 227 | ||
3086 | 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) |
3088 | 229 | 229 | ||
3089 | 230 | refund = inv_obj.browse(cr, uid, refund_id[0], context=context) | 230 | refund = inv_obj.browse(cr, uid, refund_id[0], context=context) |
3091 | 231 | #Add parent invoice | 231 | # Add parent invoice |
3092 | 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', \ |
3094 | 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)) |
3095 | 234 | inv_obj.button_compute(cr, uid, refund_id) | 234 | inv_obj.button_compute(cr, uid, refund_id) |
3097 | 235 | 235 | ||
3098 | 236 | created_inv.append(refund_id[0]) | 236 | created_inv.append(refund_id[0]) |
3099 | 237 | if mode in ('cancel', 'modify'): | 237 | if mode in ('cancel', 'modify'): |
3100 | 238 | movelines = inv.move_id.line_id | 238 | movelines = inv.move_id.line_id |
3101 | @@ -242,21 +242,21 @@ | |||
3102 | 242 | to_reconcile_ids[line.account_id.id] = [line.id] | 242 | to_reconcile_ids[line.account_id.id] = [line.id] |
3103 | 243 | if type(line.reconcile_id) != osv.orm.browse_null: | 243 | if type(line.reconcile_id) != osv.orm.browse_null: |
3104 | 244 | reconcile_obj.unlink(cr, uid, line.reconcile_id.id) | 244 | reconcile_obj.unlink(cr, uid, line.reconcile_id.id) |
3106 | 245 | wf_service.trg_validate(uid, 'account.invoice', \ | 245 | wf_service.trg_validate(uid, 'account.invoice', |
3107 | 246 | refund.id, 'invoice_open', cr) | 246 | refund.id, 'invoice_open', cr) |
3109 | 247 | 247 | ||
3110 | 248 | refund = inv_obj.browse(cr, uid, refund_id[0], context=context) | 248 | refund = inv_obj.browse(cr, uid, refund_id[0], context=context) |
3114 | 249 | self.cn_iva_validate(cr,uid,refund,context=context) | 249 | self.cn_iva_validate(cr, uid, refund, context=context) |
3115 | 250 | 250 | ||
3116 | 251 | for tmpline in refund.move_id.line_id: | 251 | for tmpline in refund.move_id.line_id: |
3117 | 252 | if tmpline.account_id.id == inv.account_id.id: | 252 | if tmpline.account_id.id == inv.account_id.id: |
3118 | 253 | to_reconcile_ids[tmpline.account_id.id].append(tmpline.id) | 253 | to_reconcile_ids[tmpline.account_id.id].append(tmpline.id) |
3119 | 254 | for account in to_reconcile_ids: | 254 | for account in to_reconcile_ids: |
3120 | 255 | account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account], | 255 | account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account], |
3121 | 256 | writeoff_period_id=period, | 256 | writeoff_period_id=period, |
3123 | 257 | writeoff_journal_id = inv.journal_id.id, | 257 | writeoff_journal_id=inv.journal_id.id, |
3124 | 258 | writeoff_acc_id=inv.account_id.id | 258 | writeoff_acc_id=inv.account_id.id |
3126 | 259 | ) | 259 | ) |
3127 | 260 | if mode == 'modify': | 260 | if mode == 'modify': |
3128 | 261 | invoice = inv_obj.read(cr, uid, [inv.id], | 261 | invoice = inv_obj.read(cr, uid, [inv.id], |
3129 | 262 | ['name', 'type', 'number', 'supplier_invoice_number', | 262 | ['name', 'type', 'number', 'supplier_invoice_number', |
3130 | @@ -272,7 +272,7 @@ | |||
3131 | 272 | invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines) | 272 | invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines) |
3132 | 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) |
3133 | 274 | tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines) | 274 | tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines) |
3135 | 275 | #Add origin value | 275 | # Add origin value |
3136 | 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) |
3137 | 277 | invoice.update({ | 277 | invoice.update({ |
3138 | 278 | 'type': inv.type, | 278 | 'type': inv.type, |
3139 | @@ -284,26 +284,26 @@ | |||
3140 | 284 | 'period_id': period, | 284 | 'period_id': period, |
3141 | 285 | 'name': description, | 285 | 'name': description, |
3142 | 286 | 'origin': orig, | 286 | 'origin': orig, |
3144 | 287 | 287 | ||
3145 | 288 | }) | 288 | }) |
3147 | 289 | for field in ( 'partner_id', | 289 | for field in ('partner_id', |
3148 | 290 | 'account_id', 'currency_id', 'payment_term', 'journal_id'): | 290 | 'account_id', 'currency_id', 'payment_term', 'journal_id'): |
3150 | 291 | invoice[field] = invoice[field] and invoice[field][0] | 291 | invoice[field] = invoice[field] and invoice[field][0] |
3151 | 292 | inv_id = inv_obj.create(cr, uid, invoice, {}) | 292 | inv_id = inv_obj.create(cr, uid, invoice, {}) |
3152 | 293 | if inv.payment_term.id: | 293 | if inv.payment_term.id: |
3153 | 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) |
3154 | 295 | if 'value' in data and data['value']: | 295 | if 'value' in data and data['value']: |
3155 | 296 | inv_obj.write(cr, uid, [inv_id], data['value']) | 296 | inv_obj.write(cr, uid, [inv_id], data['value']) |
3156 | 297 | created_inv.append(inv_id) | 297 | created_inv.append(inv_id) |
3161 | 298 | 298 | ||
3162 | 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) |
3163 | 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) |
3164 | 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) |
3165 | 302 | if inv.type in ('out_invoice', 'out_refund'): | 302 | if inv.type in ('out_invoice', 'out_refund'): |
3166 | 303 | xml_id = 'action_invoice_tree3' | 303 | xml_id = 'action_invoice_tree3' |
3167 | 304 | #~ if hasattr(inv, 'sale_ids'): | 304 | #~ if hasattr(inv, 'sale_ids'): |
3170 | 305 | #~ for i in inv.sale_ids: | 305 | #~ for i in inv.sale_ids: |
3171 | 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])) |
3172 | 307 | else: | 307 | else: |
3173 | 308 | xml_id = 'action_invoice_tree4' | 308 | xml_id = 'action_invoice_tree4' |
3174 | 309 | result = mod_obj.get_object_reference(cr, uid, 'account', xml_id) | 309 | result = mod_obj.get_object_reference(cr, uid, 'account', xml_id) |
3175 | @@ -312,14 +312,14 @@ | |||
3176 | 312 | invoice_domain = eval(result['domain']) | 312 | invoice_domain = eval(result['domain']) |
3177 | 313 | invoice_domain.append(('id', 'in', created_inv)) | 313 | invoice_domain.append(('id', 'in', created_inv)) |
3178 | 314 | result['domain'] = invoice_domain | 314 | result['domain'] = invoice_domain |
3180 | 315 | 315 | ||
3181 | 316 | if wzd_brw.filter_refund == 'cancel': | 316 | if wzd_brw.filter_refund == 'cancel': |
3182 | 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) |
3185 | 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) |
3186 | 319 | 319 | ||
3187 | 320 | if wzd_brw.filter_refund == 'refund': | 320 | if wzd_brw.filter_refund == 'refund': |
3188 | 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) |
3190 | 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) |
3191 | 323 | return result | 323 | return result |
3192 | 324 | 324 | ||
3193 | 325 | def validate_total_payment_inv(self, cr, uid, ids, context=None): | 325 | def validate_total_payment_inv(self, cr, uid, ids, context=None): |
3194 | @@ -339,7 +339,7 @@ | |||
3195 | 339 | 339 | ||
3196 | 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. |
3197 | 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. |
3199 | 342 | 342 | ||
3200 | 343 | in the meantime this function is DUMMY, | 343 | in the meantime this function is DUMMY, |
3201 | 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. |
3202 | 345 | """ | 345 | """ |
3203 | @@ -359,16 +359,16 @@ | |||
3204 | 359 | mid = [] | 359 | mid = [] |
3205 | 360 | if self.validate_total_payment_inv(cr, uid, invoiceids, context=context): | 360 | if self.validate_total_payment_inv(cr, uid, invoiceids, context=context): |
3206 | 361 | for inv in inv_obj.browse(cr, uid, invoiceids, context=context): | 361 | for inv in inv_obj.browse(cr, uid, invoiceids, context=context): |
3209 | 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]) |
3210 | 363 | for moveline in moveline_obj.browse(cr, uid, movelineids,context=context): | 363 | for moveline in moveline_obj.browse(cr, uid, movelineids, context=context): |
3211 | 364 | if moveline.reconcile_id: | 364 | if moveline.reconcile_id: |
3212 | 365 | rec += [moveline.reconcile_id.id] | 365 | rec += [moveline.reconcile_id.id] |
3213 | 366 | if moveline.reconcile_partial_id: | 366 | if moveline.reconcile_partial_id: |
3214 | 367 | rec += [moveline.reconcile_partial_id.id] | 367 | rec += [moveline.reconcile_partial_id.id] |
3216 | 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) |
3217 | 369 | for mids in moveline_obj.browse(cr, uid, movelines, context=context): | 369 | for mids in moveline_obj.browse(cr, uid, movelines, context=context): |
3220 | 370 | mid +=[mids.move_id.id] | 370 | mid += [mids.move_id.id] |
3221 | 371 | voucherids = voucher_pool.search(cr, uid,[('move_id','in',mid)]) | 371 | voucherids = voucher_pool.search(cr, uid, [('move_id', 'in', mid)]) |
3222 | 372 | if voucherids: | 372 | if voucherids: |
3223 | 373 | voucher_pool.cancel_voucher(cr, uid, voucherids, context=context) | 373 | voucher_pool.cancel_voucher(cr, uid, voucherids, context=context) |
3224 | 374 | else: | 374 | else: |
3225 | @@ -382,17 +382,17 @@ | |||
3226 | 382 | context = {} | 382 | context = {} |
3227 | 383 | inv_obj = self.pool.get('account.invoice') | 383 | inv_obj = self.pool.get('account.invoice') |
3228 | 384 | period_obj = self.pool.get('account.period') | 384 | period_obj = self.pool.get('account.period') |
3233 | 385 | wzr_brw = self.browse(cr,uid,ids,context=context)[0] | 385 | wzr_brw = self.browse(cr, uid, ids, context=context)[0] |
3234 | 386 | date = wzr_brw.date and wzr_brw.date.split('-') | 386 | date = wzr_brw.date and wzr_brw.date.split('-') |
3235 | 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 |
3236 | 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) |
3237 | 389 | if period not in period_ids: | 389 | if period not in period_ids: |
3240 | 390 | raise osv.except_osv(_('Error !'), \ | 390 | raise osv.except_osv(_('Error !'), |
3241 | 391 | _('The date should be chosen to belong to the period')) | 391 | _('The date should be chosen to belong to the period')) |
3242 | 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): |
3246 | 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] |
3247 | 394 | raise osv.except_osv(_('Error !'), \ | 394 | raise osv.except_osv(_('Error !'), |
3248 | 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")) |
3249 | 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) |
3250 | 397 | data_refund = self.browse(cr, uid, ids, context=context)[0].filter_refund | 397 | data_refund = self.browse(cr, uid, ids, context=context)[0].filter_refund |
3251 | 398 | return self.compute_refund(cr, uid, ids, data_refund, context=context) | 398 | return self.compute_refund(cr, uid, ids, data_refund, context=context) |
3252 | 399 | 399 | ||
3253 | === modified file 'l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py' | |||
3254 | --- l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2013-06-03 21:19:56 +0000 | |||
3255 | +++ l10n_ve_fiscal_requirements/wizard/search_info_partner_seniat.py 2014-10-11 00:06:17 +0000 | |||
3256 | @@ -2,7 +2,7 @@ | |||
3257 | 2 | # -*- encoding: utf-8 -*- | 2 | # -*- encoding: utf-8 -*- |
3258 | 3 | ############################################################################## | 3 | ############################################################################## |
3259 | 4 | # | 4 | # |
3261 | 5 | # OpenERP, Open Source Management Solution | 5 | # OpenERP, Open Source Management Solution |
3262 | 6 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 6 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3263 | 7 | # This module is developed by Vauxoo | 7 | # This module is developed by Vauxoo |
3264 | 8 | # This program is free software: you can redistribute it and/or modify | 8 | # This program is free software: you can redistribute it and/or modify |
3265 | @@ -19,46 +19,46 @@ | |||
3266 | 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/>. |
3267 | 20 | # | 20 | # |
3268 | 21 | ############################################################################## | 21 | ############################################################################## |
3269 | 22 | import openerp.pooler | ||
3270 | 23 | from openerp.osv import osv, fields | 22 | from openerp.osv import osv, fields |
3271 | 24 | from openerp.tools.translate import _ | 23 | from openerp.tools.translate import _ |
3272 | 25 | 24 | ||
3273 | 25 | |||
3274 | 26 | class search_info_partner_seniat(osv.osv_memory): | 26 | class search_info_partner_seniat(osv.osv_memory): |
3276 | 27 | 27 | ||
3277 | 28 | _name = "search.info.partner.seniat" | 28 | _name = "search.info.partner.seniat" |
3278 | 29 | _columns = { | 29 | _columns = { |
3284 | 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), |
3285 | 31 | 'name':fields.char('Partner', size=256, help='Partner name'), | 31 | 'name': fields.char('Partner', size=256, help='Partner name'), |
3286 | 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'), |
3287 | 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'), |
3288 | 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'), |
3289 | 35 | } | 35 | } |
3290 | 36 | 36 | ||
3291 | 37 | def search_partner_seniat(self, cr, uid, ids, context=None): | 37 | def search_partner_seniat(self, cr, uid, ids, context=None): |
3292 | 38 | """ Check vat of the partner and update iva rate | 38 | """ Check vat of the partner and update iva rate |
3293 | 39 | """ | 39 | """ |
3294 | 40 | if context is None: | 40 | if context is None: |
3296 | 41 | context={} | 41 | context = {} |
3297 | 42 | this = self.browse(cr, uid, ids)[0] | 42 | this = self.browse(cr, uid, ids)[0] |
3298 | 43 | su_obj = self.pool.get('seniat.url') | 43 | su_obj = self.pool.get('seniat.url') |
3299 | 44 | rp_obj = self.pool.get('res.partner') | 44 | rp_obj = self.pool.get('res.partner') |
3300 | 45 | vat = this.vat.upper() | 45 | vat = this.vat.upper() |
3302 | 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} |
3303 | 47 | 47 | ||
3304 | 48 | if 'VE' in vat: | 48 | if 'VE' in vat: |
3305 | 49 | vat = vat[2:] | 49 | vat = vat[2:] |
3306 | 50 | 50 | ||
3311 | 51 | if rp_obj.check_vat_ve(vat,context=context): | 51 | if rp_obj.check_vat_ve(vat, context=context): |
3312 | 52 | res = su_obj._dom_giver(cr, uid, vat,context) | 52 | res = su_obj._dom_giver(cr, uid, vat, context) |
3313 | 53 | self.write(cr,uid,ids,res) | 53 | self.write(cr, uid, ids, res) |
3314 | 54 | 54 | ||
3315 | 55 | return { | 55 | return { |
3324 | 56 | 'type': 'ir.actions.act_window', | 56 | 'type': 'ir.actions.act_window', |
3325 | 57 | 'res_model': 'search.info.partner.seniat', | 57 | 'res_model': 'search.info.partner.seniat', |
3326 | 58 | 'view_mode': 'form', | 58 | 'view_mode': 'form', |
3327 | 59 | 'view_type': 'form', | 59 | 'view_type': 'form', |
3328 | 60 | 'res_id': this.id, | 60 | 'res_id': this.id, |
3329 | 61 | 'views': [(False, 'form')], | 61 | 'views': [(False, 'form')], |
3330 | 62 | 'target': 'new', | 62 | 'target': 'new', |
3331 | 63 | } | 63 | } |
3332 | 64 | search_info_partner_seniat() | 64 | search_info_partner_seniat() |
3333 | 65 | 65 | ||
3334 | === modified file 'l10n_ve_fiscal_requirements/wizard/update_info_partner.py' | |||
3335 | --- l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2013-04-12 18:26:24 +0000 | |||
3336 | +++ l10n_ve_fiscal_requirements/wizard/update_info_partner.py 2014-10-11 00:06:17 +0000 | |||
3337 | @@ -1,7 +1,7 @@ | |||
3338 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
3339 | 2 | ############################################################################## | 2 | ############################################################################## |
3340 | 3 | # | 3 | # |
3342 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
3343 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3344 | 6 | # author.name@company.com | 6 | # author.name@company.com |
3345 | 7 | # | 7 | # |
3346 | @@ -19,23 +19,21 @@ | |||
3347 | 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/>. |
3348 | 20 | # | 20 | # |
3349 | 21 | ############################################################################## | 21 | ############################################################################## |
3353 | 22 | import openerp.pooler | 22 | from openerp.osv import osv |
3354 | 23 | from openerp.osv import osv, fields | 23 | |
3352 | 24 | from openerp.tools.translate import _ | ||
3355 | 25 | 24 | ||
3356 | 26 | class update_info_partner(osv.osv_memory): | 25 | class update_info_partner(osv.osv_memory): |
3357 | 27 | _name = 'update.info.partner' | 26 | _name = 'update.info.partner' |
3359 | 28 | 27 | ||
3360 | 29 | def update_info(self, cr, uid, ids, context={}): | 28 | def update_info(self, cr, uid, ids, context={}): |
3361 | 30 | """ OpenERP osv memory wizard : update_info_partner | 29 | """ OpenERP osv memory wizard : update_info_partner |
3362 | 31 | """ | 30 | """ |
3363 | 32 | aux=[] | ||
3364 | 33 | seniat_url_obj = self.pool.get('seniat.url') | 31 | seniat_url_obj = self.pool.get('seniat.url') |
3365 | 34 | cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''') | 32 | cr.execute('''SELECT id FROM res_partner WHERE vat ilike 'VE%';''') |
3366 | 35 | record = cr.fetchall() | 33 | record = cr.fetchall() |
3368 | 36 | pids = record and map(lambda x: x[0],record) or [] | 34 | pids = record and map(lambda x: x[0], record) or [] |
3369 | 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) |
3370 | 38 | return{} | 36 | return{} |
3371 | 39 | 37 | ||
3373 | 40 | 38 | ||
3374 | 41 | update_info_partner() | 39 | update_info_partner() |
3375 | 42 | 40 | ||
3376 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py' | |||
3377 | --- l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2013-04-11 20:50:21 +0000 | |||
3378 | +++ l10n_ve_fiscal_requirements/wizard/wizard_invoice_nro_ctrl.py 2014-10-11 00:06:17 +0000 | |||
3379 | @@ -25,67 +25,65 @@ | |||
3380 | 25 | ############################################################################## | 25 | ############################################################################## |
3381 | 26 | 26 | ||
3382 | 27 | from openerp.osv import fields, osv | 27 | from openerp.osv import fields, osv |
3383 | 28 | import openerp.tools | ||
3384 | 29 | from openerp.tools.translate import _ | 28 | from openerp.tools.translate import _ |
3386 | 30 | from openerp.tools import config | 29 | |
3387 | 31 | 30 | ||
3388 | 32 | class wizard_invoice_nro_ctrl(osv.osv_memory): | 31 | class wizard_invoice_nro_ctrl(osv.osv_memory): |
3389 | 33 | 32 | ||
3390 | 34 | _name = "wizard.invoice.nro.ctrl" | 33 | _name = "wizard.invoice.nro.ctrl" |
3391 | 35 | _columns = { | 34 | _columns = { |
3394 | 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."), |
3395 | 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"), |
3396 | 38 | 'sure': fields.boolean('Are You Sure?'), | 37 | 'sure': fields.boolean('Are You Sure?'), |
3397 | 39 | } | 38 | } |
3398 | 40 | 39 | ||
3400 | 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): |
3401 | 42 | """ If the invoice has control number, this function is responsible for passing the bill to damaged paper | 41 | """ If the invoice has control number, this function is responsible for passing the bill to damaged paper |
3403 | 43 | @param wizard_brw: nothing for now | 42 | @param wizard_brw: nothing for now |
3404 | 44 | @param inv_brw: damaged paper | 43 | @param inv_brw: damaged paper |
3405 | 45 | """ | 44 | """ |
3406 | 46 | invoice_line_obj = self.pool.get('account.invoice.line') | 45 | invoice_line_obj = self.pool.get('account.invoice.line') |
3407 | 47 | invoice_obj = self.pool.get('account.invoice') | 46 | invoice_obj = self.pool.get('account.invoice') |
3408 | 48 | acc_mv_obj = self.pool.get('account.move') | 47 | acc_mv_obj = self.pool.get('account.move') |
3409 | 49 | acc_mv_l_obj = self.pool.get('account.move.line') | 48 | acc_mv_l_obj = self.pool.get('account.move.line') |
3413 | 50 | tax_obj=self.pool.get('account.invoice.tax') | 49 | tax_obj = self.pool.get('account.invoice.tax') |
3414 | 51 | invoice={} | 50 | invoice = {} |
3412 | 52 | invoice_line ={} | ||
3415 | 53 | if inv_brw.nro_ctrl: | 51 | if inv_brw.nro_ctrl: |
3416 | 54 | invoice.update({ | 52 | invoice.update({ |
3421 | 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 ''), |
3422 | 56 | 'state':'paid', | 54 | 'state': 'paid', |
3423 | 57 | 'tax_line':[], | 55 | 'tax_line': [], |
3424 | 58 | }) | 56 | }) |
3425 | 59 | else: | 57 | else: |
3426 | 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.")) |
3428 | 61 | invoice_obj.write(cr,uid,[inv_brw.id],invoice,context=context) | 59 | invoice_obj.write(cr, uid, [inv_brw.id], invoice, context=context) |
3429 | 62 | for line in inv_brw.invoice_line: | 60 | for line in inv_brw.invoice_line: |
3436 | 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) |
3437 | 64 | 62 | ||
3438 | 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) |
3439 | 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) |
3440 | 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) |
3441 | 68 | tax_id=tax_obj.create(cr,uid,{'name':'SDCF', | 66 | tax_id = tax_obj.create(cr, uid, {'name': 'SDCF', |
3442 | 69 | 'tax_id': tax_ids and tax_ids[0], | 67 | 'tax_id': tax_ids and tax_ids[0], |
3448 | 70 | 'amount':0.00, | 68 | 'amount': 0.00, |
3449 | 71 | 'tax_amount':0.00, | 69 | 'tax_amount': 0.00, |
3450 | 72 | 'base':0.00, | 70 | 'base': 0.00, |
3451 | 73 | 'account_id':inv_brw.company_id.acc_id.id, | 71 | 'account_id': inv_brw.company_id.acc_id.id, |
3452 | 74 | 'invoice_id':inv_brw and inv_brw.id},{}) | 72 | 'invoice_id': inv_brw and inv_brw.id}, {}) |
3453 | 75 | move_id = inv_brw.move_id and inv_brw.move_id.id | 73 | move_id = inv_brw.move_id and inv_brw.move_id.id |
3455 | 76 | 74 | ||
3456 | 77 | if move_id: | 75 | if move_id: |
3457 | 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) |
3460 | 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) |
3461 | 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]) |
3462 | 81 | return inv_brw.id | 79 | return inv_brw.id |
3463 | 82 | 80 | ||
3465 | 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): |
3466 | 84 | """ Generate new window at view form or tree | 82 | """ Generate new window at view form or tree |
3467 | 85 | """ | 83 | """ |
3468 | 86 | mod_obj = self.pool.get('ir.model.data') | 84 | mod_obj = self.pool.get('ir.model.data') |
3469 | 87 | act_obj = self.pool.get('ir.actions.act_window') | 85 | act_obj = self.pool.get('ir.actions.act_window') |
3471 | 88 | result = mod_obj._get_id(cr, uid, module, xml_id) | 86 | result = mod_obj._get_id(cr, uid, module, xml_id) |
3472 | 89 | id = mod_obj.read(cr, uid, result, ['res_id'])['res_id'] | 87 | id = mod_obj.read(cr, uid, result, ['res_id'])['res_id'] |
3473 | 90 | result = act_obj.read(cr, uid, id) | 88 | result = act_obj.read(cr, uid, id) |
3474 | 91 | result['res_id'] = list_ids | 89 | result['res_id'] = list_ids |
3475 | @@ -94,19 +92,17 @@ | |||
3476 | 94 | def create_invoice(self, cr, uid, ids, context=None): | 92 | def create_invoice(self, cr, uid, ids, context=None): |
3477 | 95 | """ Create a invoice refund | 93 | """ Create a invoice refund |
3478 | 96 | """ | 94 | """ |
3481 | 97 | if context==None: | 95 | if context == None: |
3482 | 98 | context={} | 96 | context = {} |
3483 | 99 | wizard_brw = self.browse(cr, uid, ids, context=None) | 97 | wizard_brw = self.browse(cr, uid, ids, context=None) |
3484 | 100 | wizard_deli_obj = self.pool.get('wz.picking.delivery.note') | ||
3485 | 101 | inv_id = context.get('active_id') | 98 | inv_id = context.get('active_id') |
3486 | 102 | for wizard in wizard_brw: | 99 | for wizard in wizard_brw: |
3487 | 103 | if not wizard.sure: | 100 | if not wizard.sure: |
3488 | 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!")) |
3489 | 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: |
3491 | 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) |
3492 | 107 | else: | 104 | else: |
3493 | 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")) |
3495 | 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') |
3496 | 110 | 107 | ||
3497 | 111 | wizard_invoice_nro_ctrl() | 108 | wizard_invoice_nro_ctrl() |
3498 | 112 | |||
3499 | 113 | 109 | ||
3500 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py' | |||
3501 | --- l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2013-04-11 20:50:21 +0000 | |||
3502 | +++ l10n_ve_fiscal_requirements/wizard/wizard_nro_ctrl.py 2014-10-11 00:06:17 +0000 | |||
3503 | @@ -5,7 +5,7 @@ | |||
3504 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
3505 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
3506 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
3508 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
3509 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
3510 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
3511 | 11 | ############################################################################# | 11 | ############################################################################# |
3512 | @@ -26,6 +26,7 @@ | |||
3513 | 26 | from openerp.osv import osv, fields | 26 | from openerp.osv import osv, fields |
3514 | 27 | from openerp.tools.translate import _ | 27 | from openerp.tools.translate import _ |
3515 | 28 | 28 | ||
3516 | 29 | |||
3517 | 29 | class wiz_nroctrl(osv.osv_memory): | 30 | class wiz_nroctrl(osv.osv_memory): |
3518 | 30 | _name = 'wiz.nroctrl' | 31 | _name = 'wiz.nroctrl' |
3519 | 31 | _description = "Wizard that changes the invoice control number" | 32 | _description = "Wizard that changes the invoice control number" |
3520 | @@ -34,14 +35,12 @@ | |||
3521 | 34 | """ Change control number of the invoice | 35 | """ Change control number of the invoice |
3522 | 35 | """ | 36 | """ |
3523 | 36 | if context is None: | 37 | if context is None: |
3525 | 37 | context={} | 38 | context = {} |
3526 | 38 | data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0] | 39 | data = self.pool.get('wiz.nroctrl').read(cr, uid, ids)[0] |
3527 | 39 | if not data['sure']: | 40 | if not data['sure']: |
3528 | 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")) |
3529 | 41 | inv_obj = self.pool.get('account.invoice') | 42 | inv_obj = self.pool.get('account.invoice') |
3530 | 42 | n_ctrl = data['name'] | 43 | n_ctrl = data['name'] |
3531 | 43 | |||
3532 | 44 | invoice = inv_obj.browse(cr, uid, context['active_id']) | ||
3533 | 45 | 44 | ||
3534 | 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) |
3535 | 47 | return {} | 46 | return {} |
3536 | @@ -54,4 +53,3 @@ | |||
3537 | 54 | 53 | ||
3538 | 55 | 54 | ||
3539 | 56 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 55 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3540 | 57 | |||
3541 | 58 | 56 | ||
3542 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_update_name.py' | |||
3543 | --- l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2013-12-16 18:01:13 +0000 | |||
3544 | +++ l10n_ve_fiscal_requirements/wizard/wizard_update_name.py 2014-10-11 00:06:17 +0000 | |||
3545 | @@ -5,7 +5,7 @@ | |||
3546 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
3547 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
3548 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
3550 | 8 | # Coded by: Yanina Aular <yanina.aular@vauxoo.com> | 8 | # Coded by: Yanina Aular <yanina.aular@vauxoo.com> |
3551 | 9 | # Planified by: Humberto Arocha | 9 | # Planified by: Humberto Arocha |
3552 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
3553 | 11 | ############################################################################# | 11 | ############################################################################# |
3554 | @@ -26,6 +26,7 @@ | |||
3555 | 26 | from openerp.osv import osv, fields | 26 | from openerp.osv import osv, fields |
3556 | 27 | from openerp.tools.translate import _ | 27 | from openerp.tools.translate import _ |
3557 | 28 | 28 | ||
3558 | 29 | |||
3559 | 29 | class wiz_updatename(osv.osv_memory): | 30 | class wiz_updatename(osv.osv_memory): |
3560 | 30 | _name = 'wiz.updatename' | 31 | _name = 'wiz.updatename' |
3561 | 31 | _description = "Wizard that changes the partner name" | 32 | _description = "Wizard that changes the partner name" |
3562 | @@ -36,10 +37,10 @@ | |||
3563 | 36 | data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0] | 37 | data = self.pool.get('wiz.updatename').read(cr, uid, ids)[0] |
3564 | 37 | if not data['sure']: | 38 | if not data['sure']: |
3565 | 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")) |
3567 | 39 | 40 | ||
3568 | 40 | partner_obj = self.pool.get('res.partner') | 41 | partner_obj = self.pool.get('res.partner') |
3569 | 41 | name_partner = data['name'] | 42 | name_partner = data['name'] |
3571 | 42 | 43 | ||
3572 | 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) |
3573 | 44 | return {} | 45 | return {} |
3574 | 45 | 46 | ||
3575 | @@ -55,11 +56,11 @@ | |||
3576 | 55 | context = {} | 56 | context = {} |
3577 | 56 | partner_obj = self.pool.get('res.partner') | 57 | partner_obj = self.pool.get('res.partner') |
3578 | 57 | partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])]) | 58 | partner = partner_obj.search(cr, uid, [('id', '=', context['active_id'])]) |
3580 | 58 | partner_o = partner_obj.browse(cr, uid, partner[0]) | 59 | partner_o = partner_obj.browse(cr, uid, partner[0]) |
3581 | 59 | return partner_o and partner_o.name or False | 60 | return partner_o and partner_o.name or False |
3582 | 60 | 61 | ||
3583 | 61 | _defaults = { | 62 | _defaults = { |
3584 | 62 | 'name': _get_name, | 63 | 'name': _get_name, |
3585 | 63 | } | 64 | } |
3587 | 64 | 65 | ||
3588 | 65 | wiz_updatename() | 66 | wiz_updatename() |
3589 | 66 | 67 | ||
3590 | === modified file 'l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py' | |||
3591 | --- l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2013-04-11 20:50:21 +0000 | |||
3592 | +++ l10n_ve_fiscal_requirements/wizard/wizard_url_seniat.py 2014-10-11 00:06:17 +0000 | |||
3593 | @@ -1,7 +1,7 @@ | |||
3594 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
3595 | 2 | ############################################################################## | 2 | ############################################################################## |
3596 | 3 | # | 3 | # |
3598 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
3599 | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3600 | 6 | # author.name@company.com | 6 | # author.name@company.com |
3601 | 7 | # | 7 | # |
3602 | @@ -20,46 +20,43 @@ | |||
3603 | 20 | # | 20 | # |
3604 | 21 | ############################################################################## | 21 | ############################################################################## |
3605 | 22 | from openerp.osv import fields, osv | 22 | from openerp.osv import fields, osv |
3609 | 23 | import openerp.tools | 23 | |
3607 | 24 | from openerp.tools.translate import _ | ||
3608 | 25 | from openerp.tools import config | ||
3610 | 26 | 24 | ||
3611 | 27 | class wizard_url_seniat(osv.osv_memory): | 25 | class wizard_url_seniat(osv.osv_memory): |
3612 | 28 | 26 | ||
3615 | 29 | 27 | def _get_url(self, cr, uid, ids, context=None): | |
3614 | 30 | def _get_url(self,cr,uid,ids,context=None): | ||
3616 | 31 | """ Get seniat web page | 28 | """ Get seniat web page |
3617 | 32 | """ | 29 | """ |
3623 | 33 | url= self.pool.get('seniat.url') | 30 | url = self.pool.get('seniat.url') |
3624 | 34 | url_ids = url.search(cr, uid,[]) | 31 | url_ids = url.search(cr, uid, []) |
3625 | 35 | if len(url_ids)>1: | 32 | if len(url_ids) > 1: |
3626 | 36 | url.unlink(cr, uid,url_ids[1:]) | 33 | url.unlink(cr, uid, url_ids[1:]) |
3627 | 37 | url_obj=url.browse(cr, uid,url_ids,context=None)[0] | 34 | url_obj = url.browse(cr, uid, url_ids, context=None)[0] |
3628 | 38 | return url_obj | 35 | return url_obj |
3629 | 39 | 36 | ||
3632 | 40 | def _get_url1(self,cr,uid,ids,context=None): | 37 | def _get_url1(self, cr, uid, ids, context=None): |
3633 | 41 | url_obj = self._get_url(cr,uid,ids,context) | 38 | url_obj = self._get_url(cr, uid, ids, context) |
3634 | 42 | return url_obj.name | 39 | return url_obj.name |
3638 | 43 | 40 | ||
3639 | 44 | def _get_url2(self,cr,uid,ids,context=None): | 41 | def _get_url2(self, cr, uid, ids, context=None): |
3640 | 45 | url_obj = self._get_url(cr,uid,ids,context) | 42 | url_obj = self._get_url(cr, uid, ids, context) |
3641 | 46 | return url_obj.url_seniat | 43 | return url_obj.url_seniat |
3645 | 47 | 44 | ||
3646 | 48 | def _get_url3(self,cr,uid,ids,context=None): | 45 | def _get_url3(self, cr, uid, ids, context=None): |
3647 | 49 | url_obj = self._get_url(cr,uid,ids,context) | 46 | url_obj = self._get_url(cr, uid, ids, context) |
3648 | 50 | return url_obj.url_seniat2 | 47 | return url_obj.url_seniat2 |
3654 | 51 | 48 | ||
3655 | 52 | def update_url(self,cr,uid,ids,context=None): | 49 | def update_url(self, cr, uid, ids, context=None): |
3656 | 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] |
3657 | 54 | url_obj = self._get_url(cr,uid,ids,context) | 51 | url_obj = self._get_url(cr, uid, ids, context) |
3658 | 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']}) |
3659 | 56 | return {} | 53 | return {} |
3660 | 57 | 54 | ||
3661 | 58 | _name = "wizard.seniat.url" | 55 | _name = "wizard.seniat.url" |
3662 | 59 | _columns = { | 56 | _columns = { |
3666 | 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'), |
3667 | 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)'), |
3668 | 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)'), |
3669 | 63 | } | 60 | } |
3670 | 64 | _defaults = { | 61 | _defaults = { |
3671 | 65 | 'url1': _get_url1, | 62 | 'url1': _get_url1, |
3672 | @@ -67,4 +64,3 @@ | |||
3673 | 67 | 'url3': _get_url3, | 64 | 'url3': _get_url3, |
3674 | 68 | } | 65 | } |
3675 | 69 | wizard_url_seniat() | 66 | wizard_url_seniat() |
3676 | 70 | |||
3677 | 71 | 67 | ||
3678 | === modified file 'l10n_ve_generic/__init__.py' | |||
3679 | --- l10n_ve_generic/__init__.py 2012-09-23 23:14:44 +0000 | |||
3680 | +++ l10n_ve_generic/__init__.py 2014-10-11 00:06:17 +0000 | |||
3681 | @@ -1,7 +1,7 @@ | |||
3682 | 1 | # -*- encoding: utf-8 -*- | 1 | # -*- encoding: utf-8 -*- |
3683 | 2 | ############################################################################## | 2 | ############################################################################## |
3684 | 3 | # | 3 | # |
3686 | 4 | # OpenERP, Open Source Management Solution | 4 | # OpenERP, Open Source Management Solution |
3687 | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved | 5 | # Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved |
3688 | 6 | # $Id$ | 6 | # $Id$ |
3689 | 7 | # | 7 | # |
3690 | 8 | 8 | ||
3691 | === modified file 'l10n_ve_imex/__init__.py' | |||
3692 | --- l10n_ve_imex/__init__.py 2013-04-26 19:54:06 +0000 | |||
3693 | +++ l10n_ve_imex/__init__.py 2014-10-11 00:06:17 +0000 | |||
3694 | @@ -25,4 +25,4 @@ | |||
3695 | 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/>. |
3696 | 26 | ############################################################################### | 26 | ############################################################################### |
3697 | 27 | 27 | ||
3699 | 28 | import model | 28 | from . import model |
3700 | 29 | 29 | ||
3701 | === modified file 'l10n_ve_imex/model/__init__.py' | |||
3702 | --- l10n_ve_imex/model/__init__.py 2013-04-29 16:31:11 +0000 | |||
3703 | +++ l10n_ve_imex/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
3704 | @@ -25,6 +25,6 @@ | |||
3705 | 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/>. |
3706 | 26 | ############################################################################### | 26 | ############################################################################### |
3707 | 27 | 27 | ||
3711 | 28 | import customs_form_config | 28 | from . import customs_form_config |
3712 | 29 | import customs_form | 29 | from . import customs_form |
3713 | 30 | import invoice | 30 | from . import invoice |
3714 | 31 | 31 | ||
3715 | === modified file 'l10n_ve_imex/model/customs_form.py' | |||
3716 | --- l10n_ve_imex/model/customs_form.py 2014-06-27 21:21:30 +0000 | |||
3717 | +++ l10n_ve_imex/model/customs_form.py 2014-10-11 00:06:17 +0000 | |||
3718 | @@ -26,7 +26,6 @@ | |||
3719 | 26 | ############################################################################### | 26 | ############################################################################### |
3720 | 27 | from openerp.osv import fields, osv | 27 | from openerp.osv import fields, osv |
3721 | 28 | from openerp.tools.translate import _ | 28 | from openerp.tools.translate import _ |
3722 | 29 | import openerp.pooler | ||
3723 | 30 | import openerp.addons.decimal_precision as dp | 29 | import openerp.addons.decimal_precision as dp |
3724 | 31 | import time | 30 | import time |
3725 | 32 | 31 | ||
3726 | @@ -110,8 +109,8 @@ | |||
3727 | 110 | readonly=True, states={'draft': [('readonly', False)]}, | 109 | readonly=True, states={'draft': [('readonly', False)]}, |
3728 | 111 | ondelete='restrict'), | 110 | ondelete='restrict'), |
3729 | 112 | 'cfl_ids': fields.one2many('customs.form.line', 'customs_form_id', | 111 | 'cfl_ids': fields.one2many('customs.form.line', 'customs_form_id', |
3732 | 113 | 'Tax lines', readonly=True, | 112 | 'Tax lines', readonly=True, |
3733 | 114 | states={'draft': [('readonly', False)]}), | 113 | states={'draft': [('readonly', False)]}), |
3734 | 115 | 'amount_total': fields.function(_amount_total, method=True, | 114 | 'amount_total': fields.function(_amount_total, method=True, |
3735 | 116 | type='float', string='Amount total', | 115 | type='float', string='Amount total', |
3736 | 117 | store=False), | 116 | store=False), |
3737 | @@ -329,4 +328,3 @@ | |||
3738 | 329 | ('code_uniq', 'UNIQUE(customs_form_id,tax_code)', | 328 | ('code_uniq', 'UNIQUE(customs_form_id,tax_code)', |
3739 | 330 | 'The code must be unique! (for this form)'), | 329 | 'The code must be unique! (for this form)'), |
3740 | 331 | ] | 330 | ] |
3741 | 332 | |||
3742 | 333 | 331 | ||
3743 | === modified file 'l10n_ve_imex/model/customs_form_config.py' | |||
3744 | --- l10n_ve_imex/model/customs_form_config.py 2013-06-14 13:39:39 +0000 | |||
3745 | +++ l10n_ve_imex/model/customs_form_config.py 2014-10-11 00:06:17 +0000 | |||
3746 | @@ -26,11 +26,10 @@ | |||
3747 | 26 | ############################################################################### | 26 | ############################################################################### |
3748 | 27 | 27 | ||
3749 | 28 | from openerp.osv import fields, osv | 28 | from openerp.osv import fields, osv |
3750 | 29 | from openerp.tools.translate import _ | ||
3751 | 30 | import openerp.pooler | ||
3752 | 31 | 29 | ||
3753 | 32 | 30 | ||
3754 | 33 | class customs_form_config(osv.osv): | 31 | class customs_form_config(osv.osv): |
3755 | 32 | |||
3756 | 34 | ''' | 33 | ''' |
3757 | 35 | Stores common config parameters for form_86 data | 34 | Stores common config parameters for form_86 data |
3758 | 36 | ''' | 35 | ''' |
3759 | @@ -59,6 +58,7 @@ | |||
3760 | 59 | 58 | ||
3761 | 60 | 59 | ||
3762 | 61 | class customs_facility(osv.osv): | 60 | class customs_facility(osv.osv): |
3763 | 61 | |||
3764 | 62 | ''' | 62 | ''' |
3765 | 63 | Stores a list with Venezuela's customs | 63 | Stores a list with Venezuela's customs |
3766 | 64 | ''' | 64 | ''' |
3767 | @@ -82,7 +82,7 @@ | |||
3768 | 82 | cr, user, name, args, operator, context, limit) | 82 | cr, user, name, args, operator, context, limit) |
3769 | 83 | if not res and name: | 83 | if not res and name: |
3770 | 84 | ids = self.search(cr, user, [( | 84 | ids = self.search(cr, user, [( |
3772 | 85 | 'code', '=like', name+"%")]+args, limit=limit) | 85 | 'code', '=like', name + "%")] + args, limit=limit) |
3773 | 86 | if ids: | 86 | if ids: |
3774 | 87 | res = self.name_get(cr, user, ids, context=context) | 87 | res = self.name_get(cr, user, ids, context=context) |
3775 | 88 | return res | 88 | return res |
3776 | @@ -101,6 +101,7 @@ | |||
3777 | 101 | 101 | ||
3778 | 102 | 102 | ||
3779 | 103 | class customs_duty(osv.osv): | 103 | class customs_duty(osv.osv): |
3780 | 104 | |||
3781 | 104 | ''' | 105 | ''' |
3782 | 105 | A list of the concepts for taxes in form_86 | 106 | A list of the concepts for taxes in form_86 |
3783 | 106 | ''' | 107 | ''' |
3784 | @@ -152,4 +153,3 @@ | |||
3785 | 152 | ('sequence_uniq', 'UNIQUE(sequence,company_id)', | 153 | ('sequence_uniq', 'UNIQUE(sequence,company_id)', |
3786 | 153 | 'The sequence must be unique! (for this comany)'), | 154 | 'The sequence must be unique! (for this comany)'), |
3787 | 154 | ] | 155 | ] |
3788 | 155 | |||
3789 | 156 | 156 | ||
3790 | === modified file 'l10n_ve_imex/model/invoice.py' | |||
3791 | --- l10n_ve_imex/model/invoice.py 2014-06-27 21:21:30 +0000 | |||
3792 | +++ l10n_ve_imex/model/invoice.py 2014-10-11 00:06:17 +0000 | |||
3793 | @@ -26,7 +26,6 @@ | |||
3794 | 26 | ############################################################################### | 26 | ############################################################################### |
3795 | 27 | 27 | ||
3796 | 28 | from openerp.osv import osv, fields | 28 | from openerp.osv import osv, fields |
3797 | 29 | import openerp.addons.decimal_precision as dp | ||
3798 | 30 | from openerp.tools.translate import _ | 29 | from openerp.tools.translate import _ |
3799 | 31 | 30 | ||
3800 | 32 | 31 | ||
3801 | @@ -59,13 +58,13 @@ | |||
3802 | 59 | type='many2one', relation='customs.form', | 58 | type='many2one', relation='customs.form', |
3803 | 60 | string='Customs form', | 59 | string='Customs form', |
3804 | 61 | store={ | 60 | store={ |
3806 | 62 | 'account.invoice.tax':(_get_inv_from_ait, ['imex_inv_id'], 50), | 61 | 'account.invoice.tax': (_get_inv_from_ait, ['imex_inv_id'], 50), |
3807 | 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"), |
3808 | 64 | 'imex_tax_line': fields.one2many( | 63 | 'imex_tax_line': fields.one2many( |
3809 | 65 | 'account.invoice.tax', 'imex_inv_id', 'Vat lines', readonly=True, | 64 | 'account.invoice.tax', 'imex_inv_id', 'Vat lines', readonly=True, |
3810 | 66 | attrs="{'readonly':[('vat_detail','=',True)], \ | 65 | attrs="{'readonly':[('vat_detail','=',True)], \ |
3811 | 67 | 'required':[('vat_detail','=',True)]}",), | 66 | 'required':[('vat_detail','=',True)]}",), |
3813 | 68 | 'expedient':fields.boolean('Dossier', | 67 | 'expedient': fields.boolean('Dossier', |
3814 | 69 | help="If it is true, it means this is a \ | 68 | help="If it is true, it means this is a \ |
3815 | 70 | landindg form, you will need to load this \ | 69 | landindg form, you will need to load this \ |
3816 | 71 | format as an purchase invoice to declarate \ | 70 | format as an purchase invoice to declarate \ |
3817 | @@ -77,8 +76,8 @@ | |||
3818 | 77 | res = {} | 76 | res = {} |
3819 | 78 | if customs_form_id: | 77 | if customs_form_id: |
3820 | 79 | imp = self.pool.get('customs.form').browse(cr, uid, | 78 | imp = self.pool.get('customs.form').browse(cr, uid, |
3823 | 80 | customs_form_id, | 79 | customs_form_id, |
3824 | 81 | context=context) | 80 | context=context) |
3825 | 82 | res = {'value': {'num_import_form': imp.name, | 81 | res = {'value': {'num_import_form': imp.name, |
3826 | 83 | 'import_invo': imp.date_liq}} | 82 | 'import_invo': imp.date_liq}} |
3827 | 84 | return res | 83 | return res |
3828 | @@ -94,19 +93,20 @@ | |||
3829 | 94 | % item.customs_form_id.name) | 93 | % item.customs_form_id.name) |
3830 | 95 | return super(account_invoice, self).test_open(cr, uid, ids, args) | 94 | return super(account_invoice, self).test_open(cr, uid, ids, args) |
3831 | 96 | 95 | ||
3832 | 96 | |||
3833 | 97 | class account_invoice_tax(osv.osv): | 97 | class account_invoice_tax(osv.osv): |
3834 | 98 | 98 | ||
3835 | 99 | _inherit = 'account.invoice.tax' | 99 | _inherit = 'account.invoice.tax' |
3836 | 100 | 100 | ||
3837 | 101 | _columns = { | 101 | _columns = { |
3838 | 102 | 'cfl_id': fields.many2one('customs.form.line', | 102 | 'cfl_id': fields.many2one('customs.form.line', |
3841 | 103 | 'Vat line', | 103 | 'Vat line', |
3842 | 104 | ondelete='cascade'), | 104 | ondelete='cascade'), |
3843 | 105 | 'imex_inv_id': fields.many2one('account.invoice', 'Imex Invoice', | 105 | 'imex_inv_id': fields.many2one('account.invoice', 'Imex Invoice', |
3844 | 106 | ondelete='cascade', select=True), | 106 | ondelete='cascade', select=True), |
3845 | 107 | 'partner_id': fields.related('imex_inv_id', 'partner_id', | 107 | 'partner_id': fields.related('imex_inv_id', 'partner_id', |
3846 | 108 | type='many2one', relation='res.partner', | 108 | type='many2one', relation='res.partner', |
3848 | 109 | string='Supplier',store=False, readonly=True), | 109 | string='Supplier', store=False, readonly=True), |
3849 | 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', |
3850 | 111 | string='Invoice ref', size=64, store=False, | 111 | string='Invoice ref', size=64, store=False, |
3851 | 112 | readonly=True), | 112 | readonly=True), |
3852 | @@ -116,27 +116,27 @@ | |||
3853 | 116 | } | 116 | } |
3854 | 117 | 117 | ||
3855 | 118 | #~ _sql_constraints = [ | 118 | #~ _sql_constraints = [ |
3860 | 119 | #~ ('base_gt_zero', 'CHECK (base>0)', | 119 | #~ ('base_gt_zero', 'CHECK (base>0)', |
3861 | 120 | #~ 'The base amount must be > 0!'), | 120 | #~ 'The base amount must be > 0!'), |
3862 | 121 | #~ ('amount_zero', 'CHECK (amount>=0)', | 121 | #~ ('amount_zero', 'CHECK (amount>=0)', |
3863 | 122 | #~ 'The tax amount must be >= 0!'), | 122 | #~ 'The tax amount must be >= 0!'), |
3864 | 123 | #~ ] | 123 | #~ ] |
3865 | 124 | 124 | ||
3866 | 125 | #~ def on_change_cfl_id(self, cr, uid, ids, | 125 | #~ def on_change_cfl_id(self, cr, uid, ids, |
3881 | 126 | #~ cfl_id): | 126 | #~ cfl_id): |
3882 | 127 | #~ ''' | 127 | #~ ''' |
3883 | 128 | #~ Create a domain to filter invoice_id for invoices listed in | 128 | #~ Create a domain to filter invoice_id for invoices listed in |
3884 | 129 | #~ customs_form.invoice_ids only | 129 | #~ customs_form.invoice_ids only |
3885 | 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- |
3886 | 131 | #~ field-in-parentparent-model/ | 131 | #~ field-in-parentparent-model/ |
3887 | 132 | #~ ''' | 132 | #~ ''' |
3888 | 133 | #~ res = {} | 133 | #~ res = {} |
3889 | 134 | #~ if cfl_id: | 134 | #~ if cfl_id: |
3890 | 135 | #~ line_obj = self.pool.get('customs.form.line') | 135 | #~ line_obj = self.pool.get('customs.form.line') |
3891 | 136 | #~ invoices = [i.id for i in line_obj.browse( | 136 | #~ invoices = [i.id for i in line_obj.browse( |
3892 | 137 | #~ cr, uid, cfl_id).customs_form_id.invoice_ids] | 137 | #~ cr, uid, cfl_id).customs_form_id.invoice_ids] |
3893 | 138 | #~ res = {'domain': {'invoice_id': [('id','in',invoices)]}} | 138 | #~ res = {'domain': {'invoice_id': [('id','in',invoices)]}} |
3894 | 139 | #~ return res | 139 | #~ return res |
3895 | 140 | 140 | ||
3896 | 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, |
3897 | 142 | context=None): | 142 | context=None): |
3898 | 143 | 143 | ||
3899 | === modified file 'l10n_ve_sale_purchase/__init__.py' | |||
3900 | --- l10n_ve_sale_purchase/__init__.py 2013-11-18 23:18:43 +0000 | |||
3901 | +++ l10n_ve_sale_purchase/__init__.py 2014-10-11 00:06:17 +0000 | |||
3902 | @@ -5,7 +5,7 @@ | |||
3903 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
3904 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
3905 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
3907 | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> |
3908 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
3909 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
3910 | 11 | ############################################################################# | 11 | ############################################################################# |
3911 | @@ -22,4 +22,4 @@ | |||
3912 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
3913 | 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/>. |
3914 | 24 | ################################################################################ | 24 | ################################################################################ |
3916 | 25 | import model | 25 | from . import model |
3917 | 26 | 26 | ||
3918 | === modified file 'l10n_ve_sale_purchase/__openerp__.py' | |||
3919 | --- l10n_ve_sale_purchase/__openerp__.py 2013-11-18 23:18:43 +0000 | |||
3920 | +++ l10n_ve_sale_purchase/__openerp__.py 2014-10-11 00:06:17 +0000 | |||
3921 | @@ -5,7 +5,7 @@ | |||
3922 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
3923 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
3924 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
3926 | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> |
3927 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
3928 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
3929 | 11 | ############################################################################# | 11 | ############################################################################# |
3930 | 12 | 12 | ||
3931 | === modified file 'l10n_ve_sale_purchase/model/__init__.py' | |||
3932 | --- l10n_ve_sale_purchase/model/__init__.py 2013-11-18 23:18:43 +0000 | |||
3933 | +++ l10n_ve_sale_purchase/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
3934 | @@ -5,7 +5,7 @@ | |||
3935 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
3936 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
3937 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
3939 | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> | 8 | # Coded by: Israel Fermín Montilla <israel@openerp.com.ve> |
3940 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
3941 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
3942 | 11 | ############################################################################# | 11 | ############################################################################# |
3943 | @@ -22,7 +22,7 @@ | |||
3944 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
3945 | 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/>. |
3946 | 24 | ################################################################################ | 24 | ################################################################################ |
3951 | 25 | import stock | 25 | from . import stock |
3952 | 26 | import purchase | 26 | from . import purchase |
3953 | 27 | import sale | 27 | from . import sale |
3954 | 28 | import product | 28 | from . import product |
3955 | 29 | 29 | ||
3956 | === modified file 'l10n_ve_sale_purchase/model/product.py' | |||
3957 | --- l10n_ve_sale_purchase/model/product.py 2013-11-18 23:18:43 +0000 | |||
3958 | +++ l10n_ve_sale_purchase/model/product.py 2014-10-11 00:06:17 +0000 | |||
3959 | @@ -25,35 +25,31 @@ | |||
3960 | 25 | # You should have received a copy of the GNU Affero General Public License | 25 | # You should have received a copy of the GNU Affero General Public License |
3961 | 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/>. |
3962 | 27 | ############################################################################## | 27 | ############################################################################## |
3965 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
3964 | 29 | from openerp.osv import fields | ||
3966 | 30 | from openerp.tools.translate import _ | 29 | from openerp.tools.translate import _ |
3970 | 31 | from openerp.tools import config | 30 | |
3968 | 32 | import time | ||
3969 | 33 | import datetime | ||
3971 | 34 | 31 | ||
3972 | 35 | class product_template(osv.osv): | 32 | class product_template(osv.osv): |
3973 | 36 | 33 | ||
3974 | 37 | _inherit = "product.template" | 34 | _inherit = "product.template" |
3975 | 38 | 35 | ||
3976 | 39 | _columns = { | 36 | _columns = { |
3978 | 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), |
3979 | 41 | } | 38 | } |
3980 | 42 | 39 | ||
3981 | 40 | |||
3982 | 43 | class product_product(osv.osv): | 41 | class product_product(osv.osv): |
3983 | 44 | _inherit = "product.product" | 42 | _inherit = "product.product" |
3985 | 45 | 43 | ||
3986 | 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): |
3987 | 47 | """ Function that adds a default concept for products that are not service | 45 | """ Function that adds a default concept for products that are not service |
3988 | 48 | """ | 46 | """ |
3989 | 49 | domain = {} | ||
3990 | 50 | if prd_type != 'service': | 47 | if prd_type != 'service': |
3991 | 51 | concept_obj = self.pool.get('islr.wh.concept') | 48 | concept_obj = self.pool.get('islr.wh.concept') |
3993 | 52 | concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)],context=context) | 49 | concept_id = concept_obj.search(cr, uid, [('withholdable', '=', False)], context=context) |
3994 | 53 | if concept_id: | 50 | if concept_id: |
3996 | 54 | return {'value' : {'concept_id':concept_id[0]}} | 51 | return {'value': {'concept_id': concept_id[0]}} |
3997 | 55 | else: | 52 | else: |
4002 | 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")) |
4003 | 57 | return {'value' : {'concept_id':False} , | 54 | return {'value': {'concept_id': False}, |
4004 | 58 | 'domain' :{'concept_id':[('withholdable','=',True)]}} , | 55 | 'domain': {'concept_id': [('withholdable', '=', True)]}}, |
4001 | 59 | |||
4005 | 60 | 56 | ||
4006 | === modified file 'l10n_ve_sale_purchase/model/purchase.py' | |||
4007 | --- l10n_ve_sale_purchase/model/purchase.py 2013-11-18 23:18:43 +0000 | |||
4008 | +++ l10n_ve_sale_purchase/model/purchase.py 2014-10-11 00:06:17 +0000 | |||
4009 | @@ -7,7 +7,7 @@ | |||
4010 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4011 | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> |
4012 | 9 | # Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com> | 9 | # Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com> |
4014 | 10 | # Javier Duran <javier@vauxoo.com> | 10 | # Javier Duran <javier@vauxoo.com> |
4015 | 11 | # Planified by: Nhomar Hernandez | 11 | # Planified by: Nhomar Hernandez |
4016 | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve |
4017 | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve |
4018 | @@ -25,43 +25,41 @@ | |||
4019 | 25 | # You should have received a copy of the GNU Affero General Public License | 25 | # You should have received a copy of the GNU Affero General Public License |
4020 | 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/>. |
4021 | 27 | ############################################################################## | 27 | ############################################################################## |
4028 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
4029 | 29 | from openerp.osv import fields | 29 | |
4024 | 30 | from openerp.tools.translate import _ | ||
4025 | 31 | from openerp.tools import config | ||
4026 | 32 | import time | ||
4027 | 33 | import datetime | ||
4030 | 34 | 30 | ||
4031 | 35 | class purchase_order_line(osv.osv): | 31 | class purchase_order_line(osv.osv): |
4034 | 36 | 32 | ||
4035 | 37 | _inherit ="purchase.order.line" | 33 | _inherit = "purchase.order.line" |
4036 | 38 | 34 | ||
4037 | 39 | _columns = { | 35 | _columns = { |
4039 | 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), |
4040 | 41 | } | 37 | } |
4042 | 42 | 38 | ||
4043 | 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): |
4044 | 44 | """ This method loads the withholding concept to a product automatically | 40 | """ This method loads the withholding concept to a product automatically |
4046 | 45 | """ | 41 | """ |
4047 | 46 | def get_concept(): | 42 | def get_concept(): |
4048 | 47 | concept_obj = self.pool.get('islr.wh.concept') | 43 | concept_obj = self.pool.get('islr.wh.concept') |
4050 | 48 | concept_id = concept_obj.search(cr, uid, [('withholdable','=',False)]) | 44 | concept_id = concept_obj.search(cr, uid, [('withholdable', '=', False)]) |
4051 | 49 | return concept_id and concept_id[0] or False | 45 | return concept_id and concept_id[0] or False |
4052 | 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) |
4053 | 51 | if not product: | 47 | if not product: |
4054 | 52 | concept_id = get_concept() | 48 | concept_id = get_concept() |
4055 | 53 | if concept_id: | 49 | if concept_id: |
4057 | 54 | res['value']['concept_id']=concept_id | 50 | res['value']['concept_id'] = concept_id |
4058 | 55 | return res | 51 | return res |
4059 | 56 | prod_brw = self.pool.get('product.product').browse(cr, uid, product) | 52 | prod_brw = self.pool.get('product.product').browse(cr, uid, product) |
4060 | 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() |
4061 | 58 | return res | 54 | return res |
4062 | 55 | |||
4063 | 56 | |||
4064 | 59 | class purchase_order(osv.osv): | 57 | class purchase_order(osv.osv): |
4065 | 60 | _inherit = 'purchase.order' | 58 | _inherit = 'purchase.order' |
4067 | 61 | 59 | ||
4068 | 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): |
4069 | 63 | """ Update concept_id field to the prepare line | 61 | """ Update concept_id field to the prepare line |
4070 | 64 | """ | 62 | """ |
4073 | 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) |
4074 | 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}) |
4075 | 67 | return data | 65 | return data |
4076 | 68 | 66 | ||
4077 | === modified file 'l10n_ve_sale_purchase/model/sale.py' | |||
4078 | --- l10n_ve_sale_purchase/model/sale.py 2013-11-18 23:18:43 +0000 | |||
4079 | +++ l10n_ve_sale_purchase/model/sale.py 2014-10-11 00:06:17 +0000 | |||
4080 | @@ -7,7 +7,7 @@ | |||
4081 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4082 | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> | 8 | # Coded by: Humberto Arocha <humberto@openerp.com.ve> |
4083 | 9 | # Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com> | 9 | # Maria Gabriela Quilarque <gabrielaquilarque97@gmail.com> |
4085 | 10 | # Javier Duran <javier@vauxoo.com> | 10 | # Javier Duran <javier@vauxoo.com> |
4086 | 11 | # Planified by: Nhomar Hernandez | 11 | # Planified by: Nhomar Hernandez |
4087 | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve | 12 | # Finance by: Helados Gilda, C.A. http://heladosgilda.com.ve |
4088 | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve | 13 | # Audited by: Humberto Arocha humberto@openerp.com.ve |
4089 | @@ -25,20 +25,16 @@ | |||
4090 | 25 | # You should have received a copy of the GNU Affero General Public License | 25 | # You should have received a copy of the GNU Affero General Public License |
4091 | 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/>. |
4092 | 27 | ############################################################################## | 27 | ############################################################################## |
4099 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
4100 | 29 | from openerp.osv import fields | 29 | |
4095 | 30 | from openerp.tools.translate import _ | ||
4096 | 31 | from openerp.tools import config | ||
4097 | 32 | import time | ||
4098 | 33 | import datetime | ||
4101 | 34 | 30 | ||
4102 | 35 | class sale_order_line(osv.osv): | 31 | class sale_order_line(osv.osv): |
4103 | 36 | _inherit = "sale.order.line" | 32 | _inherit = "sale.order.line" |
4104 | 37 | 33 | ||
4105 | 38 | _columns = { | 34 | _columns = { |
4107 | 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), |
4108 | 40 | } | 36 | } |
4110 | 41 | 37 | ||
4111 | 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): |
4112 | 43 | # def get_concept(): | 39 | # def get_concept(): |
4113 | 44 | # concept_obj = self.pool.get('islr.wh.concept') | 40 | # concept_obj = self.pool.get('islr.wh.concept') |
4114 | @@ -61,8 +57,8 @@ | |||
4115 | 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) |
4116 | 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) |
4117 | 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) |
4123 | 64 | for line_invoice in invoice_line_brws: #lineas de la factura | 60 | for line_invoice in invoice_line_brws: # lineas de la factura |
4124 | 65 | for line_sale in order_line_sale_brws: #lineas de la orden de venta | 61 | for line_sale in order_line_sale_brws: # lineas de la orden de venta |
4125 | 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 |
4126 | 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}) |
4127 | 68 | return create_ids | 64 | return create_ids |
4128 | 69 | 65 | ||
4129 | === modified file 'l10n_ve_sale_purchase/model/stock.py' | |||
4130 | --- l10n_ve_sale_purchase/model/stock.py 2013-11-18 23:18:43 +0000 | |||
4131 | +++ l10n_ve_sale_purchase/model/stock.py 2014-10-11 00:06:17 +0000 | |||
4132 | @@ -25,25 +25,22 @@ | |||
4133 | 25 | # You should have received a copy of the GNU Affero General Public License | 25 | # You should have received a copy of the GNU Affero General Public License |
4134 | 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/>. |
4135 | 27 | ############################################################################## | 27 | ############################################################################## |
4141 | 28 | from openerp.osv import osv | 28 | from openerp.osv import osv, fields |
4142 | 29 | from openerp.osv import fields | 29 | |
4138 | 30 | from openerp.tools.translate import _ | ||
4139 | 31 | from openerp.tools import config | ||
4140 | 32 | import time | ||
4143 | 33 | 30 | ||
4144 | 34 | class stock_picking(osv.osv): | 31 | class stock_picking(osv.osv): |
4145 | 35 | _inherit = 'stock.picking' | 32 | _inherit = 'stock.picking' |
4148 | 36 | def action_invoice_create(self, cursor, user, ids, journal_id=False,group=False, type='out_invoice', context=None): | 33 | |
4149 | 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): |
4150 | 35 | """ Function that adds the concept of retention to the invoice_lines from | ||
4151 | 38 | a purchase order or sales order with billing method from picking list | 36 | a purchase order or sales order with billing method from picking list |
4152 | 39 | """ | 37 | """ |
4153 | 40 | if context is None: | 38 | if context is None: |
4154 | 41 | context = {} | 39 | context = {} |
4155 | 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) |
4158 | 43 | picking_id=data.keys()[0] | 41 | picking_id = data.keys()[0] |
4159 | 44 | invoice_id=data[picking_id] | 42 | invoice_id = data[picking_id] |
4160 | 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) |
4161 | 46 | picking_brw=self.browse(cursor, user, picking_id) | ||
4162 | 47 | invoice_line_obj = self.pool.get('account.invoice.line') | 44 | invoice_line_obj = self.pool.get('account.invoice.line') |
4163 | 48 | for l in invoice_brw.invoice_line: | 45 | for l in invoice_brw.invoice_line: |
4164 | 49 | invoice_line_obj.write(cursor, user, l.id, {'concept_id': | 46 | invoice_line_obj.write(cursor, user, l.id, {'concept_id': |
4165 | @@ -51,7 +48,5 @@ | |||
4166 | 51 | return data | 48 | return data |
4167 | 52 | 49 | ||
4168 | 53 | _columns = { | 50 | _columns = { |
4170 | 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"), |
4171 | 55 | } | 52 | } |
4172 | 56 | |||
4173 | 57 | |||
4174 | 58 | 53 | ||
4175 | === modified file 'l10n_ve_split_invoice/__init__.py' | |||
4176 | --- l10n_ve_split_invoice/__init__.py 2013-11-18 09:24:59 +0000 | |||
4177 | +++ l10n_ve_split_invoice/__init__.py 2014-10-11 00:06:17 +0000 | |||
4178 | @@ -22,4 +22,4 @@ | |||
4179 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
4180 | 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/>. |
4181 | 24 | ############################################################################## | 24 | ############################################################################## |
4183 | 25 | import model | 25 | from . import model |
4184 | 26 | 26 | ||
4185 | === modified file 'l10n_ve_split_invoice/model/__init__.py' | |||
4186 | --- l10n_ve_split_invoice/model/__init__.py 2013-11-18 09:24:59 +0000 | |||
4187 | +++ l10n_ve_split_invoice/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
4188 | @@ -22,7 +22,7 @@ | |||
4189 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
4190 | 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/>. |
4191 | 24 | ############################################################################## | 24 | ############################################################################## |
4195 | 25 | import installer | 25 | from . import installer |
4196 | 26 | import res_company | 26 | from . import res_company |
4197 | 27 | import invoice | 27 | from . import invoice |
4198 | 28 | 28 | ||
4199 | 29 | 29 | ||
4200 | === modified file 'l10n_ve_split_invoice/model/installer.py' | |||
4201 | --- l10n_ve_split_invoice/model/installer.py 2013-11-18 09:24:59 +0000 | |||
4202 | +++ l10n_ve_split_invoice/model/installer.py 2014-10-11 00:06:17 +0000 | |||
4203 | @@ -5,7 +5,7 @@ | |||
4204 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4205 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4206 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4208 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
4209 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4210 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4211 | 11 | ############################################################################# | 11 | ############################################################################# |
4212 | @@ -22,18 +22,19 @@ | |||
4213 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
4214 | 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/>. |
4215 | 24 | ################################################################################ | 24 | ################################################################################ |
4218 | 25 | from openerp.osv import osv | 25 | from openerp.osv import osv, fields |
4217 | 26 | from openerp.osv import fields | ||
4219 | 27 | from openerp.tools.translate import _ | 26 | from openerp.tools.translate import _ |
4220 | 28 | import base64 | 27 | import base64 |
4221 | 29 | import openerp.addons as addons | 28 | import openerp.addons as addons |
4222 | 30 | 29 | ||
4223 | 30 | |||
4224 | 31 | class split_invoice_config(osv.osv_memory): | 31 | class split_invoice_config(osv.osv_memory): |
4225 | 32 | |||
4226 | 32 | """ Fiscal Requirements installer wizard | 33 | """ Fiscal Requirements installer wizard |
4227 | 33 | """ | 34 | """ |
4228 | 34 | _name = 'split.invoice.config' | 35 | _name = 'split.invoice.config' |
4229 | 35 | _inherit = 'res.config' | 36 | _inherit = 'res.config' |
4231 | 36 | _description= __doc__ | 37 | _description = __doc__ |
4232 | 37 | 38 | ||
4233 | 38 | def default_get(self, cr, uid, fields_list=None, context=None): | 39 | def default_get(self, cr, uid, fields_list=None, context=None): |
4234 | 39 | """ Default value to the config_logo field | 40 | """ Default value to the config_logo field |
4235 | @@ -47,18 +48,18 @@ | |||
4236 | 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. |
4237 | 48 | """ | 49 | """ |
4238 | 49 | wiz_data = self.browse(cr, uid, ids[0]) | 50 | wiz_data = self.browse(cr, uid, ids[0]) |
4241 | 50 | if wiz_data.name < 1 : | 51 | if wiz_data.name < 1: |
4242 | 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')) |
4243 | 52 | company = self.pool.get('res.users').browse(cr, uid, uid).company_id | 53 | company = self.pool.get('res.users').browse(cr, uid, uid).company_id |
4244 | 53 | company_obj = self.pool.get('res.company') | 54 | company_obj = self.pool.get('res.company') |
4246 | 54 | company_id = company_obj.search(cr,uid,[('id','=',company.id)]) | 55 | company_id = company_obj.search(cr, uid, [('id', '=', company.id)]) |
4247 | 55 | data = {'lines_invoice': wiz_data.name} | 56 | data = {'lines_invoice': wiz_data.name} |
4248 | 56 | company_obj.write(cr, uid, company_id, data) | 57 | company_obj.write(cr, uid, company_id, data) |
4249 | 57 | 58 | ||
4250 | 58 | _columns = { | 59 | _columns = { |
4252 | 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'), |
4253 | 60 | } | 61 | } |
4255 | 61 | _defaults={ | 62 | _defaults = { |
4256 | 62 | 'name': 50, | 63 | 'name': 50, |
4257 | 63 | } | 64 | } |
4258 | 64 | split_invoice_config() | 65 | split_invoice_config() |
4259 | 65 | 66 | ||
4260 | === modified file 'l10n_ve_split_invoice/model/invoice.py' | |||
4261 | --- l10n_ve_split_invoice/model/invoice.py 2014-02-19 04:36:23 +0000 | |||
4262 | +++ l10n_ve_split_invoice/model/invoice.py 2014-10-11 00:06:17 +0000 | |||
4263 | @@ -23,10 +23,10 @@ | |||
4264 | 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/>. |
4265 | 24 | ############################################################################## | 24 | ############################################################################## |
4266 | 25 | from openerp.osv import osv | 25 | from openerp.osv import osv |
4267 | 26 | from openerp.osv import fields | ||
4268 | 27 | from openerp.tools.translate import _ | 26 | from openerp.tools.translate import _ |
4269 | 28 | from openerp import netsvc | 27 | from openerp import netsvc |
4270 | 29 | 28 | ||
4271 | 29 | |||
4272 | 30 | class account_invoice(osv.osv): | 30 | class account_invoice(osv.osv): |
4273 | 31 | _inherit = 'account.invoice' | 31 | _inherit = 'account.invoice' |
4274 | 32 | 32 | ||
4275 | @@ -34,13 +34,13 @@ | |||
4276 | 34 | """ Split the invoice when the lines exceed the maximum set for the company | 34 | """ Split the invoice when the lines exceed the maximum set for the company |
4277 | 35 | """ | 35 | """ |
4278 | 36 | for inv in self.browse(cr, uid, ids): | 36 | for inv in self.browse(cr, uid, ids): |
4280 | 37 | inv_id =False | 37 | inv_id = False |
4281 | 38 | if inv.company_id.lines_invoice < 1: | 38 | if inv.company_id.lines_invoice < 1: |
4282 | 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')) |
4285 | 40 | if inv.type in ["out_invoice","out_refund"]: | 40 | if inv.type in ["out_invoice", "out_refund"]: |
4286 | 41 | if len(inv.invoice_line)> inv.company_id.lines_invoice: | 41 | if len(inv.invoice_line) > inv.company_id.lines_invoice: |
4287 | 42 | lst = [] | 42 | lst = [] |
4289 | 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"]) |
4290 | 44 | invoice.update({ | 44 | invoice.update({ |
4291 | 45 | 'state': 'draft', | 45 | 'state': 'draft', |
4292 | 46 | 'number': False, | 46 | 'number': False, |
4293 | @@ -49,16 +49,16 @@ | |||
4294 | 49 | }) | 49 | }) |
4295 | 50 | # take the id part of the tuple returned for many2one fields | 50 | # take the id part of the tuple returned for many2one fields |
4296 | 51 | invoice.pop('id', None) | 51 | invoice.pop('id', None) |
4299 | 52 | for field in ( 'partner_id', | 52 | for field in ('partner_id', |
4300 | 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'): |
4301 | 54 | invoice[field] = invoice[field] and invoice[field][0] | 54 | invoice[field] = invoice[field] and invoice[field][0] |
4303 | 55 | 55 | ||
4304 | 56 | #~ if hasattr(inv,'sale_ids'): | 56 | #~ if hasattr(inv,'sale_ids'): |
4305 | 57 | #~ if self.browse(cr,uid,inv.id,context={}).sale_ids: | 57 | #~ if self.browse(cr,uid,inv.id,context={}).sale_ids: |
4310 | 58 | #~ invoice.update({ | 58 | #~ invoice.update({ |
4311 | 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])] |
4312 | 60 | #~ }) | 60 | #~ }) |
4313 | 61 | 61 | ||
4314 | 62 | inv_id = self.create(cr, uid, invoice) | 62 | inv_id = self.create(cr, uid, invoice) |
4315 | 63 | cont = 0 | 63 | cont = 0 |
4316 | 64 | lst = inv.invoice_line | 64 | lst = inv.invoice_line |
4317 | @@ -66,10 +66,9 @@ | |||
4318 | 66 | lst.pop(0) | 66 | lst.pop(0) |
4319 | 67 | cont += 1 | 67 | cont += 1 |
4320 | 68 | for il in lst: | 68 | for il in lst: |
4322 | 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}) |
4323 | 70 | self.button_compute(cr, uid, [inv.id], set_total=True) | 70 | self.button_compute(cr, uid, [inv.id], set_total=True) |
4324 | 71 | if inv_id: | 71 | if inv_id: |
4325 | 72 | wf_service = netsvc.LocalService("workflow") | ||
4326 | 73 | self.button_compute(cr, uid, [inv_id], set_total=True) | 72 | self.button_compute(cr, uid, [inv_id], set_total=True) |
4327 | 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) |
4328 | 75 | return True | 74 | return True |
4329 | @@ -77,8 +76,8 @@ | |||
4330 | 77 | def action_date_assign(self, cr, uid, ids, *args): | 76 | def action_date_assign(self, cr, uid, ids, *args): |
4331 | 78 | """ Return assigned dat | 77 | """ Return assigned dat |
4332 | 79 | """ | 78 | """ |
4335 | 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) |
4336 | 81 | self.split_invoice(cr,uid,ids) | 80 | self.split_invoice(cr, uid, ids) |
4337 | 82 | return True | 81 | return True |
4338 | 83 | 82 | ||
4339 | 84 | account_invoice() | 83 | account_invoice() |
4340 | 85 | 84 | ||
4341 | === modified file 'l10n_ve_split_invoice/model/res_company.py' | |||
4342 | --- l10n_ve_split_invoice/model/res_company.py 2013-11-18 09:24:59 +0000 | |||
4343 | +++ l10n_ve_split_invoice/model/res_company.py 2014-10-11 00:06:17 +0000 | |||
4344 | @@ -22,19 +22,18 @@ | |||
4345 | 22 | # You should have received a copy of the GNU Affero General Public License | 22 | # You should have received a copy of the GNU Affero General Public License |
4346 | 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/>. |
4347 | 24 | ############################################################################## | 24 | ############################################################################## |
4351 | 25 | from openerp.osv import osv | 25 | from openerp.osv import osv, fields |
4352 | 26 | from openerp.osv import fields | 26 | |
4350 | 27 | from openerp.tools.translate import _ | ||
4353 | 28 | 27 | ||
4354 | 29 | class res_company(osv.osv): | 28 | class res_company(osv.osv): |
4355 | 30 | _inherit = 'res.company' | 29 | _inherit = 'res.company' |
4356 | 31 | 30 | ||
4357 | 32 | _columns = { | 31 | _columns = { |
4359 | 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"), |
4360 | 34 | } | 33 | } |
4361 | 35 | 34 | ||
4362 | 36 | _defaults = { | 35 | _defaults = { |
4365 | 37 | 'lines_invoice':50, | 36 | 'lines_invoice': 50, |
4366 | 38 | } | 37 | } |
4367 | 39 | 38 | ||
4368 | 40 | res_company() | 39 | res_company() |
4369 | 41 | 40 | ||
4370 | === modified file 'l10n_ve_vat_write_off/__init__.py' | |||
4371 | --- l10n_ve_vat_write_off/__init__.py 2013-05-02 17:01:41 +0000 | |||
4372 | +++ l10n_ve_vat_write_off/__init__.py 2014-10-11 00:06:17 +0000 | |||
4373 | @@ -1,1 +1,1 @@ | |||
4375 | 1 | import model | 1 | from . import model |
4376 | 2 | 2 | ||
4377 | === modified file 'l10n_ve_vat_write_off/__openerp__.py' | |||
4378 | --- l10n_ve_vat_write_off/__openerp__.py 2014-02-18 21:58:17 +0000 | |||
4379 | +++ l10n_ve_vat_write_off/__openerp__.py 2014-10-11 00:06:17 +0000 | |||
4380 | @@ -1,4 +1,4 @@ | |||
4382 | 1 | { | 1 | { |
4383 | 2 | "name" : "VAT Write Off", | 2 | "name" : "VAT Write Off", |
4384 | 3 | "version" : "0.5", | 3 | "version" : "0.5", |
4385 | 4 | "depends" : ["l10n_ve_fiscal_book", | 4 | "depends" : ["l10n_ve_fiscal_book", |
4386 | 5 | 5 | ||
4387 | === modified file 'l10n_ve_vat_write_off/model/__init__.py' | |||
4388 | --- l10n_ve_vat_write_off/model/__init__.py 2013-03-13 21:07:18 +0000 | |||
4389 | +++ l10n_ve_vat_write_off/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
4390 | @@ -1,1 +1,1 @@ | |||
4392 | 1 | import l10n_ve_vat_write_off | 1 | from . import l10n_ve_vat_write_off |
4393 | 2 | 2 | ||
4394 | === modified file 'l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py' | |||
4395 | --- l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py 2013-05-06 18:55:10 +0000 | |||
4396 | +++ l10n_ve_vat_write_off/model/l10n_ve_vat_write_off.py 2014-10-11 00:06:17 +0000 | |||
4397 | @@ -1,156 +1,156 @@ | |||
4398 | 1 | from openerp.osv import fields, osv | 1 | from openerp.osv import fields, osv |
4400 | 2 | from datetime import datetime, timedelta | 2 | |
4401 | 3 | 3 | ||
4402 | 4 | class vat_write_off(osv.osv): | 4 | class vat_write_off(osv.osv): |
4403 | 5 | _description = '' | 5 | _description = '' |
4404 | 6 | _name = 'vat.write.off' | 6 | _name = 'vat.write.off' |
4405 | 7 | _columns = { | 7 | _columns = { |
4412 | 8 | 'company_id':fields.many2one('res.company','Company', | 8 | 'company_id': fields.many2one('res.company', 'Company', |
4413 | 9 | help='Company',required=True), | 9 | help='Company', required=True), |
4414 | 10 | 'period_id':fields.many2one('account.period','Period', | 10 | 'period_id': fields.many2one('account.period', 'Period', |
4415 | 11 | help="Book's Fiscal Period",required=True), | 11 | help="Book's Fiscal Period", required=True), |
4416 | 12 | 'state': fields.selection([('draft','Getting Ready'), | 12 | 'state': fields.selection([('draft', 'Getting Ready'), |
4417 | 13 | ('open','Approved by Manager'),('done','Seniat Submitted')], | 13 | ('open', 'Approved by Manager'), ('done', 'Seniat Submitted')], |
4418 | 14 | string='Status', required=True), | 14 | string='Status', required=True), |
4420 | 15 | 'purchase_fb_id':fields.many2one('fiscal.book', 'Purchase Fiscal Book', | 15 | 'purchase_fb_id': fields.many2one('fiscal.book', 'Purchase Fiscal Book', |
4421 | 16 | help='Purchase Fiscal Book'), | 16 | help='Purchase Fiscal Book'), |
4429 | 17 | 'p_do_general_vat_base_sum' : fields.related('purchase_fb_id', | 17 | 'p_do_general_vat_base_sum': fields.related('purchase_fb_id', |
4430 | 18 | 'do_general_vat_base_sum', | 18 | 'do_general_vat_base_sum', |
4424 | 19 | type="float", | ||
4425 | 20 | readonly=True, | ||
4426 | 21 | store=True,), | ||
4427 | 22 | 'p_do_general_vat_tax_sum' : fields.related('purchase_fb_id', | ||
4428 | 23 | 'do_general_vat_tax_sum', | ||
4431 | 24 | type="float", | 19 | type="float", |
4432 | 25 | readonly=True, | 20 | readonly=True, |
4433 | 26 | store=True,), | 21 | store=True,), |
4446 | 27 | 'p_do_additional_vat_base_sum' : fields.related('purchase_fb_id', | 22 | 'p_do_general_vat_tax_sum': fields.related('purchase_fb_id', |
4447 | 28 | 'do_additional_vat_base_sum', | 23 | 'do_general_vat_tax_sum', |
4448 | 29 | type="float", | 24 | type="float", |
4449 | 30 | readonly=True, | 25 | readonly=True, |
4450 | 31 | store=True,), | 26 | store=True,), |
4451 | 32 | 'p_do_additional_vat_tax_sum' : fields.related('purchase_fb_id', | 27 | 'p_do_additional_vat_base_sum': fields.related('purchase_fb_id', |
4452 | 33 | 'do_additional_vat_tax_sum', | 28 | 'do_additional_vat_base_sum', |
4453 | 34 | type="float", | 29 | type="float", |
4454 | 35 | readonly=True, | 30 | readonly=True, |
4455 | 36 | store=True,), | 31 | store=True,), |
4456 | 37 | 'p_do_reduced_vat_base_sum' : fields.related('purchase_fb_id', | 32 | 'p_do_additional_vat_tax_sum': fields.related('purchase_fb_id', |
4457 | 38 | 'do_reduced_vat_base_sum', | 33 | 'do_additional_vat_tax_sum', |
4458 | 39 | type="float", | 34 | type="float", |
4459 | 40 | readonly=True, | 35 | readonly=True, |
4460 | 41 | store=True,), | 36 | store=True,), |
4463 | 42 | 'p_do_reduced_vat_tax_sum' : fields.related('purchase_fb_id', | 37 | 'p_do_reduced_vat_base_sum': fields.related('purchase_fb_id', |
4464 | 43 | 'do_reduced_vat_tax_sum', | 38 | 'do_reduced_vat_base_sum', |
4465 | 44 | type="float", | 39 | type="float", |
4466 | 45 | readonly=True, | 40 | readonly=True, |
4467 | 46 | store=True,), | 41 | store=True,), |
4469 | 47 | 'p_tax_amount' : fields.related('purchase_fb_id', | 42 | 'p_do_reduced_vat_tax_sum': fields.related('purchase_fb_id', |
4470 | 43 | 'do_reduced_vat_tax_sum', | ||
4471 | 44 | type="float", | ||
4472 | 45 | readonly=True, | ||
4473 | 46 | store=True,), | ||
4474 | 47 | 'p_tax_amount': fields.related('purchase_fb_id', | ||
4475 | 48 | 'tax_amount', | 48 | 'tax_amount', |
4476 | 49 | type="float", | 49 | type="float", |
4477 | 50 | readonly=True, | 50 | readonly=True, |
4478 | 51 | store=True,), | 51 | store=True,), |
4480 | 52 | 'sale_fb_id':fields.many2one('fiscal.book', 'Sale Fiscal Book', | 52 | 'sale_fb_id': fields.many2one('fiscal.book', 'Sale Fiscal Book', |
4481 | 53 | help='Sale Fiscal Book'), | 53 | help='Sale Fiscal Book'), |
4483 | 54 | 's_do_sdcf_and_exempt_sum' : fields.related('sale_fb_id', | 54 | 's_do_sdcf_and_exempt_sum': fields.related('sale_fb_id', |
4484 | 55 | 'do_sdcf_and_exempt_sum', | 55 | 'do_sdcf_and_exempt_sum', |
4485 | 56 | type="float", | 56 | type="float", |
4486 | 57 | readonly=True, | 57 | readonly=True, |
4487 | 58 | store=True,), | 58 | store=True,), |
4494 | 59 | 's_imex_vat_base_sum' : fields.related('sale_fb_id', | 59 | 's_imex_vat_base_sum': fields.related('sale_fb_id', |
4495 | 60 | 'imex_vat_base_sum', | 60 | 'imex_vat_base_sum', |
4496 | 61 | type="float", | 61 | type="float", |
4497 | 62 | readonly=True, | 62 | readonly=True, |
4498 | 63 | store=True,), | 63 | store=True,), |
4499 | 64 | 's_get_vat_sdcf_sum' : fields.related('sale_fb_id', | 64 | 's_get_vat_sdcf_sum': fields.related('sale_fb_id', |
4500 | 65 | 'get_vat_sdcf_sum', | 65 | 'get_vat_sdcf_sum', |
4501 | 66 | type="float", | 66 | type="float", |
4502 | 67 | readonly=True, | 67 | readonly=True, |
4503 | 68 | store=True,), | 68 | store=True,), |
4505 | 69 | 's_imex_general_vat_base_sum' : fields.related('sale_fb_id', | 69 | 's_imex_general_vat_base_sum': fields.related('sale_fb_id', |
4506 | 70 | 'imex_general_vat_base_sum', | 70 | 'imex_general_vat_base_sum', |
4507 | 71 | type="float", | 71 | type="float", |
4508 | 72 | readonly=True, | 72 | readonly=True, |
4509 | 73 | store=True,), | 73 | store=True,), |
4511 | 74 | 's_imex_general_vat_tax_sum' : fields.related('sale_fb_id', | 74 | 's_imex_general_vat_tax_sum': fields.related('sale_fb_id', |
4512 | 75 | 'imex_general_vat_tax_sum', | 75 | 'imex_general_vat_tax_sum', |
4513 | 76 | type="float", | 76 | type="float", |
4514 | 77 | readonly=True, | 77 | readonly=True, |
4515 | 78 | store=True), | 78 | store=True), |
4553 | 79 | 's_imex_additional_vat_base_sum' : fields.related('sale_fb_id', | 79 | 's_imex_additional_vat_base_sum': fields.related('sale_fb_id', |
4554 | 80 | 'imex_additional_vat_base_sum', | 80 | 'imex_additional_vat_base_sum', |
4518 | 81 | type="float", | ||
4519 | 82 | readonly=True, | ||
4520 | 83 | store=True), | ||
4521 | 84 | 's_imex_additional_vat_tax_sum' : fields.related('sale_fb_id', | ||
4522 | 85 | 'imex_additional_vat_tax_sum', | ||
4523 | 86 | type="float", | ||
4524 | 87 | readonly=True, | ||
4525 | 88 | store=True), | ||
4526 | 89 | 's_imex_reduced_vat_base_sum' : fields.related('sale_fb_id', | ||
4527 | 90 | 'imex_reduced_vat_base_sum', | ||
4528 | 91 | type="float", | ||
4529 | 92 | readonly=True, | ||
4530 | 93 | store=True), | ||
4531 | 94 | 's_imex_reduced_vat_tax_sum' : fields.related('sale_fb_id', | ||
4532 | 95 | 'imex_reduced_vat_tax_sum', | ||
4533 | 96 | type="float", | ||
4534 | 97 | readonly=True, | ||
4535 | 98 | store=True), | ||
4536 | 99 | 's_do_general_vat_base_sum' : fields.related('sale_fb_id', | ||
4537 | 100 | 'do_general_vat_base_sum', | ||
4538 | 101 | type="float", | ||
4539 | 102 | readonly=True, | ||
4540 | 103 | store=True), | ||
4541 | 104 | 's_do_general_vat_tax_sum' : fields.related('sale_fb_id', | ||
4542 | 105 | 'do_general_vat_tax_sum', | ||
4543 | 106 | type="float", | ||
4544 | 107 | readonly=True, | ||
4545 | 108 | store=True), | ||
4546 | 109 | 's_do_additional_vat_base_sum' : fields.related('sale_fb_id', | ||
4547 | 110 | 'do_additional_vat_base_sum', | ||
4548 | 111 | type="float", | ||
4549 | 112 | readonly=True, | ||
4550 | 113 | store=True), | ||
4551 | 114 | 's_do_additional_vat_tax_sum' : fields.related('sale_fb_id', | ||
4552 | 115 | 'do_additional_vat_tax_sum', | ||
4555 | 116 | type="float", | 81 | type="float", |
4556 | 117 | readonly=True, | 82 | readonly=True, |
4557 | 118 | store=True), | 83 | store=True), |
4569 | 119 | 's_do_reduced_vat_base_sum' : fields.related('sale_fb_id', | 84 | 's_imex_additional_vat_tax_sum': fields.related('sale_fb_id', |
4570 | 120 | 'do_reduced_vat_base_sum', | 85 | 'imex_additional_vat_tax_sum', |
4571 | 121 | type="float", | 86 | type="float", |
4572 | 122 | readonly=True, | 87 | readonly=True, |
4573 | 123 | store=True), | 88 | store=True), |
4574 | 124 | 's_do_reduced_vat_tax_sum' : fields.related('sale_fb_id', | 89 | 's_imex_reduced_vat_base_sum': fields.related('sale_fb_id', |
4575 | 125 | 'do_reduced_vat_tax_sum', | 90 | 'imex_reduced_vat_base_sum', |
4576 | 126 | type="float", | 91 | type="float", |
4577 | 127 | readonly=True, | 92 | readonly=True, |
4578 | 128 | store=True), | 93 | store=True), |
4579 | 129 | 's_base_amount' : fields.related('sale_fb_id', | 94 | 's_imex_reduced_vat_tax_sum': fields.related('sale_fb_id', |
4580 | 95 | 'imex_reduced_vat_tax_sum', | ||
4581 | 96 | type="float", | ||
4582 | 97 | readonly=True, | ||
4583 | 98 | store=True), | ||
4584 | 99 | 's_do_general_vat_base_sum': fields.related('sale_fb_id', | ||
4585 | 100 | 'do_general_vat_base_sum', | ||
4586 | 101 | type="float", | ||
4587 | 102 | readonly=True, | ||
4588 | 103 | store=True), | ||
4589 | 104 | 's_do_general_vat_tax_sum': fields.related('sale_fb_id', | ||
4590 | 105 | 'do_general_vat_tax_sum', | ||
4591 | 106 | type="float", | ||
4592 | 107 | readonly=True, | ||
4593 | 108 | store=True), | ||
4594 | 109 | 's_do_additional_vat_base_sum': fields.related('sale_fb_id', | ||
4595 | 110 | 'do_additional_vat_base_sum', | ||
4596 | 111 | type="float", | ||
4597 | 112 | readonly=True, | ||
4598 | 113 | store=True), | ||
4599 | 114 | 's_do_additional_vat_tax_sum': fields.related('sale_fb_id', | ||
4600 | 115 | 'do_additional_vat_tax_sum', | ||
4601 | 116 | type="float", | ||
4602 | 117 | readonly=True, | ||
4603 | 118 | store=True), | ||
4604 | 119 | 's_do_reduced_vat_base_sum': fields.related('sale_fb_id', | ||
4605 | 120 | 'do_reduced_vat_base_sum', | ||
4606 | 121 | type="float", | ||
4607 | 122 | readonly=True, | ||
4608 | 123 | store=True), | ||
4609 | 124 | 's_do_reduced_vat_tax_sum': fields.related('sale_fb_id', | ||
4610 | 125 | 'do_reduced_vat_tax_sum', | ||
4611 | 126 | type="float", | ||
4612 | 127 | readonly=True, | ||
4613 | 128 | store=True), | ||
4614 | 129 | 's_base_amount': fields.related('sale_fb_id', | ||
4615 | 130 | 'base_amount', | 130 | 'base_amount', |
4616 | 131 | type="float", | 131 | type="float", |
4617 | 132 | readonly=True, | 132 | readonly=True, |
4618 | 133 | store=True), | 133 | store=True), |
4620 | 134 | 's_tax_amount' : fields.related('sale_fb_id', | 134 | 's_tax_amount': fields.related('sale_fb_id', |
4621 | 135 | 'tax_amount', | 135 | 'tax_amount', |
4622 | 136 | type="float", | 136 | type="float", |
4623 | 137 | readonly=True, | 137 | readonly=True, |
4624 | 138 | store=True), | 138 | store=True), |
4626 | 139 | 'start_date' : fields.date(string='Start date'), | 139 | 'start_date': fields.date(string='Start date'), |
4627 | 140 | 140 | ||
4635 | 141 | 'vat' : fields.related('company_id', | 141 | 'vat': fields.related('company_id', |
4636 | 142 | 'partner_id', | 142 | 'partner_id', |
4637 | 143 | 'vat', | 143 | 'vat', |
4638 | 144 | type='char', | 144 | type='char', |
4639 | 145 | string='TIN', | 145 | string='TIN', |
4640 | 146 | readonly=True, | 146 | readonly=True, |
4641 | 147 | store=True), | 147 | store=True), |
4642 | 148 | 148 | ||
4643 | 149 | 149 | ||
4644 | 150 | } | 150 | } |
4645 | 151 | _defaults = { | 151 | _defaults = { |
4646 | 152 | 'state': 'draft', | 152 | 'state': 'draft', |
4649 | 153 | 'company_id': lambda s,c,u,ctx: \ | 153 | 'company_id': lambda s, c, u, ctx: |
4650 | 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, |
4651 | 155 | 'start_date': fields.date.today, | 155 | 'start_date': fields.date.today, |
4652 | 156 | } | 156 | } |
4653 | 157 | 157 | ||
4654 | === modified file 'l10n_ve_withholding/__init__.py' | |||
4655 | --- l10n_ve_withholding/__init__.py 2012-12-05 10:06:09 +0000 | |||
4656 | +++ l10n_ve_withholding/__init__.py 2014-10-11 00:06:17 +0000 | |||
4657 | @@ -5,7 +5,7 @@ | |||
4658 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4659 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4660 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4662 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
4663 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4664 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4665 | 11 | ############################################################################# | 11 | ############################################################################# |
4666 | @@ -23,6 +23,6 @@ | |||
4667 | 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/>. |
4668 | 24 | ################################################################################ | 24 | ################################################################################ |
4669 | 25 | 25 | ||
4671 | 26 | import model | 26 | from . import model |
4672 | 27 | 27 | ||
4673 | 28 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 28 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4674 | 29 | 29 | ||
4675 | === modified file 'l10n_ve_withholding/__openerp__.py' | |||
4676 | --- l10n_ve_withholding/__openerp__.py 2013-11-26 01:24:05 +0000 | |||
4677 | +++ l10n_ve_withholding/__openerp__.py 2014-10-11 00:06:17 +0000 | |||
4678 | @@ -5,7 +5,7 @@ | |||
4679 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4680 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4681 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4683 | 8 | # Coded by: javier@vauxoo.com | 8 | # Coded by: javier@vauxoo.com |
4684 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4685 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4686 | 11 | ############################################################################# | 11 | ############################################################################# |
4687 | @@ -36,14 +36,14 @@ | |||
4688 | 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. |
4689 | 37 | 37 | ||
4690 | 38 | TODO: | 38 | TODO: |
4692 | 39 | - | 39 | - |
4693 | 40 | """, | 40 | """, |
4694 | 41 | 'init_xml': [], | 41 | 'init_xml': [], |
4695 | 42 | "depends" : ["l10n_ve_fiscal_requirements"], | 42 | "depends" : ["l10n_ve_fiscal_requirements"], |
4696 | 43 | 'update_xml': [ | 43 | 'update_xml': [ |
4697 | 44 | 'security/withholding_security.xml', | 44 | 'security/withholding_security.xml', |
4700 | 45 | 'security/ir.model.access.csv', | 45 | 'security/ir.model.access.csv', |
4701 | 46 | 'data/l10n_ve_withholding_data.xml', | 46 | 'data/l10n_ve_withholding_data.xml', |
4702 | 47 | 'view/l10n_ve_withholding_view.xml', | 47 | 'view/l10n_ve_withholding_view.xml', |
4703 | 48 | 'workflow/wh_action_server.xml', | 48 | 'workflow/wh_action_server.xml', |
4704 | 49 | ], | 49 | ], |
4705 | 50 | 50 | ||
4706 | === modified file 'l10n_ve_withholding/model/__init__.py' | |||
4707 | --- l10n_ve_withholding/model/__init__.py 2013-05-22 20:31:12 +0000 | |||
4708 | +++ l10n_ve_withholding/model/__init__.py 2014-10-11 00:06:17 +0000 | |||
4709 | @@ -5,7 +5,7 @@ | |||
4710 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4711 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4712 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4714 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
4715 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4716 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4717 | 11 | ############################################################################# | 11 | ############################################################################# |
4718 | @@ -23,7 +23,7 @@ | |||
4719 | 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/>. |
4720 | 24 | ################################################################################ | 24 | ################################################################################ |
4721 | 25 | 25 | ||
4724 | 26 | import account | 26 | from . import account |
4725 | 27 | import invoice | 27 | from . import invoice |
4726 | 28 | 28 | ||
4727 | 29 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 29 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4728 | 30 | 30 | ||
4729 | === modified file 'l10n_ve_withholding/model/account.py' | |||
4730 | --- l10n_ve_withholding/model/account.py 2014-07-11 17:47:27 +0000 | |||
4731 | +++ l10n_ve_withholding/model/account.py 2014-10-11 00:06:17 +0000 | |||
4732 | @@ -5,7 +5,7 @@ | |||
4733 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4734 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4735 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4737 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
4738 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4739 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4740 | 11 | ############################################################################# | 11 | ############################################################################# |
4741 | @@ -27,35 +27,36 @@ | |||
4742 | 27 | from openerp.tools.translate import _ | 27 | from openerp.tools.translate import _ |
4743 | 28 | import time | 28 | import time |
4744 | 29 | 29 | ||
4763 | 30 | __TYPES__ =[('sale', 'Sale'), | 30 | __TYPES__ = [('sale', 'Sale'), |
4764 | 31 | ('sale_refund','Sale Refund'), | 31 | ('sale_refund', 'Sale Refund'), |
4765 | 32 | ('purchase', 'Purchase'), | 32 | ('purchase', 'Purchase'), |
4766 | 33 | ('purchase_refund','Purchase Refund'), | 33 | ('purchase_refund', 'Purchase Refund'), |
4767 | 34 | ('cash', 'Cash'), | 34 | ('cash', 'Cash'), |
4768 | 35 | ('bank', 'Bank and Cheques'), | 35 | ('bank', 'Bank and Cheques'), |
4769 | 36 | ('general', 'General'), | 36 | ('general', 'General'), |
4770 | 37 | ('situation', 'Opening/Closing Situation'), | 37 | ('situation', 'Opening/Closing Situation'), |
4771 | 38 | ('sale_debit', 'Sale Debit'), | 38 | ('sale_debit', 'Sale Debit'), |
4772 | 39 | ('purchase_debit', 'Purchase Debit'), | 39 | ('purchase_debit', 'Purchase Debit'), |
4773 | 40 | ('iva_sale', 'Sale Wh VAT'), | 40 | ('iva_sale', 'Sale Wh VAT'), |
4774 | 41 | ('iva_purchase', 'Purchase Wh VAT'), | 41 | ('iva_purchase', 'Purchase Wh VAT'), |
4775 | 42 | ('islr_purchase', 'Purchase Wh Income'), | 42 | ('islr_purchase', 'Purchase Wh Income'), |
4776 | 43 | ('islr_sale', 'Sale Wh Income'), | 43 | ('islr_sale', 'Sale Wh Income'), |
4777 | 44 | ('mun_sale', 'Sale Wh County'), | 44 | ('mun_sale', 'Sale Wh County'), |
4778 | 45 | ('mun_purchase', 'Purchase Wh County'), | 45 | ('mun_purchase', 'Purchase Wh County'), |
4779 | 46 | ('src_sale', 'Sale Wh src'), | 46 | ('src_sale', 'Sale Wh src'), |
4780 | 47 | ('src_purchase', 'Purchase Wh src')] | 47 | ('src_purchase', 'Purchase Wh src')] |
4781 | 48 | |||
4782 | 48 | 49 | ||
4783 | 49 | class account_journal(osv.osv): | 50 | class account_journal(osv.osv): |
4784 | 50 | _inherit = 'account.journal' | 51 | _inherit = 'account.journal' |
4793 | 51 | 52 | ||
4794 | 52 | _columns = {'type': fields.selection(__TYPES__, 'Type', size=32, required=True, | 53 | _columns = {'type': fields.selection(__TYPES__, 'Type', size=32, required=True, |
4795 | 53 | help = "Select 'Sale' for customer invoices journals."\ | 54 | help="Select 'Sale' for customer invoices journals." |
4796 | 54 | " Select 'Purchase' for supplier invoices journals."\ | 55 | " Select 'Purchase' for supplier invoices journals." |
4797 | 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." |
4798 | 56 | " Select 'General' for miscellaneous operations journals."\ | 57 | " Select 'General' for miscellaneous operations journals." |
4799 | 57 | " Select 'Opening/Closing Situation' for entries generated for new fiscal years."\ | 58 | " Select 'Opening/Closing Situation' for entries generated for new fiscal years." |
4800 | 58 | " Select 'Sale Debit' for customer debit note journals."\ | 59 | " Select 'Sale Debit' for customer debit note journals." |
4801 | 59 | " Select 'Purchase Debit' for supplier debit note journals." | 60 | " Select 'Purchase Debit' for supplier debit note journals." |
4802 | 60 | " Select 'Sale Wh VAT' for customer vat withholding journals." | 61 | " Select 'Sale Wh VAT' for customer vat withholding journals." |
4803 | 61 | " Select 'Purchase Wh VAT' for supplier vat withholding journals." | 62 | " Select 'Purchase Wh VAT' for supplier vat withholding journals." |
4804 | @@ -65,16 +66,17 @@ | |||
4805 | 65 | " Select 'Purchase Wh County' for supplier municipal withholding journals." | 66 | " Select 'Purchase Wh County' for supplier municipal withholding journals." |
4806 | 66 | " Select 'Sale Wh SRC' for customer social withholding journals." | 67 | " Select 'Sale Wh SRC' for customer social withholding journals." |
4807 | 67 | " Select 'Purchase Wh SRC' for supplier social withholding journals." | 68 | " Select 'Purchase Wh SRC' for supplier social withholding journals." |
4810 | 68 | ) | 69 | ) |
4811 | 69 | } | 70 | } |
4812 | 70 | 71 | ||
4813 | 71 | account_journal() | 72 | account_journal() |
4814 | 72 | 73 | ||
4815 | 74 | |||
4816 | 73 | class account_period(osv.osv): | 75 | class account_period(osv.osv): |
4817 | 74 | _inherit = "account.period" | 76 | _inherit = "account.period" |
4818 | 75 | 77 | ||
4819 | 76 | def _find_fortnight(self, cr, uid, dt=None, context=None): | 78 | def _find_fortnight(self, cr, uid, dt=None, context=None): |
4821 | 77 | """ This Function returns a tuple composed of | 79 | """ This Function returns a tuple composed of |
4822 | 78 | *) period for the asked dt (int) | 80 | *) period for the asked dt (int) |
4823 | 79 | *) fortnight for the asked dt (boolean): | 81 | *) fortnight for the asked dt (boolean): |
4824 | 80 | -) False: for the 1st. fortnight | 82 | -) False: for the 1st. fortnight |
4825 | @@ -82,26 +84,27 @@ | |||
4826 | 82 | Example: | 84 | Example: |
4827 | 83 | (3,True) => a period whose id is 3 in the second fortnight | 85 | (3,True) => a period whose id is 3 in the second fortnight |
4828 | 84 | """ | 86 | """ |
4830 | 85 | if context is None: context = {} | 87 | if context is None: |
4831 | 88 | context = {} | ||
4832 | 86 | if not dt: | 89 | if not dt: |
4833 | 87 | dt = time.strftime('%Y-%m-%d') | 90 | dt = time.strftime('%Y-%m-%d') |
4840 | 88 | period_ids = self.find(cr,uid,dt=dt,context=context) | 91 | period_ids = self.find(cr, uid, dt=dt, context=context) |
4841 | 89 | do = [('special','=',False),('id','in',period_ids)] | 92 | do = [('special', '=', False), ('id', 'in', period_ids)] |
4842 | 90 | #Due to the fact that demo data for periods sets 'special' as True on them, this little | 93 | # Due to the fact that demo data for periods sets 'special' as True on them, this little |
4843 | 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 |
4844 | 92 | #refer to this bug for more information | 95 | # refer to this bug for more information |
4845 | 93 | #https://bugs.launchpad.net/openobject-addons/+bug/924200 | 96 | # https://bugs.launchpad.net/openobject-addons/+bug/924200 |
4846 | 94 | demo_enabled = self.pool.get('ir.module.module').search(cr, uid, | 97 | demo_enabled = self.pool.get('ir.module.module').search(cr, uid, |
4847 | 95 | [('name', '=', 'base'), | 98 | [('name', '=', 'base'), |
4848 | 96 | ('demo', '=', True)]) | 99 | ('demo', '=', True)]) |
4849 | 97 | domain = demo_enabled and [do[1]] or do | 100 | domain = demo_enabled and [do[1]] or do |
4852 | 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.... |
4853 | 99 | period_ids = self.search(cr, uid, domain, context = context) | 102 | period_ids = self.search(cr, uid, domain, context=context) |
4854 | 100 | if not period_ids: | 103 | if not period_ids: |
4859 | 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) |
4860 | 102 | 105 | ||
4861 | 103 | fortnight= False if time.strptime(dt, '%Y-%m-%d').tm_mday <= 15 else True | 106 | fortnight = False if time.strptime(dt, '%Y-%m-%d').tm_mday <= 15 else True |
4862 | 104 | return (period_ids[0],fortnight) | 107 | return (period_ids[0], fortnight) |
4863 | 105 | 108 | ||
4864 | 106 | def find_fortnight(self, cr, uid, dt=None, context=None): | 109 | def find_fortnight(self, cr, uid, dt=None, context=None): |
4865 | 107 | """ | 110 | """ |
4866 | @@ -110,7 +113,7 @@ | |||
4867 | 110 | """ | 113 | """ |
4868 | 111 | # TODO: fix this workaround in version 8.0 [hbto notes] | 114 | # TODO: fix this workaround in version 8.0 [hbto notes] |
4869 | 112 | context = context or {} | 115 | context = context or {} |
4871 | 113 | p,f = self._find_fortnight(cr, uid, dt=dt, context=context) | 116 | p, f = self._find_fortnight(cr, uid, dt=dt, context=context) |
4872 | 114 | return p, str(f) | 117 | return p, str(f) |
4873 | 115 | 118 | ||
4874 | 116 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | 119 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4875 | 117 | 120 | ||
4876 | === modified file 'l10n_ve_withholding/model/invoice.py' | |||
4877 | --- l10n_ve_withholding/model/invoice.py 2013-12-10 15:52:19 +0000 | |||
4878 | +++ l10n_ve_withholding/model/invoice.py 2014-10-11 00:06:17 +0000 | |||
4879 | @@ -5,7 +5,7 @@ | |||
4880 | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). | 5 | # Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>). |
4881 | 6 | # All Rights Reserved | 6 | # All Rights Reserved |
4882 | 7 | ###############Credits###################################################### | 7 | ###############Credits###################################################### |
4884 | 8 | # Coded by: Vauxoo C.A. | 8 | # Coded by: Vauxoo C.A. |
4885 | 9 | # Planified by: Nhomar Hernandez | 9 | # Planified by: Nhomar Hernandez |
4886 | 10 | # Audited by: Vauxoo C.A. | 10 | # Audited by: Vauxoo C.A. |
4887 | 11 | ############################################################################# | 11 | ############################################################################# |
4888 | @@ -25,58 +25,58 @@ | |||
4889 | 25 | 25 | ||
4890 | 26 | import time | 26 | import time |
4891 | 27 | from openerp.osv import fields, osv | 27 | from openerp.osv import fields, osv |
4892 | 28 | from openerp.addons import decimal_precision as dp | ||
4893 | 29 | from openerp.tools.translate import _ | 28 | from openerp.tools.translate import _ |
4894 | 30 | 29 | ||
4895 | 30 | |||
4896 | 31 | class account_invoice(osv.osv): | 31 | class account_invoice(osv.osv): |
4897 | 32 | _inherit = 'account.invoice' | 32 | _inherit = 'account.invoice' |
4903 | 33 | 33 | ||
4904 | 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, |
4905 | 35 | pay_journal_id, writeoff_acc_id, | 35 | pay_journal_id, writeoff_acc_id, |
4906 | 36 | writeoff_period_id, writeoff_journal_id, date, | 36 | writeoff_period_id, writeoff_journal_id, date, |
4907 | 37 | name, context=None): | 37 | name, context=None): |
4908 | 38 | """ Function openerp is rewritten for adaptation in | 38 | """ Function openerp is rewritten for adaptation in |
4909 | 39 | the ovl | 39 | the ovl |
4910 | 40 | """ | 40 | """ |
4912 | 41 | if context is None: context = {} | 41 | if context is None: |
4913 | 42 | context = {} | ||
4914 | 42 | return [] | 43 | return [] |
4915 | 43 | 44 | ||
4921 | 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, |
4922 | 45 | period_id, pay_journal_id, writeoff_acc_id, | 46 | period_id, pay_journal_id, writeoff_acc_id, |
4923 | 46 | writeoff_period_id, writeoff_journal_id, date, | 47 | writeoff_period_id, writeoff_journal_id, date, |
4924 | 47 | name, to_wh, context=None): | 48 | name, to_wh, context=None): |
4925 | 48 | """ Make the payment of the invoice | 49 | """ Make the payment of the invoice |
4926 | 49 | """ | 50 | """ |
4927 | 50 | if context is None: | 51 | if context is None: |
4928 | 51 | context = {} | 52 | context = {} |
4929 | 52 | rp_obj = self.pool.get('res.partner') | 53 | rp_obj = self.pool.get('res.partner') |
4933 | 53 | 54 | ||
4934 | 54 | #TODO check if we can use different period for payment and the writeoff line | 55 | # TODO check if we can use different period for payment and the writeoff line |
4935 | 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" |
4936 | 56 | invoice = self.browse(cr, uid, ids[0]) | 57 | invoice = self.browse(cr, uid, ids[0]) |
4937 | 57 | src_account_id = invoice.account_id.id | 58 | src_account_id = invoice.account_id.id |
4939 | 58 | 59 | ||
4940 | 59 | # Take the seq as name for move | 60 | # Take the seq as name for move |
4941 | 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} |
4942 | 61 | direction = types[invoice.type] | 62 | direction = types[invoice.type] |
4943 | 62 | l1 = { | 63 | l1 = { |
4946 | 63 | 'debit': direction * pay_amount>0 and direction * pay_amount, | 64 | 'debit': direction * pay_amount > 0 and direction * pay_amount, |
4947 | 64 | 'credit': direction * pay_amount<0 and - direction * pay_amount, | 65 | 'credit': direction * pay_amount < 0 and - direction * pay_amount, |
4948 | 65 | 'account_id': src_account_id, | 66 | 'account_id': src_account_id, |
4949 | 66 | 'partner_id': rp_obj._find_accounting_partner(invoice.partner_id).id, | 67 | 'partner_id': rp_obj._find_accounting_partner(invoice.partner_id).id, |
4951 | 67 | 'ref':invoice.number, | 68 | 'ref': invoice.number, |
4952 | 68 | 'date': date, | 69 | 'date': date, |
4953 | 69 | 'currency_id': False, | 70 | 'currency_id': False, |
4955 | 70 | 'name':name | 71 | 'name': name |
4956 | 71 | } | 72 | } |
4957 | 72 | lines = [(0, 0, l1)] | 73 | lines = [(0, 0, l1)] |
4962 | 73 | 74 | ||
4963 | 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, |
4964 | 75 | pay_journal_id, writeoff_acc_id, | 76 | pay_journal_id, writeoff_acc_id, |
4965 | 76 | writeoff_period_id, writeoff_journal_id, date, | 77 | writeoff_period_id, writeoff_journal_id, date, |
4966 | 77 | name, context=context) | 78 | name, context=context) |
4969 | 78 | 79 | ||
4968 | 79 | |||
4970 | 80 | if not l2: | 80 | if not l2: |
4971 | 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!')) |
4972 | 82 | lines += l2 | 82 | lines += l2 |
4973 | @@ -89,13 +89,13 @@ | |||
4974 | 89 | line_ids = [] | 89 | line_ids = [] |
4975 | 90 | total = 0.0 | 90 | total = 0.0 |
4976 | 91 | line = self.pool.get('account.move.line') | 91 | line = self.pool.get('account.move.line') |
4981 | 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) + ')') |
4982 | 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())) |
4983 | 94 | for l in lines+invoice.payment_ids: | 94 | for l in lines + invoice.payment_ids: |
4984 | 95 | if l.account_id.id==src_account_id: | 95 | if l.account_id.id == src_account_id: |
4985 | 96 | line_ids.append(l.id) | 96 | line_ids.append(l.id) |
4986 | 97 | total += (l.debit or 0.0) - (l.credit or 0.0) | 97 | total += (l.debit or 0.0) - (l.credit or 0.0) |
4988 | 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: |
4989 | 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) |
4990 | 100 | else: | 100 | else: |
4991 | 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) |
4992 | @@ -116,21 +116,21 @@ | |||
4993 | 116 | moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) | 116 | moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) |
4994 | 117 | src = [] | 117 | src = [] |
4995 | 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): |
4997 | 119 | temp_lines = []#Added temp list to avoid duplicate records | 119 | temp_lines = [] # Added temp list to avoid duplicate records |
4998 | 120 | if m.reconcile_id: | 120 | if m.reconcile_id: |
4999 | 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] |
5000 | 122 | elif m.reconcile_partial_id: | 122 | elif m.reconcile_partial_id: |
The diff has been truncated for viewing.
Hbto, requiero su "approve" para subir estos cambios!