diff --git a/joint_buying_base/demo/joint_buying_carrier.xml b/joint_buying_base/demo/joint_buying_carrier.xml
index b86724a9..acb3edbe 100644
--- a/joint_buying_base/demo/joint_buying_carrier.xml
+++ b/joint_buying_base/demo/joint_buying_carrier.xml
@@ -24,4 +24,10 @@
+
+
diff --git a/joint_buying_base/demo/joint_buying_tour.xml b/joint_buying_base/demo/joint_buying_tour.xml
index ba73d682..5e3b7829 100644
--- a/joint_buying_base/demo/joint_buying_tour.xml
+++ b/joint_buying_base/demo/joint_buying_tour.xml
@@ -128,6 +128,35 @@
+
+
+
+
+
+ Lyon - Loire
+
+
+
+
+
+
+ 1
+ handling
+
+
+
+
+
+ 2
+ journey
+
+ 122
+
+
+
+
+
+
diff --git a/joint_buying_base/demo/joint_buying_tour_type.xml b/joint_buying_base/demo/joint_buying_tour_type.xml
index 93179e91..c8a03740 100644
--- a/joint_buying_base/demo/joint_buying_tour_type.xml
+++ b/joint_buying_base/demo/joint_buying_tour_type.xml
@@ -37,4 +37,9 @@
+
+
diff --git a/joint_buying_base/demo/joint_buying_transport_request.xml b/joint_buying_base/demo/joint_buying_transport_request.xml
index f4f66103..2e87b1ab 100644
--- a/joint_buying_base/demo/joint_buying_transport_request.xml
+++ b/joint_buying_base/demo/joint_buying_transport_request.xml
@@ -58,6 +58,18 @@
]]>
+
+
+
+
+ 1000
+ 200
+ GOU
+ ]]>
+
+
+
@@ -74,6 +86,7 @@
ref('joint_buying_base.request_vev_cda_week_1'),
ref('joint_buying_base.request_vev_che_week_1'),
ref('joint_buying_base.request_vev_edc_week_1'),
+ ref('joint_buying_base.request_vev_gou_week_1'),
ref('joint_buying_base.request_vev_fumet_dombes_week_1'),
ref('joint_buying_base.request_vev_che_week_2'),
]"/>
diff --git a/joint_buying_base/demo/res_company.xml b/joint_buying_base/demo/res_company.xml
index 6d3d95ca..bd097e6d 100644
--- a/joint_buying_base/demo/res_company.xml
+++ b/joint_buying_base/demo/res_company.xml
@@ -110,6 +110,19 @@
+
+ GOU
+ [GOU - Taste of Kids]
+ no-spam@goutchou.fr/
+ Avenue du 8 Mai
+ Saint Just La Pendue
+ 42540
+
+ 45.8915716
+ 4.2352806
+
+
+
LSE
[LSE - The Super Mall]
diff --git a/joint_buying_base/demo/res_users.xml b/joint_buying_base/demo/res_users.xml
index 6e0d5ad1..8849083b 100644
--- a/joint_buying_base/demo/res_users.xml
+++ b/joint_buying_base/demo/res_users.xml
@@ -27,6 +27,7 @@
(4, ref('joint_buying_base.company_CRB')),
(4, ref('joint_buying_base.company_EDC')),
(4, ref('joint_buying_base.company_ELD')),
+ (4, ref('joint_buying_base.company_GOU')),
(4, ref('joint_buying_base.company_LSE')),
(4, ref('joint_buying_base.company_LOG')),
(4, ref('joint_buying_base.company_PZI')),
diff --git a/joint_buying_base/static/img/company_GOU-logo.png b/joint_buying_base/static/img/company_GOU-logo.png
new file mode 100644
index 00000000..fcf95a94
Binary files /dev/null and b/joint_buying_base/static/img/company_GOU-logo.png differ
diff --git a/joint_buying_base/wizards/joint_buying_wizard_find_route.py b/joint_buying_base/wizards/joint_buying_wizard_find_route.py
index 2513b5de..493d748c 100644
--- a/joint_buying_base/wizards/joint_buying_wizard_find_route.py
+++ b/joint_buying_base/wizards/joint_buying_wizard_find_route.py
@@ -253,12 +253,12 @@ def _populate_tree(self, transport_request):
transport_request.arrival_partner_id,
)
- # we've arrived at our destination!
- if (
- found_line.arrival_point_id
- == transport_request.arrival_partner_id
- ):
- return tree
+ # # we've arrived at our destination!
+ # if (
+ # found_line.arrival_point_id
+ # == transport_request.arrival_partner_id
+ # ):
+ # return tree
return tree
@@ -274,6 +274,8 @@ def _get_interesting_route(self, tour, from_line, destination, excludes):
]
# The destination is present in the available lines, directly return
+ # Exemple: tour is A -> B -> C -> D -> E and destination is D,
+ # return D.
if destination in [x.arrival_point_id for x in available_lines]:
return available_lines
diff --git a/joint_buying_product/models/product_product.py b/joint_buying_product/models/product_product.py
index 525edad2..6809cb5d 100644
--- a/joint_buying_product/models/product_product.py
+++ b/joint_buying_product/models/product_product.py
@@ -5,7 +5,7 @@
from datetime import timedelta
from odoo import _, api, fields, models
-from odoo.exceptions import ValidationError
+from odoo.exceptions import AccessError, ValidationError
from odoo.addons.joint_buying_base.models.res_partner import (
_JOINT_BUYING_PARTNER_CONTEXT,
@@ -171,8 +171,17 @@ def set_joint_buying_local_product_id(self, new_local_product):
if current_local_product == new_local_product:
# Nothing change
return
- if current_local_product:
- raise ValidationError(_("Unimplemented Feature"))
+ if (
+ current_local_product
+ and current_local_product.company_id.joint_buying_partner_id
+ == self.joint_buying_partner_id
+ ):
+ raise ValidationError(
+ _(
+ "You can not change the relation between a global product"
+ " and a local product if you sale it."
+ )
+ )
new_local_product.joint_buying_product_id = self and self.id
@api.model
@@ -209,10 +218,21 @@ def create_joint_buying_product(self):
def update_joint_buying_product(self):
products = self.filtered(lambda x: (x.joint_buying_product_id))
for product in products:
+
vals = product._prepare_joint_buying_product("update")
global_product = product.joint_buying_product_id.with_context(
joint_buying=True, joint_buying_local_to_global=True
)
+ if (
+ product.company_id.joint_buying_partner_id
+ != global_product.joint_buying_partner_id
+ ):
+ raise AccessError(
+ _(
+ "You can not update the data of the product that belong to %s."
+ % global_product.joint_buying_partner_id.name
+ )
+ )
global_product.write(vals)
def _prepare_joint_buying_product(self, action):