Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] stock_report_quantity_by_location: Migration to version 16.0 #298

Merged

Conversation

hugo-cordoba
Copy link
Contributor

[16.0][MIG] stock_report_quantity_by_location

JordiBForgeFlow and others added 30 commits November 24, 2023 00:42
Currently translated at 96.3% (26 of 27 strings)

Translation: stock-logistics-reporting-12.0/stock-logistics-reporting-12.0-stock_report_quantity_by_location
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-12-0/stock-logistics-reporting-12-0-stock_report_quantity_by_location/es_MX/
- Add an option in the wizard 'Quantity > 0' to speed up the report
…ilability.

New field 'availability' in the wizard, allowing you to report on
quantities on hand, or quantities unreserved (on hand - reservations).
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-reporting-13.0/stock-logistics-reporting-13.0-stock_report_quantity_by_location
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-13-0/stock-logistics-reporting-13-0-stock_report_quantity_by_location/
Currently translated at 100.0% (35 of 35 strings)

Translation: stock-logistics-reporting-15.0/stock-logistics-reporting-15.0-stock_report_quantity_by_location
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-15-0/stock-logistics-reporting-15-0-stock_report_quantity_by_location/es/
weblate and others added 2 commits November 24, 2023 00:42
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: stock-logistics-reporting-15.0/stock-logistics-reporting-15.0-stock_report_quantity_by_location
Translate-URL: https://translation.odoo-community.org/projects/stock-logistics-reporting-15-0/stock-logistics-reporting-15-0-stock_report_quantity_by_location/
@hugo-cordoba hugo-cordoba mentioned this pull request Nov 23, 2023
11 tasks
@pedrobaeza
Copy link
Member

/ocabot migration stock_report_quantity_by_location

@OCA-git-bot OCA-git-bot added this to the 16.0 milestone Nov 23, 2023
@hugo-cordoba hugo-cordoba force-pushed the 16.0-mig-stock_report_quantity_by_location branch from 4d43985 to 3a8a586 Compare November 24, 2023 00:07
class TestStockReportQuantityByLocation(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestStockReportQuantityByLocation, cls).setUpClass()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apply PEP 3135 (28-Apr-2007) to "super()."

qty_on_hand = qty_dict.get("quantity_on_hand", 0.0)
qty_reserved = qty_dict.get("quantity_reserved", 0.0)
qty_unreserved = qty_dict.get("quantity_unreserved", 0.0)
if (self.with_quantity and qty_on_hand) or not self.with_quantity:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would not be the same as this:

Suggested change
if (self.with_quantity and qty_on_hand) or not self.with_quantity:
if not self.with_quantity or qty_on_hand:

}
)
recs = self.env["stock.report.quantity.by.location"].create(vals_list)
return recs.ids
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method does not need to return anything, you can remove recs.

"default_code": product.default_code,
}
)
recs = self.env["stock.report.quantity.by.location"].create(vals_list)
Copy link
Contributor

@RodrigoBM RodrigoBM Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do this operation only once, moving it out of the for.

@hugo-cordoba hugo-cordoba force-pushed the 16.0-mig-stock_report_quantity_by_location branch from 3a8a586 to 30c3e4b Compare November 28, 2023 06:18
@hugo-cordoba
Copy link
Contributor Author

Hi @RodrigoBM, changes done, thanks! 👍🏼

Copy link
Sponsor Contributor

@rousseldenis rousseldenis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review

}
mapping.setdefault(quant_group["product_id"][0], qty_dict)
products = self.env["product.product"].search([("type", "=", "product")])
vals_list = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this variable has to be outside the for, if not, only records from the last iteration of location_ids will be created.

@hugo-cordoba hugo-cordoba force-pushed the 16.0-mig-stock_report_quantity_by_location branch from 30c3e4b to b1766c6 Compare November 28, 2023 08:47
@hugo-cordoba
Copy link
Contributor Author

Hi @pedrobaeza, how are you? Could you check the mr and merge it? Thanks!

@pedrobaeza
Copy link
Member

Merging based on the reviews and due to @rousseldenis as Logistics PSC approval

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 16.0-ocabot-merge-pr-298-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit d45c9f8 into OCA:16.0 Nov 28, 2023
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at d4db922. Thanks a lot for contributing to OCA. ❤️

@RodrigoBM RodrigoBM deleted the 16.0-mig-stock_report_quantity_by_location branch November 28, 2023 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet