Skip to content

Commit b9221e2

Browse files
committed
[FIX] pos_pricelist: FP taxes with multi-company. Fixes OCA#84
The object account.fiscal.position.tax doesn't have multi-company rules, which leads to error in environments with multi-company and these records, because it finally accesses to the parent fiscal position, which on contrary has access rules, provoking an access error. This commit added the field company_id to the model, and add the corresponding access rule.
1 parent dd1b1a6 commit b9221e2

File tree

4 files changed

+39
-38
lines changed

4 files changed

+39
-38
lines changed

pos_pricelist/__openerp__.py

+9-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11
# -*- coding: utf-8 -*-
2-
##############################################################################
3-
# Point Of Sale - Pricelist for POS Odoo
4-
# Copyright (C) 2014 Taktik (http://www.taktik.be)
5-
# @author Adil Houmadi <[email protected]>
6-
#
7-
# This program is free software: you can redistribute it and/or modify
8-
# it under the terms of the GNU Affero General Public License as
9-
# published by the Free Software Foundation, either version 3 of the
10-
# License, or (at your option) any later version.
11-
# This program is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Affero General Public License for more details.
15-
# You should have received a copy of the GNU Affero General Public License
16-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
##############################################################################
2+
# © 2014-2015 Taktik (http://www.taktik.be) - Adil Houmadi <[email protected]>
3+
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5+
196
{
207
'name': 'POS Pricelist',
21-
'version': '8.0.1.2.0',
8+
'version': '8.0.1.3.0',
229
'category': 'Point Of Sale',
2310
'sequence': 1,
24-
'author': "Adil Houmadi @Taktik,Odoo Community Association (OCA)",
11+
'author': "Adil Houmadi @Taktik, "
12+
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
13+
"Odoo Community Association (OCA)",
2514
'summary': 'Pricelist for Point of sale',
2615
'depends': [
2716
"point_of_sale",
@@ -32,6 +21,7 @@
3221
"views/point_of_sale_view.xml",
3322
"report/report_receipt.xml",
3423
"security/ir.model.access.csv",
24+
"security/account_fiscal_position_security.xml",
3525
],
3626
'demo': [
3727
'demo/pos_pricelist_demo.yml',
@@ -41,6 +31,4 @@
4131
],
4232
'post_init_hook': "set_pos_line_taxes",
4333
'installable': True,
44-
'application': False,
45-
'auto_install': False,
4634
}

pos_pricelist/models/__init__.py

+5-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
##############################################################################
3-
# Point Of Sale - Pricelist for POS Odoo
4-
# Copyright (C) 2015 Taktik (http://www.taktik.be)
5-
# @author Adil Houmadi <[email protected]>
6-
#
7-
# This program is free software: you can redistribute it and/or modify
8-
# it under the terms of the GNU Affero General Public License as
9-
# published by the Free Software Foundation, either version 3 of the
10-
# License, or (at your option) any later version.
11-
# This program is distributed in the hope that it will be useful,
12-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# GNU Affero General Public License for more details.
15-
# You should have received a copy of the GNU Affero General Public License
16-
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
#
18-
##############################################################################
2+
# © 2015 Taktik (http://www.taktik.be) - Adil Houmadi <[email protected]>
3+
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5+
6+
from . import account_fiscal_position
197
from . import pos_pricelist
208
from . import point_of_sale
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from openerp import fields, models
6+
7+
8+
class AccountFiscalPositionTax(models.Model):
9+
_inherit = "account.fiscal.position.tax"
10+
11+
company_id = fields.Many2one(
12+
related="position_id.company_id", string="Company")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<openerp>
4+
<data noupdate="1">
5+
6+
<record id="account_fiscal_position_tax_multi_company_rule" model="ir.rule">
7+
<field name="name">Account fiscal position tax multi-company</field>
8+
<field name="model_id" ref="model_account_fiscal_position_tax"/>
9+
<field name="domain_force">['|', ('company_id', '=', False), ('company_id', 'child_of', [user.company_id.id])]</field>
10+
</record>
11+
12+
</data>
13+
</openerp>

0 commit comments

Comments
 (0)