Skip to content

Commit 64c0480

Browse files
Alexis de Lattrepedrobaeza
Alexis de Lattre
authored andcommitted
10.0 Port purchase_fiscal_position_update (OCA#280)
1 parent bbe0112 commit 64c0480

File tree

6 files changed

+90
-107
lines changed

6 files changed

+90
-107
lines changed
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
===============================
6+
Purchase Fiscal Position Update
7+
===============================
8+
9+
With this module, when a user changes the fiscal position of a purchase
10+
order, the taxes on all the purchase order lines are automatically
11+
updated.
12+
13+
Configuration
14+
=============
15+
16+
No specific configuration needed. This module uses the standard
17+
configuration of the fiscal positions.
18+
19+
Usage
20+
=====
21+
22+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
23+
:alt: Try me on Runbot
24+
:target: https://runbot.odoo-community.org/runbot/142/10.0
25+
26+
Bug Tracker
27+
===========
28+
29+
Bugs are tracked on `GitHub Issues
30+
<https://github.com/OCA/purchase-workflow/issues>`_. In case of trouble, please
31+
check there if your issue has already been reported. If you spotted it first,
32+
help us smashing it by providing a detailed and welcomed feedback.
33+
34+
Credits
35+
=======
36+
37+
Contributors
38+
------------
39+
40+
* Mathieu Vatel (Julius Network Solutions)
41+
* Alexis de Lattre <alexis.delattre@akretion.com>
42+
43+
Maintainer
44+
----------
45+
46+
.. image:: https://odoo-community.org/logo.png
47+
:alt: Odoo Community Association
48+
:target: https://odoo-community.org
49+
50+
This module is maintained by the OCA.
51+
52+
OCA, or the Odoo Community Association, is a nonprofit organization whose
53+
mission is to support the collaborative development of Odoo features and
54+
promote its widespread use.
55+
56+
To contribute to this module, please visit https://odoo-community.org.
+1-21
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,3 @@
11
# -*- coding: utf-8 -*-
2-
##############################################################################
3-
#
4-
# Purchase Fiscal Position Update module for Odoo
5-
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
6-
# Copyright (C) 2014 Akretion (http://www.akretion.com)
7-
#
8-
# This program is free software: you can redistribute it and/or modify
9-
# it under the terms of the GNU Affero General Public License as
10-
# published by the Free Software Foundation, either version 3 of the
11-
# License, or (at your option) any later version.
12-
#
13-
# This program is distributed in the hope that it will be useful,
14-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
# GNU Affero General Public License for more details.
17-
#
18-
# You should have received a copy of the GNU Affero General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
#
21-
##############################################################################
222

23-
from . import purchase
3+
from . import models
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,12 @@
11
# -*- coding: utf-8 -*-
2-
##############################################################################
3-
#
4-
# Purchase Fiscal Position Update module for Odoo
5-
# Copyright (C) 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
6-
# Copyright (C) 2014 Akretion (http://www.akretion.com)
7-
#
8-
# This program is free software: you can redistribute it and/or modify
9-
# it under the terms of the GNU Affero General Public License as
10-
# published by the Free Software Foundation, either version 3 of the
11-
# License, or (at your option) any later version.
12-
#
13-
# This program is distributed in the hope that it will be useful,
14-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16-
# GNU Affero General Public License for more details.
17-
#
18-
# You should have received a copy of the GNU Affero General Public License
19-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20-
#
21-
##############################################################################
2+
# © 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
3+
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
5+
226

237
{
248
'name': 'Purchase Fiscal Position Update',
25-
'version': '8.0.1.0.0',
9+
'version': '10.0.1.0.0',
2610
'category': 'Purchase Management',
2711
'license': 'AGPL-3',
2812
'summary': 'Changing the fiscal position of a purchase order will '
@@ -40,6 +24,5 @@
4024
"Akretion,"
4125
"Odoo Community Association (OCA)",
4226
'depends': ['purchase'],
43-
'data': [],
44-
'installable': False,
27+
'installable': True,
4528
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from . import purchase
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2011-2014 Julius Network Solutions SARL <contact@julius.fr>
3+
# @author Mathieu Vatel <mathieu _at_ julius.fr>
4+
# © 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
5+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
6+
7+
from odoo import models, api
8+
9+
10+
class PurchaseOrder(models.Model):
11+
_inherit = "purchase.order"
12+
13+
@api.onchange('fiscal_position_id')
14+
def fiscal_position_change(self):
15+
'''Function executed by the on_change on the fiscal_position_id field
16+
of a purchase order ; it updates taxes on all order lines'''
17+
fp = self.fiscal_position_id
18+
for line in self.order_line:
19+
# product_id is a required field since v9
20+
taxes = line.product_id.supplier_taxes_id.filtered(
21+
lambda tax: tax.company_id == self.company_id)
22+
if fp:
23+
taxes = fp.map_tax(taxes)
24+
line.taxes_id = [(6, 0, taxes.ids)]

purchase_fiscal_position_update/purchase.py

-63
This file was deleted.

0 commit comments

Comments
 (0)