Skip to content

Commit

Permalink
Merge PR #84 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Dec 19, 2023
2 parents 9542fab + 66ea13f commit 68f7ff9
Show file tree
Hide file tree
Showing 12 changed files with 190 additions and 95 deletions.
70 changes: 43 additions & 27 deletions joint_buying_base/i18n/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-04 21:11+0000\n"
"PO-Revision-Date: 2023-09-04 21:11+0000\n"
"POT-Creation-Date: 2023-12-13 20:27+0000\n"
"PO-Revision-Date: 2023-12-13 20:27+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand All @@ -16,7 +16,7 @@ msgstr ""
"Plural-Forms: \n"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:279
#: code:addons/joint_buying_base/models/joint_buying_tour.py:310
#, python-format
msgid "%s (copy)"
msgstr "%s (copie)"
Expand All @@ -32,19 +32,19 @@ msgid "<b>Company Address:</b>"
msgstr "<b>Adresse de la société:</b>"

#. 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:241
#, python-format
msgid "<i>Delivery and pick-up</i>"
msgstr "<i>Livraison et retrait</i>"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:230
#: code:addons/joint_buying_base/models/joint_buying_tour.py:237
#, python-format
msgid "<i>Truck loading</i>"
msgstr "<i>Chargement du camion</i>"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:232
#: code:addons/joint_buying_base/models/joint_buying_tour.py:239
#, python-format
msgid "<i>Truck unloading</i>"
msgstr "<i>Déchargement du camion</i>"
Expand All @@ -65,7 +65,7 @@ msgid "<span class=\"oe_inline\"> ( On </span>"
msgstr "<span class=\"oe_inline\"> ( Dans </span>"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:227
#: code:addons/joint_buying_base/models/joint_buying_tour.py:234
#, python-format
msgid "<span style='color: green'><b>Pause</b></span>"
msgstr ""
Expand Down Expand Up @@ -156,6 +156,12 @@ msgstr "Adresse"
msgid "All Contacts"
msgstr "Tous les contacts"

#. module: joint_buying_base
#: model:ir.actions.act_window,name:joint_buying_base.action_joint_buying_tour_all
#: model:ir.ui.menu,name:joint_buying_base.menu_joint_buying_tour_all
msgid "All Tours"
msgstr "Toutes les tournées"

#. module: joint_buying_base
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_wizard_find_route_form
msgid "Apply"
Expand Down Expand Up @@ -265,6 +271,11 @@ msgstr "Transporteur"
msgid "Carriers"
msgstr "Transporteurs"

#. module: joint_buying_base
#: model:ir.ui.menu,name:joint_buying_base.menu_catalog_main
msgid "Catalog"
msgstr "Catalogue"

#. module: joint_buying_base
#: model:ir.model.fields,help:joint_buying_base.field_res_partner__is_joint_buying_stage
#: model:ir.model.fields,help:joint_buying_base.field_res_users__is_joint_buying_stage
Expand Down Expand Up @@ -345,6 +356,7 @@ msgid "Complete Description"
msgstr "Description complète"

#. module: joint_buying_base
#: model:ir.actions.server,name:joint_buying_base.action_server_module_immediate_install
#: model_terms:ir.ui.view,arch_db:joint_buying_base.view_joint_buying_transport_request_form
msgid "Compute Route"
msgstr "Calculer l'itinéraire"
Expand Down Expand Up @@ -512,7 +524,7 @@ msgid "Distance"
msgstr ""

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:126
#: code:addons/joint_buying_base/models/joint_buying_tour.py:133
#, python-format
msgid "Draft Tour"
msgstr "Tournée en brouillon"
Expand Down Expand Up @@ -683,6 +695,11 @@ msgstr "Est une simulation différente"
msgid "Is Follower"
msgstr "Est un abonné"

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__is_on_my_way
msgid "Is On My Way"
msgstr "Passe par ici"

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_res_partner__is_joint_buying_stage
#: model:ir.model.fields,field_description:joint_buying_base.field_res_users__is_joint_buying_stage
Expand Down Expand Up @@ -849,7 +866,7 @@ msgid "Journey"
msgstr "Trajet"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:222
#: code:addons/joint_buying_base/models/joint_buying_tour.py:229
#, python-format
msgid "Journey from %s to %s"
msgstr "Trajet de %s à %s"
Expand All @@ -859,11 +876,6 @@ msgstr "Trajet de %s à %s"
msgid "Journey to"
msgstr "Trajet vers"

#. module: joint_buying_base
#: model:ir.ui.menu,name:joint_buying_base.menu_journey
msgid "Journeys"
msgstr "Trajets"

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_carrier__kilometer_cost
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__kilometer_cost
Expand Down Expand Up @@ -979,6 +991,12 @@ msgstr ""
msgid "My Suppliers"
msgstr "Mes fournisseurs"

#. module: joint_buying_base
#: model:ir.actions.act_window,name:joint_buying_base.action_joint_buying_tour_my
#: model:ir.ui.menu,name:joint_buying_base.menu_joint_buying_tour_my
msgid "My Tours"
msgstr "Mes tournées"

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_carrier__name
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_tour__name
Expand Down Expand Up @@ -1157,7 +1175,7 @@ msgstr "Les prévisions de trajets sont données à titre indicatif seulement !
" 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:154
#: code:addons/joint_buying_base/models/joint_buying_tour.py:161
#, python-format
msgid "Salary"
msgstr "Salaire"
Expand Down Expand Up @@ -1204,12 +1222,6 @@ msgstr "Configuration"
msgid "Signed"
msgstr "Signé"

#. module: joint_buying_base
#: model:ir.actions.act_window,name:joint_buying_base.action_res_partner_stage
#: model:ir.ui.menu,name:joint_buying_base.menu_res_partner_stage
msgid "Stages"
msgstr "Etapes"

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_transport_request_line__start_action_type
msgid "Start Action Type"
Expand Down Expand Up @@ -1342,6 +1354,11 @@ msgstr "Champs techniques"
msgid "Technical Information"
msgstr "Informations techniques"

#. module: joint_buying_base
#: model:ir.model.fields,help:joint_buying_base.field_joint_buying_tour__is_on_my_way
msgid "Technical field that indicates that the tour passes through the current company."
msgstr "Champ technique qui indique que la tournée passe par la société en cours."

#. module: joint_buying_base
#: model:ir.model.fields,help:joint_buying_base.field_res_partner__joint_buying_display_name_step
#: model:ir.model.fields,help:joint_buying_base.field_res_users__joint_buying_display_name_step
Expand Down Expand Up @@ -1373,7 +1390,7 @@ msgid "Today"
msgstr "Aujourd'hui"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:156
#: code:addons/joint_buying_base/models/joint_buying_tour.py:163
#, python-format
msgid "Toll"
msgstr "Péage"
Expand Down Expand Up @@ -1433,8 +1450,7 @@ msgid "Tour Types"
msgstr "Types de tournées"

#. module: joint_buying_base
#: model:ir.actions.act_window,name:joint_buying_base.action_joint_buying_tour_all
#: model:ir.ui.menu,name:joint_buying_base.menu_joint_buying_tour_all
#: model:ir.ui.menu,name:joint_buying_base.menu_tour
msgid "Tours"
msgstr "Tournées"

Expand Down Expand Up @@ -1462,9 +1478,9 @@ msgid "Transport Requests"
msgstr "Demandes de transport"

#. module: joint_buying_base
#: model:ir.ui.menu,name:joint_buying_base.menu_transport
#: model:ir.ui.menu,name:joint_buying_base.menu_transport_main
msgid "Transports"
msgstr "Transports"
msgstr ""

#. module: joint_buying_base
#: model:ir.model.fields,field_description:joint_buying_base.field_joint_buying_wizard_find_route__tree_text
Expand Down Expand Up @@ -1535,7 +1551,7 @@ msgid "Vegetable"
msgstr "Légumes"

#. module: joint_buying_base
#: code:addons/joint_buying_base/models/joint_buying_tour.py:155
#: code:addons/joint_buying_base/models/joint_buying_tour.py:162
#, python-format
msgid "Vehicle"
msgstr "Véhicule"
Expand Down
37 changes: 34 additions & 3 deletions joint_buying_base/models/joint_buying_tour.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ class JointBuyingTour(models.Model):

transport_request_qty = fields.Integer(compute="_compute_transport_request_qty")

is_on_my_way = fields.Boolean(
compute="_compute_is_on_my_way",
search="_search_is_on_my_way",
help="Technical field that indicates that the tour"
" passes through the current company.",
)

@api.onchange("type_id")
def _onchange_type_id(self):
if self.type_id and self.type_id.carrier_id:
Expand All @@ -127,9 +134,9 @@ def _compute_name(self):

@api.depends("line_ids.transport_request_line_ids.request_id")
def _compute_transport_request_qty(self):
for request in self:
request.transport_request_qty = len(
request.mapped("line_ids.transport_request_line_ids.request_id")
for tour in self:
tour.transport_request_qty = len(
tour.mapped("line_ids.transport_request_line_ids.request_id")
)

@api.depends("salary_cost", "toll_cost", "vehicle_cost")
Expand Down Expand Up @@ -271,6 +278,30 @@ 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.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
for tour in self:
tour.is_on_my_way = current_partner in self.mapped(
"line_ids.starting_point_id"
) or current_partner in self.mapped("line_ids.arrival_point_id")

# Search Section
def _search_is_on_my_way(self, operator, value):
current_partner = self.env.user.company_id.joint_buying_partner_id
if (operator == "=" and value) or (operator == "!=" and not value):
search_operator = "in"
else:
search_operator = "not in"
tour_lines = self.env["joint.buying.tour.line"].search(
[
"|",
("starting_point_id", "=", current_partner.id),
("arrival_point_id", "=", current_partner.id),
]
)
return [("id", search_operator, tour_lines.mapped("tour_id").ids)]

# Overload Section
@api.multi
def copy(self, default=None):
Expand Down
21 changes: 14 additions & 7 deletions joint_buying_base/views/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,31 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
groups="group_joint_buying_user"
/>

<menuitem id="menu_transport"
<menuitem id="menu_catalog_main"
name="Catalog"
parent="menu_root"
sequence="5"
/>

<menuitem id="menu_transport_main"
name="Transports"
parent="menu_root"
sequence="10"
/>

<menuitem id="menu_tour"
name="Tours"
parent="menu_transport_main"
sequence="100"
/>


<menuitem id="menu_pivot"
name="Pivot Role"
parent="menu_root"
sequence="15"
/>

<menuitem id="menu_journey"
name="Journeys"
parent="menu_root"
sequence="20"
/>

<menuitem id="menu_configuration"
name="Configuration"
parent="menu_root"
Expand Down
26 changes: 22 additions & 4 deletions joint_buying_base/views/view_joint_buying_tour.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
<field name="name"/>
<field name="start_date"/>
<field name="carrier_id"/>
<field name="is_on_my_way"/>
</search>
</field>
</record>
Expand Down Expand Up @@ -162,19 +163,36 @@ There may be traffic jams, delays, unforeseen events, etc...
</field>
</record>

<record id="action_joint_buying_tour_my" model="ir.actions.act_window">
<field name="name">My Tours</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">joint.buying.tour</field>
<field name="view_type">form</field>
<field name="view_mode">calendar,tree,form</field>
<field name="domain">[('is_on_my_way', '=', True)]</field>
</record>

<menuitem id="menu_joint_buying_tour_my"
name="My Tours"
parent="menu_tour"
action="action_joint_buying_tour_my"
sequence="10"
/>

<record id="action_joint_buying_tour_all" model="ir.actions.act_window">
<field name="name">Tours</field>
<field name="name">All Tours</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">joint.buying.tour</field>
<field name="view_type">form</field>
<field name="view_mode">calendar,tree,form</field>
</record>


<menuitem id="menu_joint_buying_tour_all"
name="Tours"
parent="menu_journey"
name="All Tours"
parent="menu_tour"
action="action_joint_buying_tour_all"
sequence="10"
sequence="20"
/>

</odoo>
13 changes: 11 additions & 2 deletions joint_buying_base/views/view_joint_buying_transport_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="action_server_module_immediate_install" model="ir.actions.server">
<field name="name">Compute Route</field>
<field name="type">ir.actions.server</field>
<field name="model_id" ref="model_joint_buying_transport_request" />
<field name="binding_model_id" ref="model_joint_buying_transport_request" />
<field name="state">code</field>
<field name="code">records.button_compute_tour()</field>
</record>

<record id="action_request_2_wizard_find_route" model="ir.actions.act_window">
<field name="name">Find the Best Route</field>
<field name="type">ir.actions.act_window</field>
Expand Down Expand Up @@ -192,9 +201,9 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

<menuitem id="menu_joint_buying_transport_request"
name="Transport Requests"
parent="joint_buying_base.menu_transport"
parent="joint_buying_base.menu_transport_main"
action="action_joint_buying_transport_request"
sequence="1"
sequence="200"
groups="joint_buying_base.group_joint_buying_user"
/>

Expand Down
Loading

0 comments on commit 68f7ff9

Please sign in to comment.