← Back to team overview

openerp-brazil-team team mailing list archive

Re: lp:~vdittgen/openerp.pt-br-localiz/tax_application_behaviour into lp:openerp.pt-br-localiz

 

Vinicius,

Este merge resolve o caso da retenção do ir, confins e etc pra notas de serviço?

Atenciosamente,
Alexandre Leitão

Em 03/05/2012, às 20:40, "Vinicius Dittgen - Proge.com.br" <vinicius@xxxxxxxxxxxx> escreveu:

> Vinicius Dittgen - Proge.com.br has proposed merging lp:~vdittgen/openerp.pt-br-localiz/tax_application_behaviour into lp:openerp.pt-br-localiz.
> 
> Requested reviews:
>  OpenERP Brazil Core Team (openerp-brazil-core-team)
> 
> For more details, see:
> https://code.launchpad.net/~vdittgen/openerp.pt-br-localiz/tax_application_behaviour/+merge/104653
> 
> Add tax_add,tax_retain and tax_include behavior. Can support service invoices with retained taxes.
> fix price_subtotal calc in invoice, and tax calc in sale order for tax_add type(like ipi).
> -- 
> https://code.launchpad.net/~vdittgen/openerp.pt-br-localiz/tax_application_behaviour/+merge/104653
> Your team OpenERP Brazil Team is subscribed to branch lp:openerp.pt-br-localiz.
> === added directory 'l10n_br' === added file 'l10n_br/__init__.py' --- l10n_br/__init__.py	1970-01-01 00:00:00 +0000 +++ l10n_br/__init__.py	2012-05-03 23:39:20 +0000 @@ -0,0 +1,24 @@ +# -*- encoding: utf-8 -*- +################################################################################# +# # +# Copyright (C) 2009 Renato Lima - Akretion # +# # +#This program is free software: you can redistribute it and/or modify # +#it under the terms of the GNU Affero General Public License as published by # +#the Free Software Foundation, either version 3 of the License, or # +#(at your option) any later version. # +# # +#This program is distributed in the hope that it will be useful, # +#but WITHOUT ANY WARRANTY; without even the implied warranty of # +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +#GNU General Public License for more details. # +# # +#You should have received a copy of the GNU General Public License # +#along with this program. If not, see .          # +################################################################################# + +import account +import l10n_br + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + === added file 'l10n_br/__openerp__.py' --- l10n_br/__openerp__.py	1970-01-01 00:00:00 +0000 +++ l10n_br/__openerp__.py	2012-05-03 23:39:20 +0000 @@ -0,0 +1,69 @@ +# -*- encoding: utf-8 -*- +################################################################################# +# +# Copyright (C) 2009 Renato Lima - Akretion +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +#    You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +################################################################################# + +{ + 'name': 'Brazilian - Accounting', + 'category': 'Localization/Account Charts', + 'description': """ +Base module for the Brazilian localization +========================================== + +This module consists in: + + - Generic Brazilian chart of accounts + - Brazilian taxes such as: + + - IPI + - ICMS + - PIS + - COFINS + - ISS + - IR + - IRPJ + - CSLL + + - Tax Situation Code (CST) required for the electronic fiscal invoicing (NFe) + +The field tax_discount has also been added in the account.tax.template and account.tax objects to allow the proper computation of some Brazilian VATs such as ICMS. The chart of account creation wizard has been extended to propagate those new data properly. + +It's important to note however that this module lack many implementations to use OpenERP properly in Brazil. Those implementations (such as the electronic fiscal Invoicing which is already operational) are brought by more than 15 additional modules of the Brazilian Launchpad localization project https://launchpad.net/openerp.pt-br-localiz and their dependencies in the extra addons branch. Those modules aim at not breaking with the remarkable OpenERP modularity, this is why they are numerous but small. One of the reasons for maintaining those modules apart is that Brazilian Localization leaders need commit rights agility to complete the localization as companies fund the remaining legal requirements (such as soon fiscal ledgers, accounting SPED, fiscal SPED and PAF ECF that are still missing as September 2011). Those modules are also strictly licensed under AGPL V3 and today don't come with any additional paid permission for online use of 'private modules'.""", + 'license': 'AGPL-3', + 'author': 'Akretion, PROGE, OpenERP Brasil', + 'website': 'http://openerpbrasil.org', + 'version': '0.6', + 'depends': ['account','account_chart'], + 'init_xml': [ + 'data/account.account.type.csv', + 'data/account.tax.code.template.csv', + 'data/account.account.template.csv', + 'data/l10n_br_account_chart_template.xml', + 'data/account_tax_template.xml', + 'data/l10n_br_data.xml', + 'security/ir.model.access.csv', + ], + 'update_xml': [ + 'account_view.xml', +        'l10n_br_view.xml', + ], + 'installable': True, + 'certificate' : '001280994939126801405', +} + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'l10n_br/account.py' --- l10n_br/account.py	1970-01-01 00:00:00 +0000 +++ l10n_br/account.py	2012-05-03 23:39:20 +0000 @@ -0,0 +1,150 @@ +# -*- encoding: utf-8 -*- +################################################################################# +# # +# Copyright (C) 2009 Renato Lima - Akretion, Vinicius Dittgen - PROGE, Leonardo# +#Santagada - PROGE # +# # +#This program is free software: you can redistribute it and/or modify # +#it under the terms of the GNU Affero General Public License as published by # +#the Free Software Foundation, either version 3 of the License, or # +#(at your option) any later version. # +# # +#This program is distributed in the hope that it will be useful, # +#but WITHOUT ANY WARRANTY; without even the implied warranty of # +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +#GNU General Public License for more details. # +# # +#You should have received a copy of the GNU General Public License # +#along with this program. If not, see . # +################################################################################# + +import pooler +from osv import fields, osv + +_columns = { + 'domain': fields.char('Domain', size=32, help="This field is only used if you develop your own module allowing developers to create specific taxes in a custom domain."), + 'tax_discount': fields.boolean('Tax Discounted in Price', help="Mark it for (ICMS, PIS e etc.)."), + 'tax_include': fields.boolean('Include the Tax Amount in Price', help="Mark it to include the Tax Amount in Price."), + } + + +class account_tax_code_template(osv.osv): + _inherit = 'account.tax.code.template' + _columns = _columns + +account_tax_code_template() + + +class account_tax_code(osv.osv): + _inherit = 'account.tax.code' + _columns = _columns + +account_tax_code() + + +def change_digit_tax(cr): + res = pooler.get_pool(cr.dbname).get('decimal.precision').precision_get(cr, 1, 'Account') + return (16, res + 2) + + +_columns_tax = { + 'tax_discount': fields.boolean('Tax Discounted in Price', help="Mark it for Brazilian legal Taxes(ICMS, PIS e etc.)."), + 'tax_add': fields.boolean('Add the Tax Amount in Price', help="Mark it to add the Tax Amount in Price."), + 'tax_include': fields.boolean('Include the Tax Amount in Price', help="Mark it to include the Tax Amount in Price."), + 'tax_retain': fields.boolean('Discount the Tax Amount in Price', help="Mark it to for clients who retain the Taxes."), + 'base_reduction': fields.float('Redution', required=True, digits_compute=change_digit_tax, help="Um percentual decimal em % entre 0-1."), + 'amount_mva': fields.float('MVA Percent', required=True, digits_compute=change_digit_tax, help="Um percentual decimal em % entre 0-1."), + 'type': fields.selection([('percent', 'Percentage'), ('fixed', 'Fixed Amount'), + ('none', 'None'), ('code', 'Python Code'), + ('balance', 'Balance'), ('quantity', 'Quantity')], 'Tax Type', required=True, + help="The computation method for the tax amount."), + } + +_defaults_tax = { + 'base_reduction': 0, + 'amount_mva': 0, + } + + +class account_tax_common(object): + tax_code_name = 'account.tax.code.template' + + def onchange_tax_code_id(self, cr, uid, ids, tax_code_id, context=None): + result = {'value': {}} + if not tax_code_id: + return result + + tax_code = self.pool.get(self.tax_code_name).browse(cr, uid, tax_code_id) + if tax_code: + result['value']['tax_discount'] = tax_code.tax_discount + result['value']['tax_include'] = tax_code.tax_include + result['value']['domain'] = tax_code.domain + + return result + + +class account_tax_template(account_tax_common, osv.osv): + _inherit = 'account.tax.template' + tax_code_name = 'account.tax.code.template' + _columns = _columns_tax + _defaults = _defaults_tax + +account_tax_template() + + +class account_tax(account_tax_common, osv.osv): + _inherit = 'account.tax' + tax_code_name = 'account.tax.code' + _columns = _columns_tax + _defaults = _defaults_tax + +account_tax() + + +class wizard_multi_charts_accounts(osv.osv_memory): + _inherit = 'wizard.multi.charts.accounts' + + def execute(self, cr, uid, ids, context=None): + super(wizard_multi_charts_accounts, self).execute(cr, uid, ids, context) + + obj_multi = self.browse(cr, uid, ids[0]) + obj_tax = self.pool.get('account.tax') + obj_tax_tmp = self.pool.get('account.tax.template') +        obj_tax_code = self.pool.get('account.tax.code') + obj_tax_code_tmp = self.pool.get('account.tax.code.template') + obj_cst = self.pool.get('l10n_br_account.cst') + obj_cst_tmp = self.pool.get('l10n_br_account.cst.template') + + # Creating Account + tax_code_root_id = obj_multi.chart_template_id.tax_code_root_id.id + company_id = obj_multi.company_id.id + + child_tax_code_temp_ids = obj_tax_code_tmp.search(cr, uid, [('parent_id', 'child_of', [tax_code_root_id])], order='id') + child_tax_code_temp_ids.sort() + for tax_code_template in obj_tax_code_tmp.browse(cr, uid, child_tax_code_temp_ids, context=context): + tax_code_id = obj_tax_code.search(cr, uid, [('code', '=', tax_code_template.code), + ('company_id', '=', company_id)]) + if tax_code_id: + obj_tax_code.write(cr, uid, tax_code_id, {'domain': tax_code_template.domain, + 'notprintable': tax_code_template.notprintable, + 'tax_discount': tax_code_template.tax_discount, + 'tax_include': tax_code_template.tax_include}) + + cst_tmp_ids = obj_cst_tmp.search(cr, uid, [('tax_code_template_id', '=', tax_code_template.id)], order='id') + for cst_tmp in obj_cst_tmp.browse(cr, uid, cst_tmp_ids, context=context): + obj_cst.create(cr, uid, {'code': cst_tmp.code, + 'name': cst_tmp.name, + 'tax_code_id': tax_code_id[0]}) + + tax_ids = obj_tax_tmp.search(cr, uid, []) + for tax_template in obj_tax_tmp.browse(cr, uid, tax_ids, context=context): + tax_id = obj_tax.search(cr, uid, [('name', '=', tax_template.name)]) + if tax_template.id: + obj_tax.write(cr, uid, tax_id, {'domain': tax_template.tax_code_id.domain, + 'tax_discount': tax_template.tax_discount, + 'price_include': tax_template.price_include, + 'tax_add': tax_template.tax_add, + 'tax_retain': tax_template.tax_retain, +                                                'tax_include': tax_template.tax_include}) + +wizard_multi_charts_accounts() === added file 'l10n_br/account_view.xml' --- l10n_br/account_view.xml	1970-01-01 00:00:00 +0000 +++ l10n_br/account_view.xml	2012-05-03 23:39:20 +0000 @@ -0,0 +1,114 @@ + + +	 + +	 +	 + l10n_br_account.tax.code.form + account.tax.code +	 +	 +	 +	 +	 +	 +	 +	 +	 +	 +			l10n_br_account.tax.code.template.form +	 account.tax.code.template +	 +	 + +	 +	 +	 +	 +	 + +	 +	 + l10n_br_account.tax.template.form + account.tax.template +	 +	 +	 +	 +	 +	 +	 + +		 +	 l10n_br_account.tax.form + account.tax +	 +	 +	 +	 +	 +	 +	 +	 +	 + l10n_br_account.tax.t
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-brazil-team
> Post to     : openerp-brazil-team@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-brazil-team
> More help   : https://help.launchpad.net/ListHelp

-- 
https://code.launchpad.net/~vdittgen/openerp.pt-br-localiz/tax_application_behaviour/+merge/104653
Your team OpenERP Brazil Team is subscribed to branch lp:openerp.pt-br-localiz.


Follow ups

References