I won't port it to v8, so I remove it for the moment.
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Sale Fiscal Position Update Button module for OpenERP
|
|
||||||
# Copyright (C) 2014 Akretion (http://www.akretion.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 . import sale
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
##############################################################################
|
|
||||||
#
|
|
||||||
# Sale Fiscal Position Update Button module for OpenERP
|
|
||||||
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
|
|
||||||
# Copyright (C) 2014 Akretion (http://www.akretion.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': 'Sale Fiscal Position Update Button',
|
|
||||||
'version': '1.0',
|
|
||||||
'category': 'Sales Management',
|
|
||||||
'license': 'AGPL-3',
|
|
||||||
'summary': 'Update the fiscal position of a sale order in one click',
|
|
||||||
'description': """
|
|
||||||
Sale Fiscal Position Update Button
|
|
||||||
==================================
|
|
||||||
|
|
||||||
When the sale order is in draft/sent state, you can change the fiscal position and click on a button *Update Tax* to update the taxes on all the sale order lines which have a product (if a sale order line doesn't have a product, it won't work and the user will have an error message).
|
|
||||||
|
|
||||||
This module is an alternative to the module sale_fiscal_position_update from the sale-wkfl OCA branch, which works with an on_change. It is particularly usefull when a country updates it's VAT rates and the salesman want to update their quote and have the new VAT rates in one click.
|
|
||||||
""",
|
|
||||||
'author': 'Julius Network Solutions, Akretion',
|
|
||||||
'depends': ['sale'],
|
|
||||||
'data': ['sale_view.xml'],
|
|
||||||
'installable': True,
|
|
||||||
'active': False,
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#############################################################################
|
|
||||||
#
|
|
||||||
# Sale Fiscal Position Update module for OpenERP
|
|
||||||
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
|
|
||||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
|
||||||
# @author Mathieu Vatel <mathieu _at_ julius.fr>
|
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.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 orm
|
|
||||||
from openerp.tools.translate import _
|
|
||||||
|
|
||||||
|
|
||||||
class sale_order(orm.Model):
|
|
||||||
_inherit = "sale.order"
|
|
||||||
|
|
||||||
def update_fiscal_position(self, cr, uid, ids, context=None):
|
|
||||||
'''Function executed by the "(update)" button on orders
|
|
||||||
If the orders are in draft state, it updates taxes and accounts
|
|
||||||
on all order lines'''
|
|
||||||
fp_obj = self.pool['account.fiscal.position']
|
|
||||||
for order in self.browse(cr, uid, ids, context=context):
|
|
||||||
if order.state not in ('sent', 'draft'):
|
|
||||||
raise orm.except_orm(
|
|
||||||
_('Error:'),
|
|
||||||
_('You cannot update the fiscal position because the '
|
|
||||||
'sale order is not in draft or sent state.'))
|
|
||||||
fp = order.fiscal_position
|
|
||||||
for line in order.order_line:
|
|
||||||
if line.product_id:
|
|
||||||
product = self.pool['product.product'].browse(
|
|
||||||
cr, uid, line.product_id.id, context=context)
|
|
||||||
taxes = product.taxes_id
|
|
||||||
tax_ids = fp_obj.map_tax(
|
|
||||||
cr, uid, fp, taxes, context=context)
|
|
||||||
line.write({'tax_id': [(6, 0, tax_ids)]}, context=context)
|
|
||||||
else:
|
|
||||||
raise orm.except_orm(
|
|
||||||
_('Error:'),
|
|
||||||
_("Cannot update the fiscal position because "
|
|
||||||
"the line '%s' doesn't have a product.")
|
|
||||||
% line.name)
|
|
||||||
return True
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<openerp>
|
|
||||||
<data>
|
|
||||||
|
|
||||||
<record id="view_order_form" model="ir.ui.view">
|
|
||||||
<field name="name">fiscal.position.update.button.order.form</field>
|
|
||||||
<field name="model">sale.order</field>
|
|
||||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="state" position="before">
|
|
||||||
<button name="update_fiscal_position" type="object"
|
|
||||||
states="draft,sent" string="Update Taxes"
|
|
||||||
help="Update taxes on all sale order lines which have a product" />
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
||||||
Reference in New Issue
Block a user