diff --git a/joint_buying_account/i18n/fr.po b/joint_buying_account/i18n/fr.po
index 0af35237..68020581 100644
--- a/joint_buying_account/i18n/fr.po
+++ b/joint_buying_account/i18n/fr.po
@@ -16,7 +16,7 @@ msgstr ""
"Plural-Forms: \n"
#. module: joint_buying_account
-#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:179
+#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:195
#, python-format
msgid "\n"
"- Non-commissioned sale: %s ; %.2f €"
@@ -50,7 +50,7 @@ msgid "Commission VAT 20% Excl"
msgstr "Commission 20% HT"
#. module: joint_buying_account
-#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:165
+#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:181
#, python-format
msgid "Commission on %s deposited on %s\n"
"- Ordered Amount : %.2f €\n"
@@ -118,13 +118,13 @@ msgid "ID"
msgstr ""
#. module: joint_buying_account
-#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:124
+#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:139
#, python-format
msgid "Incorrect fiscal settings block the possibility to generate commission invoices : Incorrect tax type on the tax %s"
msgstr "Le paramétrage fiscal incorrect empêche de générer des factures de commission : type de taxe incorrect sur la taxe %s"
#. module: joint_buying_account
-#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:114
+#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:129
#, python-format
msgid "Incorrect fiscal settings block the possibility to generate commission invoices : Too many taxes %s"
msgstr "Le paramétrage fiscal incorrect empêche de générer des factures de commissions : Trop de taxes %s"
@@ -245,7 +245,7 @@ msgid "Wizard"
msgstr "Assistant"
#. module: joint_buying_account
-#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:196
+#: code:addons/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py:212
#, python-format
msgid "You should define a local partner for the supplier %s."
msgstr "Vous devez définir un partenaire local pour le fournisseur %s."
diff --git a/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py b/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py
index 7429fb63..78dbd0ea 100644
--- a/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py
+++ b/joint_buying_account/wizards/joint_buying_invoice_commission_wizard_line.py
@@ -50,6 +50,17 @@ class JointbuyingInvoiceCommissionWizardLine(models.TransientModel):
string="Detail", compute="_compute_grouped_order_info"
)
+ def datetime_to_string(self, dt, partner=False):
+ if not partner or not partner.lang:
+ partner = self.env.user.partner_id
+ if not partner or not partner.lang:
+ partner = self.env.user.company_id.partner_id
+ lang = self.env["res.lang"].search([("code", "=", partner.lang)])
+ date_tz_user = fields.Datetime.context_timestamp(
+ self, fields.Datetime.from_string(dt)
+ )
+ return date_tz_user.strftime(lang.date_format)
+
@api.depends("wizard_id.max_deposit_date", "partner_id")
def _compute_grouped_order_info(self):
for line in self:
@@ -63,7 +74,7 @@ def _compute_grouped_order_info(self):
)
line.grouped_order_detail = "\n".join(
[
- f"- {x['name']} - {x['deposit_date'].strftime('%m/%d/%Y')}"
+ f"- {x['name']} - {self.datetime_to_string(x['deposit_date'])}"
f" - {x['amount_untaxed']:.2f} €"
for x in all_data
]
@@ -166,6 +177,7 @@ def _prepare_invoice_line(self, invoice, grouped_order):
and x.amount_untaxed != 0.0
)
base = sum(valid_orders.mapped("amount_untaxed"))
+
description = _(
"Commission on %s deposited on %s\n"
"- Ordered Amount : %.2f €\n"
@@ -173,7 +185,7 @@ def _prepare_invoice_line(self, invoice, grouped_order):
"- Rate : %.2f %%"
) % (
grouped_order.name,
- grouped_order.deposit_date.strftime("%m/%d/%Y"),
+ self.datetime_to_string(grouped_order.deposit_date, self.local_partner_id),
base,
len(valid_orders),
"-".join(valid_orders.mapped("customer_id.joint_buying_code")),
diff --git a/joint_buying_base/__manifest__.py b/joint_buying_base/__manifest__.py
index bb4879e6..ffe03781 100644
--- a/joint_buying_base/__manifest__.py
+++ b/joint_buying_base/__manifest__.py
@@ -3,7 +3,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Joint Buying - Base",
- "version": "12.0.6.2.0",
+ "version": "12.0.7.0.0",
"category": "GRAP - Logistics",
"author": "GRAP,La Jardinière,Hashbang",
"website": "https://github.com/grap/odoo-addons-logistics",
diff --git a/joint_buying_base/i18n/fr.po b/joint_buying_base/i18n/fr.po
index 75b1e6ba..6fc84164 100644
--- a/joint_buying_base/i18n/fr.po
+++ b/joint_buying_base/i18n/fr.po
@@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-12-13 20:27+0000\n"
-"PO-Revision-Date: 2023-12-13 20:27+0000\n"
+"POT-Creation-Date: 2024-04-05 10:18+0000\n"
+"PO-Revision-Date: 2024-04-05 10:18+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
@@ -16,7 +16,7 @@ msgstr ""
"Plural-Forms: \n"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:310
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:288
#, python-format
msgid "%s (copy)"
msgstr "%s (copie)"
@@ -32,19 +32,19 @@ msgid "Company Address:"
msgstr "Adresse de la société:"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:241
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:205
#, python-format
msgid "Delivery and pick-up"
msgstr "Livraison et retrait"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:237
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:201
#, python-format
msgid "Truck loading"
msgstr "Chargement du camion"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:239
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:203
#, python-format
msgid "Truck unloading"
msgstr "Déchargement du camion"
@@ -65,7 +65,7 @@ msgid " ( On "
msgstr " ( Dans "
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:234
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:198
#, python-format
msgid "Pause"
msgstr ""
@@ -102,7 +102,17 @@ msgstr "Durée"
#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.report_joint_buying_tour_document
-msgid "Payload (kg)"
+msgid "Loaded Amount Untaxed"
+msgstr "Montant HT chargé"
+
+#. module: joint_buying_base
+#: model_terms:ir.ui.view,arch_db:joint_buying_base.report_joint_buying_tour_document
+msgid "Loaded Weight"
+msgstr "Poids chargé"
+
+#. module: joint_buying_base
+#: model_terms:ir.ui.view,arch_db:joint_buying_base.report_joint_buying_tour_document
+msgid "Payload"
msgstr "Charge Utile (kg)"
#. module: joint_buying_base
@@ -262,6 +272,7 @@ msgstr "Annuler"
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__carrier_id
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour_type__carrier_id
+#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_tour_search
msgid "Carrier"
msgstr "Transporteur"
@@ -328,11 +339,6 @@ msgstr "Code affiché pour la tournée"
msgid "Commission"
msgstr ""
-#. module: joint_buying_base
-#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_res_partner_form
-msgid "Commission Agreement"
-msgstr "Accord de commission"
-
#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_res_partner_form
msgid "Commission Rate"
@@ -402,11 +408,6 @@ msgstr "Étiquettes de contact"
msgid "Cost"
msgstr "Coût"
-#. module: joint_buying_base
-#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__cost_chart
-msgid "Cost Chart"
-msgstr "Graphique des coûts"
-
#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_tour_form
msgid "Cost allocation"
@@ -459,6 +460,7 @@ msgstr "Devise"
#: model:res.company,overdue_msg:joint_buying_base.company_CRB
#: model:res.company,overdue_msg:joint_buying_base.company_EDC
#: model:res.company,overdue_msg:joint_buying_base.company_ELD
+#: model:res.company,overdue_msg:joint_buying_base.company_LOG
#: model:res.company,overdue_msg:joint_buying_base.company_LSE
#: model:res.company,overdue_msg:joint_buying_base.company_PZI
#: model:res.company,overdue_msg:joint_buying_base.company_TOU
@@ -524,7 +526,7 @@ msgid "Distance"
msgstr ""
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:133
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:139
#, python-format
msgid "Draft Tour"
msgstr "Tournée en brouillon"
@@ -860,7 +862,7 @@ msgid "Journey"
msgstr "Trajet"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:229
+#: code:addons/joint_buying_base/models/joint_buying_tour.py:193
#, python-format
msgid "Journey from %s to %s"
msgstr "Trajet de %s à %s"
@@ -929,6 +931,16 @@ msgstr "Ligne"
msgid "Load"
msgstr "Charger"
+#. module: joint_buying_base
+#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__loaded_amount_untaxed
+msgid "Loaded Amount Untaxed"
+msgstr "Montant HT chargé"
+
+#. module: joint_buying_base
+#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__loaded_weight
+msgid "Loaded Weight"
+msgstr "Poids chargé"
+
#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.report_joint_buying_tour_document_request_lines
msgid "Loading"
@@ -953,7 +965,7 @@ msgid "Manager"
msgstr "Gestionnaire"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_transport_request.py:198
+#: code:addons/joint_buying_base/models/joint_buying_transport_request.py:213
#: selection:joint.buying.transport.request,request_type:0
#, python-format
msgid "Manual"
@@ -964,6 +976,11 @@ msgstr "Manuel"
msgid "Manual Description"
msgstr "Description (Manuelle)"
+#. module: joint_buying_base
+#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_transport_request__manual_supplier_id
+msgid "Manual Supplier"
+msgstr "Fournisseur manuel"
+
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_carrier__message_has_error
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__message_has_error
@@ -1125,8 +1142,8 @@ msgstr "Planifiée"
#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_transport_request_search
-msgid "Positive Amount"
-msgstr "Montant positif"
+msgid "Positive Amount or Manual"
+msgstr "Montant positif ou Demande manuelle"
#. module: joint_buying_base
#: model:res.partner.category,name:joint_buying_base.partner_category_poultry
@@ -1140,6 +1157,7 @@ msgstr "Demande"
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_transport_request__request_type
+#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_transport_request_search
msgid "Request Type"
msgstr "Type de demande"
@@ -1158,12 +1176,6 @@ msgid "Route information is given as an indication only!
\n"
msgstr "Les prévisions de trajets sont données à titre indicatif seulement !
\n"
" Il peut y avoir des bouchons, des retards, des imprévus, etc..."
-#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:161
-#, python-format
-msgid "Salary"
-msgstr "Salaire"
-
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__salary_cost
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour_line__salary_cost
@@ -1173,7 +1185,7 @@ msgstr "Coût des salaires"
#. module: joint_buying_base
#: selection:joint.buying.transport.request,request_type:0
msgid "Sale Order"
-msgstr "Commande de vente"
+msgstr "Bon de commande"
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour_line__sequence
@@ -1301,6 +1313,7 @@ msgid "Summary"
msgstr "Résumé"
#. module: joint_buying_base
+#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_transport_request__supplier_id
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_res_partner_form
msgid "Supplier"
msgstr "Fournisseur"
@@ -1368,12 +1381,6 @@ msgstr "A calculer"
msgid "Today"
msgstr "Aujourd'hui"
-#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:163
-#, python-format
-msgid "Toll"
-msgstr "Péage"
-
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__toll_cost
msgid "Toll Cost"
@@ -1468,6 +1475,7 @@ msgstr "Texte d'arbre"
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__type_id
+#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_tour_search
msgid "Type"
msgstr ""
@@ -1529,12 +1537,6 @@ msgstr "Utilisateurs"
msgid "Vegetable"
msgstr "Légumes"
-#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/joint_buying_tour.py:162
-#, python-format
-msgid "Vehicle"
-msgstr "Véhicule"
-
#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__vehicle_cost
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour_line__vehicle_cost
@@ -1573,7 +1575,7 @@ msgid "Wizard"
msgstr "Assistant"
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/res_partner.py:155
+#: code:addons/joint_buying_base/models/res_partner.py:145
#, python-format
msgid "You can not create a customer joint buying partner. You should ask to you ERP manager to do it via the creation of a company."
msgstr "Vous ne pouvez pas créer un client pour les commandes groupées. Vous devez demander au responsable de l'ERP de le faire, via la création d'une société."
@@ -1597,13 +1599,13 @@ msgid "You can not create this item. Please ask to the logistic Manager."
msgstr "Vous ne pouvez pas créer cet élément. Veuillez demander au responsable logistique."
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/res_partner.py:265
+#: code:addons/joint_buying_base/models/res_partner.py:255
#, python-format
msgid "You can not delete this partner because it is related to a company for joint Buyings. Please archive it."
msgstr "Vous ne pouvez pas supprimer ce contact, car il est lié à une société pour les commandes groupées. Vous pouvez simplement l'archiver."
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/res_partner.py:140
+#: code:addons/joint_buying_base/models/res_partner.py:130
#, python-format
msgid "You can not link the supplier %s to the Joint Buying partner %s because you have other suppliers that are still related to him : \n"
"\n"
@@ -1631,7 +1633,7 @@ msgid "You can not update this item because you are not responsible for it"
msgstr "Vous ne pouvez pas mettre à jour cet élément, car vous n'en êtes pas responsable."
#. module: joint_buying_base
-#: code:addons/joint_buying_base/models/res_partner.py:254
+#: code:addons/joint_buying_base/models/res_partner.py:244
#, python-format
msgid "You can not update this partner this way you should ask to your ERP Manager to update this field via the related company."
msgstr "Vous ne pouvez pas mettre à jour ce contact de cette manière, vous devez demander au responsable de votre ERP de mettre à jour les données, via la société associée."
diff --git a/joint_buying_base/migrations/12.0.7.0.0/end-migration.py b/joint_buying_base/migrations/12.0.7.0.0/end-migration.py
new file mode 100644
index 00000000..3561c0ba
--- /dev/null
+++ b/joint_buying_base/migrations/12.0.7.0.0/end-migration.py
@@ -0,0 +1,15 @@
+import logging
+
+from openupgradelib import openupgrade
+
+_logger = logging.getLogger(__name__)
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+ TransportRequest = env["joint.buying.transport.request"]
+ requests = TransportRequest.search([])
+ _logger.info(f"Recompute Supplier field for {len(requests)} transport requests ...")
+ requests._compute_supplier_id()
+ _logger.info(f"Recompute Request Type for {len(requests)} transport requests ...")
+ requests._compute_request_type()
diff --git a/joint_buying_base/migrations/12.0.7.0.0/pre-migration.py b/joint_buying_base/migrations/12.0.7.0.0/pre-migration.py
new file mode 100644
index 00000000..a517f3b8
--- /dev/null
+++ b/joint_buying_base/migrations/12.0.7.0.0/pre-migration.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2024-Today: GRAP (http://www.grap.coop)
+# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
+
+import logging
+
+from openupgradelib import openupgrade
+
+_logger = logging.getLogger(__name__)
+
+
+@openupgrade.migrate()
+def migrate(env, version):
+
+ _logger.info(
+ "Fix bad computation of joint_buying_transport_request.start_date field."
+ )
+ openupgrade.logged_query(
+ env.cr,
+ """
+ UPDATE joint_buying_transport_request tr_main
+ SET start_date = tmp.min_start_date
+ FROM (
+ SELECT tr.id as transport_request_id,
+ min(tl.start_date) as min_start_date
+ FROM joint_buying_transport_request tr
+ INNER JOIN joint_buying_transport_request_line trl
+ ON trl.request_id = tr.id
+ INNER JOIN joint_buying_tour_line tl
+ ON tl.id = trl.tour_line_id
+ WHERE tr.state = 'computed'
+ GROUP BY tr.id
+ ) as tmp
+ WHERE
+ tr_main.id = tmp.transport_request_id
+ AND tr_main.start_date != tmp.min_start_date;
+ """,
+ )
diff --git a/joint_buying_base/models/joint_buying_tour.py b/joint_buying_base/models/joint_buying_tour.py
index 0a3884a1..51a6f6d7 100644
--- a/joint_buying_base/models/joint_buying_tour.py
+++ b/joint_buying_base/models/joint_buying_tour.py
@@ -7,6 +7,8 @@
from odoo import _, api, fields, models
+from odoo.addons import decimal_precision as dp
+
from .res_partner import _JOINT_BUYING_PARTNER_CONTEXT
@@ -100,6 +102,18 @@ class JointBuyingTour(models.Model):
" passes through the current company.",
)
+ loaded_weight = fields.Float(
+ compute="_compute_loaded_data",
+ digits=dp.get_precision("Stock Weight"),
+ store=True,
+ )
+
+ loaded_amount_untaxed = fields.Float(
+ compute="_compute_loaded_data",
+ digits=dp.get_precision("Product Price"),
+ store=True,
+ )
+
@api.onchange("type_id")
def _onchange_type_id(self):
if self.type_id and self.type_id.carrier_id:
@@ -228,6 +242,20 @@ def _compute_points(self):
tour.starting_point_id = journey_lines[0].starting_point_id
tour.arrival_point_id = journey_lines[-1].arrival_point_id
+ @api.depends(
+ "line_ids.transport_request_line_ids.request_id.total_weight",
+ "line_ids.transport_request_line_ids.request_id.amount_untaxed",
+ )
+ def _compute_loaded_data(self):
+ for tour in self:
+ requests = tour.mapped("line_ids.transport_request_line_ids.request_id")
+ data = requests.search_read(
+ domain=[("id", "in", requests.ids)],
+ fields=["total_weight", "amount_untaxed"],
+ )
+ tour.loaded_weight = sum([x["total_weight"] for x in data])
+ tour.loaded_amount_untaxed = sum([x["amount_untaxed"] for x in data])
+
@api.depends("line_ids.starting_point_id", "line_ids.arrival_point_id")
def _compute_is_on_my_way(self):
current_partner = self.env.user.company_id.joint_buying_partner_id
diff --git a/joint_buying_base/models/joint_buying_transport_request.py b/joint_buying_base/models/joint_buying_transport_request.py
index 43e4e373..1b12df0d 100644
--- a/joint_buying_base/models/joint_buying_transport_request.py
+++ b/joint_buying_base/models/joint_buying_transport_request.py
@@ -15,6 +15,7 @@ class JointBuyingTransportRequest(models.Model):
_name = "joint.buying.transport.request"
_inherit = ["mail.thread", "mail.activity.mixin"]
_description = "Joint Buying Transport Request"
+ _order = "availability_date desc, supplier_id"
_INVALIDATE_VALS = {
"start_date": False,
@@ -33,8 +34,8 @@ class JointBuyingTransportRequest(models.Model):
request_type = fields.Selection(
selection=[("manual", "Manual")],
- required=True,
compute="_compute_request_type",
+ store=True,
)
origin = fields.Char(compute="_compute_origin", store=True)
@@ -51,10 +52,21 @@ class JointBuyingTransportRequest(models.Model):
track_visibility=True,
)
- manual_availability_date = fields.Datetime(
- string="Availability Date (Manual)",
+ manual_supplier_id = fields.Many2one(
+ comodel_name="res.partner",
+ context=_JOINT_BUYING_PARTNER_CONTEXT,
+ )
+
+ supplier_id = fields.Many2one(
+ comodel_name="res.partner",
+ context=_JOINT_BUYING_PARTNER_CONTEXT,
+ compute="_compute_supplier_id",
+ store=True,
+ track_visibility=True,
)
+ manual_availability_date = fields.Datetime(string="Availability Date (Manual)")
+
availability_date = fields.Datetime(
string="Availability Date",
compute="_compute_availability_date",
@@ -151,12 +163,18 @@ def write(self, vals):
vals.update(self._INVALIDATE_VALS)
return super().write(vals)
- def _get_depends_origin(self):
+ def _get_depends_request_type(self):
return ["state"] # fake, to make dependency working
- def _get_depends_request_type(self):
+ def _get_depends_can_change(self):
+ return ["state"] # fake, to make dependency working
+
+ def _get_depends_origin(self):
return ["state"] # fake, to make dependency working
+ def _get_depends_supplier_id(self):
+ return ["manual_supplier_id"]
+
def _get_depends_availability_date(self):
return ["manual_availability_date"]
@@ -175,9 +193,6 @@ def _get_depends_total_weight(self):
def _get_depends_description(self):
return ["manual_description"]
- def _get_depends_can_change(self):
- return ["state"] # fake, to make dependency working
-
@api.depends("start_partner_id", "arrival_partner_id", "availability_date")
def _compute_name(self):
for request in self:
@@ -202,6 +217,11 @@ def _compute_request_type(self):
for request in self:
request.request_type = "manual"
+ @api.depends(lambda x: x._get_depends_supplier_id())
+ def _compute_supplier_id(self):
+ for request in self:
+ request.supplier_id = request.manual_supplier_id
+
@api.depends(lambda x: x._get_depends_availability_date())
def _compute_availability_date(self):
for request in self:
@@ -271,7 +291,7 @@ def _set_tour_lines(self, tour_lines):
self.write(
{
- "start_date": max(tour_lines.mapped("start_date")),
+ "start_date": min(tour_lines.mapped("start_date")),
"arrival_date": max(tour_lines.mapped("arrival_date")),
"state": "computed",
"line_ids": [(5,)] + [(0, 0, x) for x in line_vals],
diff --git a/joint_buying_base/reports/report_joint_buying_tour.xml b/joint_buying_base/reports/report_joint_buying_tour.xml
index 27e1d6dd..8d57ff18 100644
--- a/joint_buying_base/reports/report_joint_buying_tour.xml
+++ b/joint_buying_base/reports/report_joint_buying_tour.xml
@@ -82,26 +82,37 @@
-
kg
+km
+kg
€