forked from OCA/multi-company
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'refs/pull/267/head' of github.com:OCA/multi-company int…
…o merge-branch-2805-MDS-52-7d27fc33
- Loading branch information
Showing
12 changed files
with
221 additions
and
0 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,85 @@ | ||
========================== | ||
Pos Category multi-company | ||
========================== | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmulti--company-lightgray.png?logo=github | ||
:target: https://github.com/OCA/multi-company/tree/13.0/pos_category_multi_company | ||
:alt: OCA/multi-company | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/multi-company-13-0/multi-company-13-0-pos_category_multi_company | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/133/13.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This modules allows to select in which of the companies you want to use each of the pos categories. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Installation | ||
============ | ||
|
||
Just install | ||
|
||
Usage | ||
===== | ||
|
||
On the pos category form view, put the companies | ||
in which you want to use that pos category. If none is selected, the pos category will | ||
be visible in all of them. The default value is the current one. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/multi-company/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 <https://github.com/OCA/multi-company/issues/new?body=module:%20pos_category_multi_company%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Do not contact contributors directly about support or help with technical issues. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Camptocamp | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Damien Crier <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
This module is part of the `OCA/multi-company <https://github.com/OCA/multi-company/tree/13.0/pos_category_multi_company>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
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 @@ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
"name": "Pos category multi-company", | ||
"summary": "Select individually the pos categories visibility on each company", | ||
"author": "Camptocamp," "Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/multi-company", | ||
"category": "Point of Sale", | ||
"version": "13.0.1.0.0", | ||
"license": "AGPL-3", | ||
"depends": ["base_multi_company", "point_of_sale"], | ||
"data": ["views/pos_category_view.xml"], | ||
} |
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,4 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import pos_category |
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,9 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class PosCategory(models.Model): | ||
_inherit = ["multi.company.abstract", "pos.category"] | ||
_name = "pos.category" |
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 @@ | ||
* Damien Crier <[email protected]> |
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 @@ | ||
This modules allows to select in which of the companies you want to use each of the pos categories. |
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 @@ | ||
Just install it |
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 @@ | ||
On the pos category form view, put the companies | ||
in which you want to use that pos category. If none is selected, the pos category will | ||
be visible in all of them. The default value is the current one. |
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 @@ | ||
from . import test_pos_category_multi_company |
78 changes: 78 additions & 0 deletions
78
pos_category_multi_company/tests/test_pos_category_multi_company.py
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,78 @@ | ||
# Copyright 2021 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.tests import common | ||
|
||
|
||
@common.at_install(False) | ||
@common.post_install(True) | ||
class TestPosCategoryMultiCompany(common.TransactionCase): | ||
def setUp(self): | ||
super().setUp() | ||
groups = self.env.ref("base.group_system") | ||
self.company_1 = self.env["res.company"].create({"name": "Test company 1"}) | ||
self.company_2 = self.env["res.company"].create({"name": "Test company 2"}) | ||
self.pos_category = self.env["pos.category"] | ||
self.pos_category_company_none = self.pos_category.create( | ||
{ | ||
"name": "Product without company", | ||
"company_ids": [(6, 0, [])], | ||
"company_id": False, | ||
} | ||
) | ||
self.pos_category_company_1 = self.pos_category.create( | ||
{ | ||
"name": "Pos category from company 1", | ||
"company_ids": [(6, 0, self.company_1.ids)], | ||
} | ||
) | ||
self.pos_category_company_2 = self.pos_category.create( | ||
{ | ||
"name": "Pos category from company 2", | ||
"company_ids": [(6, 0, self.company_2.ids)], | ||
} | ||
) | ||
self.pos_category_company_both = self.pos_category.create( | ||
{ | ||
"name": "Pos category for both companies", | ||
"company_ids": [(6, 0, (self.company_1 + self.company_2).ids)], | ||
} | ||
) | ||
self.user_company_1 = self.env["res.users"].create( | ||
{ | ||
"name": "User company 1", | ||
"login": "user_company_1", | ||
"groups_id": [(6, 0, groups.ids)], | ||
"company_id": self.company_1.id, | ||
"company_ids": [(6, 0, self.company_1.ids)], | ||
} | ||
) | ||
self.user_company_2 = self.env["res.users"].create( | ||
{ | ||
"name": "User company 2", | ||
"login": "user_company_2", | ||
"groups_id": [(6, 0, groups.ids)], | ||
"company_id": self.company_2.id, | ||
"company_ids": [(6, 0, self.company_2.ids)], | ||
} | ||
) | ||
|
||
def test_create_pos_category(self): | ||
pos_category = self.pos_category.create({"name": "Test"}) | ||
company = self.env.company | ||
self.assertTrue(company.id in pos_category.company_ids.ids) | ||
|
||
def test_company_none(self): | ||
self.assertFalse(self.pos_category_company_none.company_id) | ||
|
||
def test_company_1(self): | ||
self.assertEqual( | ||
self.pos_category_company_1.with_user(self.user_company_1).company_id, | ||
self.company_1, | ||
) | ||
|
||
def test_company_2(self): | ||
self.assertEqual( | ||
self.pos_category_company_2.with_user(self.user_company_2).company_id, | ||
self.company_2, | ||
) |
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,23 @@ | ||
<?xml version="1.0" ?> | ||
<odoo> | ||
<record model="ir.ui.view" id="pos_category_form_view"> | ||
<field name="name">Pos category form view (with multi-company)</field> | ||
<field name="model">pos.category</field> | ||
<field name="inherit_id" ref="point_of_sale.product_pos_category_form_view" /> | ||
<field name="arch" type="xml"> | ||
<field name="sequence" position="after"> | ||
<field | ||
name="company_ids" | ||
groups="base.group_multi_company" | ||
widget="many2many_tags" | ||
options="{'no_create': True}" | ||
/> | ||
<field | ||
name="company_id" | ||
groups="base.group_multi_company" | ||
options="{'no_create': True}" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |