Skip to content

Commit

Permalink
10.0 Port purchase_fiscal_position_update (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexis de Lattre authored and pedrobaeza committed Nov 16, 2016
1 parent bbe0112 commit 64c0480
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 107 deletions.
56 changes: 56 additions & 0 deletions purchase_fiscal_position_update/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

===============================
Purchase Fiscal Position Update
===============================

With this module, when a user changes the fiscal position of a purchase
order, the taxes on all the purchase order lines are automatically
updated.

Configuration
=============

No specific configuration needed. This module uses the standard
configuration of the fiscal positions.

Usage
=====

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/142/10.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/purchase-workflow/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smashing it by providing a detailed and welcomed feedback.

Credits
=======

Contributors
------------

* Mathieu Vatel (Julius Network Solutions)
* Alexis de Lattre <alexis.delattre@akretion.com>

Maintainer
----------

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
22 changes: 1 addition & 21 deletions purchase_fiscal_position_update/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Fiscal Position Update module for Odoo
# 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/>.
#
##############################################################################

from . import purchase
from . import models
29 changes: 6 additions & 23 deletions purchase_fiscal_position_update/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Purchase Fiscal Position Update module for Odoo
# 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/>.
#
##############################################################################
# © 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


{
'name': 'Purchase Fiscal Position Update',
'version': '8.0.1.0.0',
'version': '10.0.1.0.0',
'category': 'Purchase Management',
'license': 'AGPL-3',
'summary': 'Changing the fiscal position of a purchase order will '
Expand All @@ -40,6 +24,5 @@
"Akretion,"
"Odoo Community Association (OCA)",
'depends': ['purchase'],
'data': [],
'installable': False,
'installable': True,
}
3 changes: 3 additions & 0 deletions purchase_fiscal_position_update/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from . import purchase
24 changes: 24 additions & 0 deletions purchase_fiscal_position_update/models/purchase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# © 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
# @author Mathieu Vatel <mathieu _at_ julius.fr>
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models, api


class PurchaseOrder(models.Model):
_inherit = "purchase.order"

@api.onchange('fiscal_position_id')
def fiscal_position_change(self):
'''Function executed by the on_change on the fiscal_position_id field
of a purchase order ; it updates taxes on all order lines'''
fp = self.fiscal_position_id
for line in self.order_line:
# product_id is a required field since v9
taxes = line.product_id.supplier_taxes_id.filtered(
lambda tax: tax.company_id == self.company_id)
if fp:
taxes = fp.map_tax(taxes)
line.taxes_id = [(6, 0, taxes.ids)]
63 changes: 0 additions & 63 deletions purchase_fiscal_position_update/purchase.py

This file was deleted.

0 comments on commit 64c0480

Please sign in to comment.