-
-
Notifications
You must be signed in to change notification settings - Fork 750
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
10.0 Port purchase_fiscal_position_update (#280)
- Loading branch information
1 parent
bbe0112
commit 64c0480
Showing
6 changed files
with
90 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from . import purchase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)] |
This file was deleted.
Oops, something went wrong.