Skip to content

Commit

Permalink
[MIG] purchase_request: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
quoc-pn committed Oct 18, 2024
1 parent 6e91ce8 commit cf21b43
Show file tree
Hide file tree
Showing 18 changed files with 139 additions and 132 deletions.
44 changes: 24 additions & 20 deletions purchase_request/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Purchase Request
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-workflow/tree/17.0/purchase_request
:target: https://github.com/OCA/purchase-workflow/tree/18.0/purchase_request
:alt: OCA/purchase-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-workflow-17-0/purchase-workflow-17-0-purchase_request
:target: https://translation.odoo-community.org/projects/purchase-workflow-18-0/purchase-workflow-18-0-purchase_request
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-workflow&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -85,9 +85,9 @@ To configure the product follow this steps:
Note that MTO route is archived by default, you should unarchive it
first:

- Go to Inventory > Configuration > Routes, in the Search dropdown
menu, click *Archived* to show *Replenish on Order (MTO)* route and
*Unarchive* it.
- Go to Inventory > Configuration > Routes, in the Search dropdown menu,
click *Archived* to show *Replenish on Order (MTO)* route and
*Unarchive* it.

With this configuration, whenever a procurement order is created and the
supply rule selected is 'Buy' the application will create a Purchase
Expand All @@ -110,7 +110,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_request%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/purchase-workflow/issues/new?body=module:%20purchase_request%0Aversion:%2018.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.

Expand All @@ -125,27 +125,31 @@ Authors
Contributors
------------

- Jordi Ballester Alomar <[email protected]>
- Jordi Ballester Alomar <[email protected]>

- Jonathan Nemry <[email protected]>
- Jonathan Nemry <[email protected]>

- Aaron Henriquez <[email protected]>
- Aaron Henriquez <[email protected]>

- Adrien Peiffer <[email protected]>
- Adrien Peiffer <[email protected]>

- Lois Rilo <[email protected]>
- Lois Rilo <[email protected]>

- Héctor Villarreal <[email protected]>
- Héctor Villarreal <[email protected]>

- Ben Cai <[email protected]>
- Ben Cai <[email protected]>

- Rattapong Chokmasermkul <[email protected]>
- Rattapong Chokmasermkul <[email protected]>

- Stefan Rijnhart <[email protected]>
- Stefan Rijnhart <[email protected]>

- ``Trobz <https://trobz.com>``\ \_:
- ``Trobz <https://trobz.com>``\ \_:

- Son Ho [email protected]
- Son Ho [email protected]

- `Komit Company Limited <https://komit-consulting.com/>`__:

- Quoc Pham Ngoc <[email protected]>

Other credits
-------------
Expand All @@ -157,7 +161,7 @@ The development of this module has been financially supported by:
Images
~~~~~~

- Enric Tobella (logo)
- Enric Tobella (logo)

.. |Aleph Objects, Inc| image:: https://upload.wikimedia.org/wikipedia/en/3/3b/Aleph_Objects_Logo.png
:target: https://www.alephobjects.com
Expand All @@ -175,6 +179,6 @@ 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/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/17.0/purchase_request>`_ project on GitHub.
This module is part of the `OCA/purchase-workflow <https://github.com/OCA/purchase-workflow/tree/18.0/purchase_request>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion purchase_request/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Purchase Request",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"version": "17.0.1.2.2",
"version": "18.0.1.0.0",
"summary": "Use this module to have notification of requirements of "
"materials and/or external services and keep track of such "
"requirements.",
Expand Down
43 changes: 21 additions & 22 deletions purchase_request/models/purchase_order.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2018-2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

from markupsafe import Markup

from odoo import _, api, exceptions, fields, models


Expand All @@ -15,14 +17,13 @@ def _purchase_request_confirm_message_content(self, request, request_dict=None):
"po_name": self.name,
"pr_name": request.name,
}
message = "<h3>%s</h3><ul>" % title
message = f"<h3>{title}</h3><ul>"
message += _(
"The following requested items from Purchase Request %(pr_name)s "
"have now been confirmed in Purchase Order %(po_name)s:"
) % {
"po_name": self.name,
"pr_name": request.name,
}
"have now been confirmed in Purchase Order %(po_name)s:",
po_name=self.name,
pr_name=request.name,
)

for line in request_dict.values():
message += _(
Expand All @@ -46,7 +47,7 @@ def _purchase_request_confirm_message(self):
request_id = request_line.request_id.id
if request_id not in requests_dict:
requests_dict[request_id] = {}
date_planned = "%s" % line.date_planned
date_planned = line.date_planned
data = {
"name": request_line.name,
"product_qty": line.product_qty,
Expand All @@ -60,7 +61,7 @@ def _purchase_request_confirm_message(self):
request, requests_dict[request_id]
)
request.message_post(
body=message,
body=Markup(message),
subtype_id=self.env.ref("mail.mt_comment").id,
body_is_html=True,
)
Expand Down Expand Up @@ -132,7 +133,7 @@ def action_open_request_line_tree_view(self):
"name": _("Purchase Request Lines"),
"type": "ir.actions.act_window",
"res_model": "purchase.request.line",
"view_mode": "tree,form",
"view_mode": "list,form",
"domain": domain,
}

Expand Down Expand Up @@ -182,7 +183,7 @@ def update_service_allocations(self, prev_qty_received):
message_data
)
alloc.purchase_request_line_id.request_id.message_post(
body=message,
body=Markup(message),
subtype_id=self.env.ref("mail.mt_comment").id,
body_is_html=True,
)
Expand All @@ -195,24 +196,22 @@ def _purchase_request_confirm_done_message_content(self, message_data):
title = (
_("Service confirmation for Request %s") % (message_data["request_name"])
)
message = "<h3>%s</h3>" % title
message = f"<h3>{title}</h3>"
message += _(
"The following requested services from Purchase"
" Request %(request_name)s requested by %(requestor)s "
"have now been received:"
) % {
"request_name": message_data["request_name"],
"requestor": message_data["requestor"],
}
"have now been received:",
request_name=message_data["request_name"],
requestor=message_data["requestor"],
)
message += "<ul>"
message += _(
"<li><b>%(product_name)s</b>: "
"Received quantity %(product_qty)s %(product_uom)s</li>"
) % {
"product_name": message_data["product_name"],
"product_qty": message_data["product_qty"],
"product_uom": message_data["product_uom"],
}
"Received quantity %(product_qty)s %(product_uom)s</li>",
product_name=message_data["product_name"],
product_qty=message_data["product_qty"],
product_uom=message_data["product_uom"],
)
message += "</ul>"
return message

Expand Down
4 changes: 3 additions & 1 deletion purchase_request/models/purchase_request_allocation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2019 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

from markupsafe import Markup

from odoo import _, api, fields, models


Expand Down Expand Up @@ -128,7 +130,7 @@ def _notify_allocation(self, allocated_qty):
message_data = self._prepare_message_data(po_line, request, allocated_qty)
message = self._purchase_request_confirm_done_message_content(message_data)
request.message_post(
body=message,
body=Markup(message),
subtype_id=self.env.ref("mail.mt_comment").id,
body_is_html=True,
)
68 changes: 33 additions & 35 deletions purchase_request/models/stock_move_line.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright 2017 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)

from markupsafe import Markup

from odoo import _, api, models


Expand All @@ -10,57 +12,53 @@ class StockMoveLine(models.Model):
@api.model
def _purchase_request_confirm_done_message_content(self, message_data):
title = _(
"Receipt confirmation %(picking_name)s for your Request %(request_name)s"
) % {
"picking_name": message_data["picking_name"],
"request_name": message_data["request_name"],
}
message = "<h3>%s</h3>" % title
"Receipt confirmation %(picking_name)s for your Request %(request_name)s",
picking_name=message_data["picking_name"],
request_name=message_data["request_name"],
)
message = f"<h3>{title}</h3>"
message += _(
"The following requested items from Purchase Request %(request_name)s "
"have now been received in %(location_name)s using Picking "
"%(picking_name)s:"
) % {
"request_name": message_data["request_name"],
"location_name": message_data["location_name"],
"picking_name": message_data["picking_name"],
}
"%(picking_name)s:",
request_name=message_data["request_name"],
location_name=message_data["location_name"],
picking_name=message_data["picking_name"],
)
message += "<ul>"
message += _(
"<li><b>%(product_name)s</b>: "
"Transferred quantity %(product_qty)s %(product_uom)s</li>"
) % {
"product_name": message_data["product_name"],
"product_qty": message_data["product_qty"],
"product_uom": message_data["product_uom"],
}
"Transferred quantity %(product_qty)s %(product_uom)s</li>",
product_name=message_data["product_name"],
product_qty=message_data["product_qty"],
product_uom=message_data["product_uom"],
)
message += "</ul>"
return message

@api.model
def _picking_confirm_done_message_content(self, message_data):
title = (
_("Receipt confirmation for Request %s") % (message_data["request_name"])
title = _(
"Receipt confirmation for Request %(name)s",
name=message_data["request_name"],
)
message = "<h3>%s</h3>" % title
message = f"<h3>{title}</h3>"
message += _(
"The following requested items from Purchase Request %(request_name)s "
"requested by %(requestor)s "
"have now been received in %(location_name)s:"
) % {
"request_name": message_data["request_name"],
"requestor": message_data["requestor"],
"location_name": message_data["location_name"],
}
"have now been received in %(location_name)s:",
request_name=message_data["request_name"],
requestor=message_data["requestor"],
location_name=message_data["location_name"],
)
message += "<ul>"
message += _(
"<li><b>%(product_name)s</b>: "
"Transferred quantity %(product_qty)s %(product_uom)s</li>"
) % {
"product_name": message_data["product_name"],
"product_qty": message_data["product_qty"],
"product_uom": message_data["product_uom"],
}
"Transferred quantity %(product_qty)s %(product_uom)s</li>",
product_name=message_data["product_name"],
product_qty=message_data["product_qty"],
product_uom=message_data["product_uom"],
)
message += "</ul>"
return message

Expand Down Expand Up @@ -107,7 +105,7 @@ def allocate(self):
message_data
)
request.message_post(
body=message,
body=Markup(message),
subtype_id=self.env.ref("mail.mt_comment").id,
body_is_html=True,
)
Expand All @@ -116,7 +114,7 @@ def allocate(self):
message_data
)
ml.move_id.picking_id.message_post(
body=picking_message,
body=Markup(picking_message),
subtype_id=self.env.ref("mail.mt_comment").id,
body_is_html=True,
)
Expand Down
2 changes: 2 additions & 0 deletions purchase_request/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
- `Trobz <https://trobz.com>`_:

* Son Ho <[email protected]>
- [Komit Company Limited](https://komit-consulting.com/):
- Quoc Pham Ngoc \<<[email protected]>\>
4 changes: 2 additions & 2 deletions purchase_request/reports/report_purchase_request.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<t t-foreach="docs" t-as="o">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure" />
<div id="oe_structure_report_request_1" class="oe_structure" />
<h2>
Purchase Request
<span t-field="o.name" />
Expand Down Expand Up @@ -115,7 +115,7 @@
</tbody>
</table>
</t>
<div class="oe_structure" />
<div id="oe_structure_report_request_2" class="oe_structure" />
</div>
</t>
</t>
Expand Down
Loading

0 comments on commit cf21b43

Please sign in to comment.