Skip to content

Commit

Permalink
[MIG][17.0]purchase_backorder
Browse files Browse the repository at this point in the history
  • Loading branch information
Vandan-OSI authored and Nikul-OSI committed Dec 13, 2024
1 parent 234f7ae commit 8f29874
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 81 deletions.
51 changes: 25 additions & 26 deletions purchase_backorder/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,23 @@ Purchase Backorder Report
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpurchase--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/purchase-reporting/tree/16.0/purchase_backorder
:target: https://github.com/OCA/purchase-reporting/tree/17.0/purchase_backorder
:alt: OCA/purchase-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/purchase-reporting-16-0/purchase-reporting-16-0-purchase_backorder
:target: https://translation.odoo-community.org/projects/purchase-reporting-17-0/purchase-reporting-17-0-purchase_backorder
: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-reporting&target_branch=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/purchase-reporting&target_branch=17.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds the ability to view Un-Invoice Goods Received (UIGR) and
Backordered products on Purchase Oders.
This module adds the ability to view Un-Invoice Goods Received (UIGR)
and Backordered products on Purchase Oders.

The quantity and the value of both UIGR and Backordered products is computed for
purchase order lines and then aggregated for display on the parent purchase order.
The quantity and the value of both UIGR and Backordered products is
computed for purchase order lines and then aggregated for display on the
parent purchase order.

**Table of contents**

Expand All @@ -42,45 +43,43 @@ purchase order lines and then aggregated for display on the parent purchase orde
Usage
=====

* Go to Purchase > Purchase > PO Backorders.

* This will display a tree view of all purchase order lines with their UIGR and
Backorder information as well as the last date received and the last date
billed.

* Select one or more items in the tree view and then select the
"PO Backorder Report" option from the Print menu to print a report of the
selected items.
- Go to Purchase > Purchase > PO Backorders.
- This will display a tree view of all purchase order lines with their
UIGR and Backorder information as well as the last date received and
the last date billed.
- Select one or more items in the tree view and then select the "PO
Backorder Report" option from the Print menu to print a report of the
selected items.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/purchase-reporting/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-reporting/issues/new?body=module:%20purchase_backorder%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/purchase-reporting/issues/new?body=module:%20purchase_backorder%0Aversion:%2017.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.

Credits
=======

Authors
~~~~~~~
-------

* Open Source Integrators

Contributors
~~~~~~~~~~~~
------------

* Michael Allen <mallen@opensourceintegrators.com>
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
* Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>
- Michael Allen <mallen@opensourceintegrators.com>
- Sandip Mangukiya <smangukiya@opensourceintegrators.com>
- Bhavesh Odedra <bodedra@opensourceintegrators.com>
- Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
- Murtaza Mithaiwala <mmithaiwala@opensourceintegrators.com>

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

Expand All @@ -100,6 +99,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-smangukiya|

This module is part of the `OCA/purchase-reporting <https://github.com/OCA/purchase-reporting/tree/16.0/purchase_backorder>`_ project on GitHub.
This module is part of the `OCA/purchase-reporting <https://github.com/OCA/purchase-reporting/tree/17.0/purchase_backorder>`_ 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_backorder/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

{
"name": "Purchase Backorder Report",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"summary": "Report of Un-Invoiced Goods Received and Backorders",
Expand Down
17 changes: 9 additions & 8 deletions purchase_backorder/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ def _compute_last_date_received(self):
@api.depends("order_line.last_bill_date")
def _compute_last_bill_date(self):
for order in self:
max_date = False
for line in order.order_line:
if max_date:
if line.last_bill_date and max_date < line.last_bill_date:
max_date = line.last_bill_date
else:
max_date = line.last_bill_date
order.last_bill_date = max_date
last_bill_date = max(
(
line.last_bill_date
for line in order.order_line
if line.last_bill_date
),
default=False,
)
order.last_bill_date = last_bill_date
41 changes: 27 additions & 14 deletions purchase_backorder/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT


class PurchaseOrderLine(models.Model):
Expand Down Expand Up @@ -65,17 +64,31 @@ def _compute_last_date_received(self):
@api.depends("invoice_lines.move_id.state", "invoice_lines.quantity")
def _compute_last_bill_date(self):
for line in self:
max_date = False
for inv_line in line.invoice_lines:
if inv_line.move_id.state not in ["cancel"]:
if inv_line.move_id.move_type == "in_invoice":
if max_date and inv_line.move_id.date:
if max_date < inv_line.move_id.date:
max_date = inv_line.move_id.date
else:
max_date = inv_line.move_id.date
elif inv_line.move_id.move_type == "in_refund":
continue
line.last_bill_date = (
max_date and max_date.strftime(DEFAULT_SERVER_DATETIME_FORMAT) or False
line.last_bill_date = False
invoice_lines = [
inv_line
for inv_line in line.invoice_lines
if inv_line.move_id.state != "cancel"
and inv_line.move_id.move_type == "in_invoice"
]
last_bill_date = max(
(
inv_line.move_id.date
for inv_line in invoice_lines
if inv_line.move_id.date
),
default=False,
)
if last_bill_date:
timezone = (

Check warning on line 83 in purchase_backorder/models/purchase_order_line.py

View check run for this annotation

Codecov / codecov/patch

purchase_backorder/models/purchase_order_line.py#L83

Added line #L83 was not covered by tests
self._context.get("tz") or self.env.user.partner_id.tz or "UTC"
)
last_bill_date_tz = fields.Datetime.context_timestamp(

Check warning on line 86 in purchase_backorder/models/purchase_order_line.py

View check run for this annotation

Codecov / codecov/patch

purchase_backorder/models/purchase_order_line.py#L86

Added line #L86 was not covered by tests
self.with_context(tz=timezone),
fields.Datetime.from_string(last_bill_date),
).replace(tzinfo=None)
line.last_bill_date = last_bill_date_tz.replace(

Check warning on line 90 in purchase_backorder/models/purchase_order_line.py

View check run for this annotation

Codecov / codecov/patch

purchase_backorder/models/purchase_order_line.py#L90

Added line #L90 was not covered by tests
day=last_bill_date.day,
month=last_bill_date.month,
year=last_bill_date.year,
)
3 changes: 3 additions & 0 deletions purchase_backorder/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions purchase_backorder/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Michael Allen \<<mallen@opensourceintegrators.com>\>
- Sandip Mangukiya \<<smangukiya@opensourceintegrators.com>\>
- Bhavesh Odedra \<<bodedra@opensourceintegrators.com>\>
- Serpent Consulting Services Pvt. Ltd. \<<support@serpentcs.com>\>
- Murtaza Mithaiwala \<<mmithaiwala@opensourceintegrators.com>\>
5 changes: 0 additions & 5 deletions purchase_backorder/readme/CONTRIBUTORS.rst

This file was deleted.

6 changes: 6 additions & 0 deletions purchase_backorder/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This module adds the ability to view Un-Invoice Goods Received (UIGR)
and Backordered products on Purchase Oders.

The quantity and the value of both UIGR and Backordered products is
computed for purchase order lines and then aggregated for display on the
parent purchase order.
5 changes: 0 additions & 5 deletions purchase_backorder/readme/DESCRIPTION.rst

This file was deleted.

7 changes: 7 additions & 0 deletions purchase_backorder/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- Go to Purchase \> Purchase \> PO Backorders.
- This will display a tree view of all purchase order lines with their
UIGR and Backorder information as well as the last date received and
the last date billed.
- Select one or more items in the tree view and then select the "PO
Backorder Report" option from the Print menu to print a report of the
selected items.
9 changes: 0 additions & 9 deletions purchase_backorder/readme/USAGE.rst

This file was deleted.

1 change: 0 additions & 1 deletion purchase_backorder/report/po_backorder_report.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<td><span t-field="line.uigr_value" /></td>
<td><span t-field="line.last_date_received" /></td>
<td><span t-field="line.last_bill_date" /></td>
<td />
</tr>
</tbody>
</table>
Expand Down
25 changes: 13 additions & 12 deletions purchase_backorder/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,12 @@ <h1 class="title">Purchase Backorder Report</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:5aca8bbfc3d66d694857a1232cd0f60cb20e420d15e86fe00256e36cb2cf1446
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/purchase-reporting/tree/16.0/purchase_backorder"><img alt="OCA/purchase-reporting" src="https://img.shields.io/badge/github-OCA%2Fpurchase--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-reporting-16-0/purchase-reporting-16-0-purchase_backorder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/purchase-reporting&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds the ability to view Un-Invoice Goods Received (UIGR) and
Backordered products on Purchase Oders.</p>
<p>The quantity and the value of both UIGR and Backordered products is computed for
purchase order lines and then aggregated for display on the parent purchase order.</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/purchase-reporting/tree/17.0/purchase_backorder"><img alt="OCA/purchase-reporting" src="https://img.shields.io/badge/github-OCA%2Fpurchase--reporting-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/purchase-reporting-17-0/purchase-reporting-17-0-purchase_backorder"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/purchase-reporting&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module adds the ability to view Un-Invoice Goods Received (UIGR)
and Backordered products on Purchase Oders.</p>
<p>The quantity and the value of both UIGR and Backordered products is
computed for purchase order lines and then aggregated for display on the
parent purchase order.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
Expand All @@ -390,11 +391,11 @@ <h1 class="title">Purchase Backorder Report</h1>
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<ul class="simple">
<li>Go to Purchase &gt; Purchase &gt; PO Backorders.</li>
<li>This will display a tree view of all purchase order lines with their UIGR and
Backorder information as well as the last date received and the last date
billed.</li>
<li>Select one or more items in the tree view and then select the
“PO Backorder Report” option from the Print menu to print a report of the
<li>This will display a tree view of all purchase order lines with their
UIGR and Backorder information as well as the last date received and
the last date billed.</li>
<li>Select one or more items in the tree view and then select the “PO
Backorder Report” option from the Print menu to print a report of the
selected items.</li>
</ul>
</div>
Expand All @@ -403,7 +404,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/purchase-reporting/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/purchase-reporting/issues/new?body=module:%20purchase_backorder%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/purchase-reporting/issues/new?body=module:%20purchase_backorder%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -433,7 +434,7 @@ <h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/smangukiya"><img alt="smangukiya" src="https://github.com/smangukiya.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-reporting/tree/16.0/purchase_backorder">OCA/purchase-reporting</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/purchase-reporting/tree/17.0/purchase_backorder">OCA/purchase-reporting</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down

0 comments on commit 8f29874

Please sign in to comment.