-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] fieldservice_sale: Migration to 16.0
Co-Authored-By: Alexandre Fayolle, Stefan Ungureanu Dependency on migration of fieldservice_account: #1042 Refactoring and fix view errors Fix view error (obsolete XMLID) Remove obsolete onchange Update unit tests
- Loading branch information
1 parent
20dc4d8
commit 1735f9c
Showing
15 changed files
with
170 additions
and
184 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 |
---|---|---|
|
@@ -14,14 +14,14 @@ Field Service - Sales | |
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Ffield--service-lightgray.png?logo=github | ||
:target: https://github.com/OCA/field-service/tree/15.0/fieldservice_sale | ||
:target: https://github.com/OCA/field-service/tree/16.0/fieldservice_sale | ||
:alt: OCA/field-service | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/field-service-15-0/field-service-15-0-fieldservice_sale | ||
:target: https://translation.odoo-community.org/projects/field-service-16-0/field-service-16-0-fieldservice_sale | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/264/15.0 | ||
:alt: Try me on Runbot | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/field-service&target_branch=16.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
|
@@ -99,7 +99,7 @@ Bug Tracker | |
Bugs are tracked on `GitHub Issues <https://github.com/OCA/field-service/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/field-service/issues/new?body=module:%20fieldservice_sale%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
`feedback <https://github.com/OCA/field-service/issues/new?body=module:%20fieldservice_sale%0Aversion:%2016.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. | ||
|
||
|
@@ -126,6 +126,10 @@ Contributors | |
* Rapha??l Reverdy <[email protected]> | ||
* Cl??ment Mombereau <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Stefan Ungureanu | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
|
@@ -153,6 +157,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__: | |
|
||
|maintainer-wolfhall| |maintainer-max3903| |maintainer-brian10048| | ||
|
||
This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/15.0/fieldservice_sale>`_ project on GitHub. | ||
This module is part of the `OCA/field-service <https://github.com/OCA/field-service/tree/16.0/fieldservice_sale>`_ 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
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
* Brian McMaster <[email protected]> | ||
* Rapha??l Reverdy <[email protected]> | ||
* Cl??ment Mombereau <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`_: | ||
|
||
* Stefan Ungureanu |
7 changes: 4 additions & 3 deletions
7
...dservice_sale/data/fsm_template_group.xml → fieldservice_sale/security/res_groups.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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<!-- Activate the FSM Template Group by default --> | ||
<record id="base.group_user" model="res.groups"> | ||
<field | ||
<record id="base.group_user" model="res.groups"> | ||
<field | ||
name="implied_ids" | ||
eval="[(4, ref('fieldservice.group_fsm_template'))]" | ||
/> | ||
</record> | ||
</record> | ||
|
||
</odoo> |
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
98 changes: 98 additions & 0 deletions
98
fieldservice_sale/tests/test_fsm_sale_autofill_location.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,98 @@ | ||
# Copyright (C) 2019 Clément Mombereau (Akretion) | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html) | ||
from odoo.tests.common import Form, TransactionCase | ||
|
||
|
||
class FSMSale(TransactionCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
"""Create 3 related partners : a parent company, a child partner and | ||
a child shipping partner. | ||
For each test, a different partner is a fsm_location. | ||
A SO is created with the child partner as customer. The test run | ||
the SO's location autofill and check if the fsm_location_id | ||
is the expected one. | ||
""" | ||
super().setUpClass() | ||
# create a parent company | ||
cls.commercial_partner = cls.env["res.partner"].create( | ||
{"name": "Company Commercial Partner", "is_company": True} | ||
) | ||
# create a child partner | ||
cls.partner = cls.env["res.partner"].create( | ||
{"name": "Child Partner 1", "parent_id": cls.commercial_partner.id} | ||
) | ||
# create a child partner shipping address | ||
cls.shipping_partner = cls.env["res.partner"].create( | ||
{ | ||
"name": "Shipping Partner", | ||
"parent_id": cls.commercial_partner.id, | ||
"type": "delivery", | ||
} | ||
) | ||
# Demo FS location | ||
cls.location1 = cls.env.ref("fieldservice.location_1") | ||
cls.location2 = cls.env.ref("fieldservice.location_2") | ||
cls.location3 = cls.env.ref("fieldservice.location_3") | ||
|
||
def test_00_autofill_so_fsm_location(self): | ||
"""Check location autofill from SO partner | ||
SO partner is an FSM location linked to location 2 => expect location2 | ||
(location 1 and 3 are ignored because we want only location explicitly | ||
linked to the partner) | ||
""" | ||
self.partner.fsm_location = True | ||
self.location1.partner_id = self.commercial_partner | ||
self.location2.partner_id = self.partner | ||
self.location3.partner_id = self.shipping_partner | ||
with Form(self.env["sale.order"]) as so_form: | ||
so_form.partner_id = self.partner | ||
so = so_form.save() | ||
self.assertEqual(so.fsm_location_id, self.location2) | ||
|
||
def test_01_autofill_so_fsm_location(self): | ||
"""Check location autofill from SO partner | ||
SO partner is not an FSM location defined, but location1 is linked to | ||
its commercial partner => expect location 1 (because of ordering) | ||
""" | ||
self.partner.fsm_location = False | ||
self.location1.partner_id = self.commercial_partner | ||
self.location2.partner_id = self.partner | ||
self.location3.partner_id = self.shipping_partner | ||
with Form(self.env["sale.order"]) as so_form: | ||
so_form.partner_id = self.partner | ||
so = so_form.save() | ||
self.assertEqual(so.fsm_location_id, self.location1) | ||
|
||
def test_02_autofill_so_fsm_location(self): | ||
"""Check location autofill from SO partner | ||
SO partner is not an FSM location defined, but location1 is linked to | ||
the partner itself => expect location 1 (because of ordering) | ||
""" | ||
self.partner.fsm_location = False | ||
self.location1.partner_id = self.partner | ||
self.location2.partner_id = self.shipping_partner | ||
self.location3.partner_id = self.commercial_partner | ||
with Form(self.env["sale.order"]) as so_form: | ||
so_form.partner_id = self.partner | ||
so = so_form.save() | ||
self.assertEqual(so.fsm_location_id, self.location1) | ||
|
||
def test_03_autofill_so_fsm_location(self): | ||
"""Check location autofill from SO partner | ||
SO partner is not an FSM location defined, but location1 is linked to | ||
its shipping partner => expect location 1 (because of ordering) | ||
""" | ||
self.partner.fsm_location = False | ||
self.location1.partner_id = self.shipping_partner | ||
self.location2.partner_id = self.commercial_partner | ||
self.location3.partner_id = self.partner | ||
with Form(self.env["sale.order"]) as so_form: | ||
so_form.partner_id = self.partner | ||
so = so_form.save() | ||
self.assertEqual(so.fsm_location_id, self.location1) |
Oops, something went wrong.