Commit 3e5c7557 authored by Luis Ernesto Torres Macías's avatar Luis Ernesto Torres Macías
Browse files

[ADD][account_journal_double_validation]Added fields required to add a new...

[ADD][account_journal_double_validation]Added fields required to add a new option in account_voucher for validate first amount lines and after taxes
parent 3f0179c7
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
############################################################################
# Coded by: Luis Torres (luis_t@vauxoo.com)
############################################################################
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import account
import account_voucher
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
############################################################################
# Coded by: Luis Torres (luis_t@vauxoo.com)
############################################################################
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Account Journal Double Validation",
"version" : "1.0",
"author" : "Vauxoo",
"category" : "Generic Modules",
"description" : """
This module added a new field in account_journal, to indicate that the
vouchers that used the journal, need double validation.
""",
"website" : "http://www.vauxoo.com/",
"license" : "AGPL-3",
"depends" : [
"account_voucher",
],
"init_xml" : [],
"demo_xml" : [],
"update_xml" : [
"account_view.xml",
"account_voucher_view.xml",
],
"test": [],
"installable" : True,
"active" : False,
}
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
############################################################################
# Coded by: Luis Torres (luis_t@vauxoo.com)
############################################################################
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv, fields
class account_journal(osv.Model):
_inherit = 'account.journal'
_columns = {
'voucher_double_validation_ok' : fields.boolean('Voucher Double '\
'Validation OK', help='If this field is active, the vouchers '\
'with this journal may be paid without tax, and after pay the'\
'tax')
}
<?xml version='1.0' encoding='utf-8'?>
<openerp>
<data>
<record model="ir.ui.view" id="view_account_journal_inherit_voucher_double_validation_form">
<field name="name">view.account.journal.inherit.voucher.double.validation.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='sequence_id']" position="after">
<field name="voucher_double_validation_ok"/>
</xpath>
</field>
</record>
</data>
</openerp>
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2010 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo (info@vauxoo.com)
############################################################################
# Coded by: Luis Torres (luis_t@vauxoo.com)
############################################################################
#
# 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.osv import osv, fields
class account_voucher(osv.Model):
_inherit = 'account.voucher'
def _get_double_validation_ok(self, cr, uid, ids, field, arg, context=None):
res = {}
for voucher in self.browse(cr, uid, ids, context=context):
if voucher.type == 'payment' and voucher.journal_id.\
voucher_double_validation_ok:
res[voucher.id] = True
else:
res[voucher.id] = False
return res
_columns = {
'double_validation_ok' : fields.function(_get_double_validation_ok,
type='boolean', string='Double Validation OK', store=True),
'tax_paid' : fields.boolean('Amount Tax Paid', help='This field'\
'show if the tax of this voucher already was paid', readonly=True)
}
def validate_paid_tax(self, cr, uid, ids, context=None):
if not context:
context = {}
for voucher in self.browse(cr, uid, ids, context=context):
voucher.write({'tax_paid': True})
return True
def cancel_voucher(self, cr, uid, ids, context=None):
for voucher in self.browse(cr, uid, ids, context=context):
voucher.write({'tax_paid': False})
return super(account_voucher, self).cancel_voucher(cr, uid, ids,
context=context)
def proforma_voucher(self, cr, uid, ids, context=None):
for voucher in self.browse(cr, uid, ids, context=context):
if not voucher.double_validation_ok:
voucher.write({'tax_paid': True})
return super(account_voucher, self).proforma_voucher(cr, uid, ids,
context=context)
<?xml version='1.0' encoding='utf-8'?>
<openerp>
<data>
<record id="view_account_voucher_double_validation" model="ir.ui.view">
<field name="name">view.account.voucher.double.validation</field>
<field name="model">account.voucher</field>
<field name="inherit_id" ref="account_voucher.view_vendor_payment_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='journal_id']" position="after">
<field name="double_validation_ok" invisible="1"/>
<field name="tax_paid" invisible="1"/>
</xpath>
<xpath expr="//button[@name='proforma_voucher']" position="after">
<button name="validate_paid_tax" string="Validate Tax" type="object" class="oe_highlight" attrs="{'invisible': ['|', ('state', '!=', 'posted'), ('tax_paid', '=', True)]}"/>
</xpath>
</field>
</record>
</data>
</openerp>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment