From 0a8f2f97b9d94b79c7dc5a8887a8ba1a034f9383 Mon Sep 17 00:00:00 2001 From: Maria Sparenberg Date: Tue, 26 Oct 2021 13:39:12 +0200 Subject: [PATCH 1/6] initial add of several rental modules --- .../README/CONTRIBUTORS.rst | 8 + .../README/DESCRIPTION.rst | 22 + rental_check_availability/README/HISTORY.rst | 11 + rental_check_availability/README/USAGE.rst | 18 + rental_check_availability/__init__.py | 3 + rental_check_availability/__manifest__.py | 48 +++ rental_check_availability/i18n/de.po | 76 ++++ .../i18n/rental_check_availability.pot | 75 ++++ rental_check_availability/models/__init__.py | 2 + rental_check_availability/models/sale.py | 142 ++++++ .../static/description/index.html | 408 ++++++++++++++++++ rental_check_availability/tests/__init__.py | 3 + .../tests/test_check_availability.py | 146 +++++++ rental_check_availability/views/sale_view.xml | 57 +++ 14 files changed, 1019 insertions(+) create mode 100644 rental_check_availability/README/CONTRIBUTORS.rst create mode 100644 rental_check_availability/README/DESCRIPTION.rst create mode 100644 rental_check_availability/README/HISTORY.rst create mode 100644 rental_check_availability/README/USAGE.rst create mode 100644 rental_check_availability/__init__.py create mode 100644 rental_check_availability/__manifest__.py create mode 100644 rental_check_availability/i18n/de.po create mode 100644 rental_check_availability/i18n/rental_check_availability.pot create mode 100644 rental_check_availability/models/__init__.py create mode 100644 rental_check_availability/models/sale.py create mode 100644 rental_check_availability/static/description/index.html create mode 100644 rental_check_availability/tests/__init__.py create mode 100644 rental_check_availability/tests/test_check_availability.py create mode 100644 rental_check_availability/views/sale_view.xml diff --git a/rental_check_availability/README/CONTRIBUTORS.rst b/rental_check_availability/README/CONTRIBUTORS.rst new file mode 100644 index 00000000..ebff9100 --- /dev/null +++ b/rental_check_availability/README/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ + +Contributors +------------ + +Odoo Community Association (OCA)/Elego Software Solutions GmbH +* Ben Brich (www.humanilog.org) +* Yu Weng (www.elegosoft.com) + diff --git a/rental_check_availability/README/DESCRIPTION.rst b/rental_check_availability/README/DESCRIPTION.rst new file mode 100644 index 00000000..fd17723a --- /dev/null +++ b/rental_check_availability/README/DESCRIPTION.rst @@ -0,0 +1,22 @@ +Rental Check Availability +==================================================== + +*This file has been generated on 2021-10-25-10-18-19. Changes to it will be overwritten.* + +Summary +------- + +Extends the sale_rental module for checking availability of the rented product. + +Description +----------- + +This module activates availability checks on stockable products related to rental services in +sale orders. In the base functionality only the total amount of products in stock is checked and user is +informed when the amount of products to rent out in a sale order is higher. + +After the installation of this module the availability is checked in consideration of the total amount +of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. +In case of insufficient products in stock the user receives visual notification on respective sale order line +and can access the list of concurrent sale orders directly. + diff --git a/rental_check_availability/README/HISTORY.rst b/rental_check_availability/README/HISTORY.rst new file mode 100644 index 00000000..acd02dbe --- /dev/null +++ b/rental_check_availability/README/HISTORY.rst @@ -0,0 +1,11 @@ + +Changelog +--------- + +- 39845816 2021-10-21 14:15:20 +0200 yweng@elegosoft.com (origin/feature_4436_blp1250_unittest_rental_check_availability_v12) [IMP] update translations and manifest of module rental_pricelist_interval and rental_check_availability (issue 4436) +- d8665dd9 2021-10-19 12:26:31 +0200 yweng@elegosoft.com [IMP] Add Unittest for module rental_check_availability and adjust Unittest of rental_pricelist and rental_pricelist_interval (issue 4436) +- 8b4d40c4 2021-09-23 09:19:24 +0200 wagner@elegosoft.com regenerate doc (issue #4016) +- dd988a2f 2021-06-09 12:42:47 +0200 wagner@elegosoft.com update documentation (issue #3613) +- 78a00cdd 2021-04-28 02:43:00 +0200 yweng@elegosoft.com (origin/feature_4222_blp622_rental_check_availability_v12, feature_4222_blp622_rental_check_availability_v12) [IMP] adjust tree view of sale.order and hide the button 'show concurrent order' for product with zero quantity +- 0cc27ac8 2021-03-28 21:45:23 +0200 yweng@elegosoft.com (origin/feature_4046_blp564_rental_check_availability_v12) [ADD] Module rental_check_availability (issue 4046) + diff --git a/rental_check_availability/README/USAGE.rst b/rental_check_availability/README/USAGE.rst new file mode 100644 index 00000000..d8f48ca4 --- /dev/null +++ b/rental_check_availability/README/USAGE.rst @@ -0,0 +1,18 @@ + +Usage +----- + +To use this module, you need to: + +#. Go to Rental Orders and create a new one. + +#. Add a product available for being rented out in sale order line. + +#. If there is not enough stock on hand to fullfil the order and + possible concurrent ones the sale order line will be colorized. + Yellow marks that there are concurrent quotations and red indicates + concurrent orders. + +#. To check the concurrent order for a critical sale order line just click + on the inline button being displayed in the sale order line. + diff --git a/rental_check_availability/__init__.py b/rental_check_availability/__init__.py new file mode 100644 index 00000000..77c9fdfc --- /dev/null +++ b/rental_check_availability/__init__.py @@ -0,0 +1,3 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/rental_check_availability/__manifest__.py b/rental_check_availability/__manifest__.py new file mode 100644 index 00000000..e1106bde --- /dev/null +++ b/rental_check_availability/__manifest__.py @@ -0,0 +1,48 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. + +{ + "name": "Rental Check Availability", + "summary": "Extends the sale_rental module for checking availability of the rented product.", + "description": """ +This module activates availability checks on stockable products related to rental services in +sale orders. In the base functionality only the total amount of products in stock is checked and user is +informed when the amount of products to rent out in a sale order is higher. + +After the installation of this module the availability is checked in consideration of the total amount +of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. +In case of insufficient products in stock the user receives visual notification on respective sale order line +and can access the list of concurrent sale orders directly. +""", + "usage": """ +To use this module, you need to: + +#. Go to Rental Orders and create a new one. + +#. Add a product available for being rented out in sale order line. + +#. If there is not enough stock on hand to fullfil the order and + possible concurrent ones the sale order line will be colorized. + Yellow marks that there are concurrent quotations and red indicates + concurrent orders. + +#. To check the concurrent order for a critical sale order line just click + on the inline button being displayed in the sale order line. +""", + "contributors": """ +* Ben Brich (www.humanilog.org) +* Yu Weng (www.elegosoft.com) +""", + "version": "12.0.1.0.0", + "category": "Rental", + "author": "Odoo Community Association (OCA)/Elego Software Solutions GmbH", + "depends": [ + "rental_pricelist", + ], + "data": [ + "views/sale_view.xml", + ], + "demo": [], + "qweb": [], + "application": False, + "license": "AGPL-3", +} diff --git a/rental_check_availability/i18n/de.po b/rental_check_availability/i18n/de.po new file mode 100644 index 00000000..2bc9ae15 --- /dev/null +++ b/rental_check_availability/i18n/de.po @@ -0,0 +1,76 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * rental_check_availability +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-10-18 11:56+0000\n" +"PO-Revision-Date: 2021-10-18 14:06+0200\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"Language: de\n" +"X-Generator: Poedit 3.0\n" + +#. module: rental_check_availability +#: model_terms:ir.ui.view,arch_db:rental_check_availability.view_order_form_order_line_tree_color +msgid "Check Availability" +msgstr "Verfügbarkeit prüfen" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__concurrent_orders +msgid "Concurrent Orders" +msgstr "Zeitgleiche Aufträge" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:114 +#, python-format +msgid "No found concurrent Rental Order/Quotation(s)." +msgstr "Es konnten keine zeitgleichen Aufträge gefunden werden." + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "None" +msgstr "Keine" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:48 +#, python-format +msgid "Not enough stock!" +msgstr "Bestand nicht ausreichend!" + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "Order" +msgstr "Auftrag" + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "Quotation" +msgstr "Angebot" + +#. module: rental_check_availability +#: model:ir.model,name:rental_check_availability.model_sale_order +msgid "Sale Order" +msgstr "Verkaufsauftrag" + +#. module: rental_check_availability +#: model:ir.model,name:rental_check_availability.model_sale_order_line +msgid "Sales Order Line" +msgstr "Auftragsposition" + +#. module: rental_check_availability +#: model_terms:ir.ui.view,arch_db:rental_check_availability.view_order_form +msgid "View concurrent Order/Quotation(s)" +msgstr "Zeitgleiche Aufträge anzeigen." + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:49 +#, python-format +msgid "You want to rent %.2f %s but you only have %.2f %s available in the selected period." +msgstr "Sie versuchen %.2f %s Einheiten zu vermieten, es sind aber nur %.2f %s Einheiten im aktuellen Bestand verfügbar." diff --git a/rental_check_availability/i18n/rental_check_availability.pot b/rental_check_availability/i18n/rental_check_availability.pot new file mode 100644 index 00000000..0452b728 --- /dev/null +++ b/rental_check_availability/i18n/rental_check_availability.pot @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * rental_check_availability +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-10-18 12:24+0000\n" +"PO-Revision-Date: 2021-10-18 12:24+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: rental_check_availability +#: model_terms:ir.ui.view,arch_db:rental_check_availability.view_order_form_order_line_tree_color +msgid "Check Availability" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__concurrent_orders +msgid "Concurrent Orders" +msgstr "" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:114 +#, python-format +msgid "No found concurrent Rental Order/Quotation(s)." +msgstr "" + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "None" +msgstr "" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:48 +#, python-format +msgid "Not enough stock!" +msgstr "" + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "Order" +msgstr "" + +#. module: rental_check_availability +#: selection:sale.order.line,concurrent_orders:0 +msgid "Quotation" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model,name:rental_check_availability.model_sale_order +msgid "Sale Order" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model,name:rental_check_availability.model_sale_order_line +msgid "Sales Order Line" +msgstr "" + +#. module: rental_check_availability +#: model_terms:ir.ui.view,arch_db:rental_check_availability.view_order_form +msgid "View concurrent Order/Quotation(s)" +msgstr "" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:49 +#, python-format +msgid "You want to rent %.2f %s but you only have %.2f %s available in the selected period." +msgstr "" + diff --git a/rental_check_availability/models/__init__.py b/rental_check_availability/models/__init__.py new file mode 100644 index 00000000..27d189bd --- /dev/null +++ b/rental_check_availability/models/__init__.py @@ -0,0 +1,2 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. +from . import sale diff --git a/rental_check_availability/models/sale.py b/rental_check_availability/models/sale.py new file mode 100644 index 00000000..ece20589 --- /dev/null +++ b/rental_check_availability/models/sale.py @@ -0,0 +1,142 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. +from odoo import models, fields, api, exceptions, _ + + +class SaleOrder(models.Model): + _inherit = "sale.order" + + @api.multi + def action_check_rental_availability(self): + for order in self: + for line in order.order_line: + line._check_rental_availability() + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + concurrent_orders = fields.Selection( + selection=[ + ("none", "None"), + ("quotation", "Quotation"), + ("order", "Order"), + ], + default="none", + ) + + # (override) _check_rental_availability in module rental_pricelist + @api.multi + def _check_rental_availability(self): + self.ensure_one() + res = {} + if not self.start_date or not self.end_date or not self.rental_qty: + return {} + total_qty = self.product_id.rented_product_id.with_context( + {"location": self.order_id.warehouse_id.rental_view_location_id.id} + ).qty_available + max_ol_qty = self._get_max_overlapping_rental_qty() + avail_qty = total_qty - max_ol_qty + if self.rental_qty > avail_qty: + res = self._get_concurrent_orders() + if total_qty == 0: + self.concurrent_orders = "none" + elif res["quotation"] and not res["order"]: + self.concurrent_orders = "quotation" + else: + self.concurrent_orders = "order" + res["warning"] = { + "title": _("Not enough stock!"), + "message": _( + "You want to rent %.2f %s but you only " + "have %.2f %s available in the selected period." + ) + % ( + self.rental_qty, + self.product_id.rented_product_id.uom_id.name, + avail_qty, + self.product_id.rented_product_id.uom_id.name, + ), + } + else: + self.concurrent_orders = "none" + return res + + @api.onchange("start_date", "end_date", "product_uom") + def onchange_start_end_date(self): + res = {} + if self.start_date and self.end_date: + number = self._get_number_of_time_unit() + self.number_of_time_unit = number + res = self._check_rental_availability() + return res + + @api.multi + def _get_concurrent_order_lines(self): + self.ensure_one() + domain = [] + if self.id: + domain = [("id", "!=", self.id)] + domain += [ + ("state", "!=", "cancel"), + ("display_product_id", "=", self.display_product_id.id), + "|", + "&", + ("start_date", "<=", self.start_date), + ("end_date", ">=", self.start_date), + "&", + ("start_date", "<=", self.end_date), + ("end_date", ">=", self.end_date), + ] + res = self.search(domain) + return res + + @api.multi + def _get_concurrent_orders(self): + self.ensure_one() + sols = self._get_concurrent_order_lines() + sos = sols.mapped("order_id") + quotations = sos.filtered(lambda o: o.state in ["draft", "sent"]) + orders = sos.filtered(lambda o: o.state in ["sale"]) + return { + "quotation": quotations, + "order": orders, + "sale_order_ids": quotations.ids + orders.ids, + } + + @api.multi + def action_view_concurrent_orders(self): + self.ensure_one() + record_ids = self._get_concurrent_orders()["sale_order_ids"] + if record_ids: + action = self.env.ref("rental_base.action_rental_orders").read([])[0] + action["domain"] = [("id", "in", record_ids)] + return action + raise exceptions.UserError(_("No found concurrent Rental Order/Quotation(s).")) + + @api.multi + def _get_max_overlapping_rental_qty(self): + self.ensure_one() + lines = self._get_concurrent_order_lines() + max_qty = 0 + for line in lines: + ol_lines = self.search( + [ + ("id", "in", lines.ids), + ("start_date", "<=", line.start_date), + ("end_date", ">=", line.start_date), + ] + ) + tmp_qty = sum(l.rental_qty for l in ol_lines) + if tmp_qty > max_qty: + max_qty = tmp_qty + ol_lines = self.search( + [ + ("id", "in", lines.ids), + ("start_date", "<=", line.end_date), + ("end_date", ">=", line.end_date), + ] + ) + tmp_qty = sum(l.rental_qty for l in ol_lines) + if tmp_qty > max_qty: + max_qty = tmp_qty + return max_qty diff --git a/rental_check_availability/static/description/index.html b/rental_check_availability/static/description/index.html new file mode 100644 index 00000000..380ba763 --- /dev/null +++ b/rental_check_availability/static/description/index.html @@ -0,0 +1,408 @@ + + + + + + +Rental Check Availability + + + +
+

Rental Check Availability

+ +

This file has been generated on 2021-10-25-10-18-19. Changes to it will be overwritten.

+
+

Summary

+

Extends the sale_rental module for checking availability of the rented product.

+
+
+

Description

+

This module activates availability checks on stockable products related to rental services in +sale orders. In the base functionality only the total amount of products in stock is checked and user is +informed when the amount of products to rent out in a sale order is higher.

+

After the installation of this module the availability is checked in consideration of the total amount +of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. +In case of insufficient products in stock the user receives visual notification on respective sale order line +and can access the list of concurrent sale orders directly.

+
+
+

Usage

+

To use this module, you need to:

+
    +
  1. Go to Rental Orders and create a new one.
  2. +
  3. Add a product available for being rented out in sale order line.
  4. +
  5. If there is not enough stock on hand to fullfil the order and +possible concurrent ones the sale order line will be colorized. +Yellow marks that there are concurrent quotations and red indicates +concurrent orders.
  6. +
  7. To check the concurrent order for a critical sale order line just click +on the inline button being displayed in the sale order line.
  8. +
+
+
+

Changelog

+
    +
  • 39845816 2021-10-21 14:15:20 +0200 yweng@elegosoft.com (origin/feature_4436_blp1250_unittest_rental_check_availability_v12) [IMP] update translations and manifest of module rental_pricelist_interval and rental_check_availability (issue 4436)
  • +
  • d8665dd9 2021-10-19 12:26:31 +0200 yweng@elegosoft.com [IMP] Add Unittest for module rental_check_availability and adjust Unittest of rental_pricelist and rental_pricelist_interval (issue 4436)
  • +
  • 8b4d40c4 2021-09-23 09:19:24 +0200 wagner@elegosoft.com regenerate doc (issue #4016)
  • +
  • dd988a2f 2021-06-09 12:42:47 +0200 wagner@elegosoft.com update documentation (issue #3613)
  • +
  • 78a00cdd 2021-04-28 02:43:00 +0200 yweng@elegosoft.com (origin/feature_4222_blp622_rental_check_availability_v12, feature_4222_blp622_rental_check_availability_v12) [IMP] adjust tree view of sale.order and hide the button 'show concurrent order' for product with zero quantity
  • +
  • 0cc27ac8 2021-03-28 21:45:23 +0200 yweng@elegosoft.com (origin/feature_4046_blp564_rental_check_availability_v12) [ADD] Module rental_check_availability (issue 4046)
  • +
+
+
+ + diff --git a/rental_check_availability/tests/__init__.py b/rental_check_availability/tests/__init__.py new file mode 100644 index 00000000..67a577ee --- /dev/null +++ b/rental_check_availability/tests/__init__.py @@ -0,0 +1,3 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. + +from . import test_check_availability diff --git a/rental_check_availability/tests/test_check_availability.py b/rental_check_availability/tests/test_check_availability.py new file mode 100644 index 00000000..0219e5b4 --- /dev/null +++ b/rental_check_availability/tests/test_check_availability.py @@ -0,0 +1,146 @@ +# Part of rental-vertical See LICENSE file for full copyright and licensing details. + +from dateutil.relativedelta import relativedelta +from odoo.addons.rental_base.tests.stock_common import RentalStockCommon +from odoo.addons.rental_pricelist.tests.test_rental_pricelist import _run_sol_onchange_display_product_id, _run_sol_onchange_date +from odoo import fields + + +class TestRentalCheckAvailability(RentalStockCommon): + def setUp(self): + super().setUp() + + # Product Created A + ProductObj = self.env["product.product"] + self.productA = ProductObj.create( + { + "name": "Product A", + "type": "product", + "rental": True, + "rental_of_day": True, + "rental_price_day": 100, + } + ) + self.today = fields.Date.from_string(fields.Date.today()) + self.date_2_day_later = self.today + relativedelta(days=2) + self.date_5_day_later = self.today + relativedelta(days=5) + self.date_10_day_later = self.today + relativedelta(days=10) + self.date_15_day_later = self.today + relativedelta(days=15) + self.date_20_day_later = self.today + relativedelta(days=20) + self.date_25_day_later = self.today + relativedelta(days=25) + self.date_27_day_later = self.today + relativedelta(days=27) + self.date_30_day_later = self.today + relativedelta(days=30) + + def create_rental_order(self, start_date, end_date, qty): + rental_order = ( + self.env["sale.order"] + .with_context( + { + "default_type_id": self.rental_sale_type.id, + } + ) + .create( + { + "warehouse_id": self.warehouse0.id, + "partner_id": self.partnerA.id, + "pricelist_id": self.env.ref("product.list0").id, + } + ) + ) + line = ( + self.env["sale.order.line"] + .with_context( + { + "type_id": self.rental_sale_type.id, + } + ) + .new( + { + "order_id": rental_order.id, + "display_product_id": self.productA.id, + "start_date": start_date, + "end_date": end_date, + } + ) + ) + _run_sol_onchange_display_product_id(line) + line.rental_qty = qty + _run_sol_onchange_date(line) + values = line._convert_to_write(line._cache) + self.env["sale.order.line"].create(values) + return rental_order + + def test_00_check_availability(self): + # Rental Orders + # RO 1 (qty: 2) today -------- 10 (none) + # RO 2 (qty: 2) 20 ----------- 30 (none) + # RO 3 (qty: 3) 27 - 30 (quotation) + # RO 4 (qty: 1) 5 ----------------------- 25 (none) + # RO 5 (qty: 3) today - 2 (order) + # RO 6 (qty: 1) 5 --------- 15 (none) + expected_warning = { + 'title': 'Not enough stock!', + 'message': 'You want to rent 3.00 Unit(s) but you only have 2.00 Unit(s) available in the selected period.' + } + #create some quantity of productA (qty: 4) + self.env['stock.quant']._update_available_quantity(self.productA, self.warehouse0.rental_in_location_id, 4) + #RO 1 + rental_order_1 = self.create_rental_order( + self.today, self.date_10_day_later, 2 + ) + rental_order_1.action_confirm() + self.assertEqual( + rental_order_1.order_line.concurrent_orders, 'none' + ) + + #RO 2 + rental_order_2 = self.create_rental_order( + self.date_20_day_later, self.date_30_day_later, 2 + ) + self.assertEqual( + rental_order_2.order_line.concurrent_orders, 'none' + ) + + #RO 3 + rental_order_3 = self.create_rental_order( + self.date_27_day_later, self.date_30_day_later, 3 + ) + res = rental_order_3.order_line.onchange_start_end_date() + self.assertEqual(res.get("warning", False), expected_warning) + self.assertEqual( + rental_order_3.order_line.concurrent_orders, 'quotation' + ) + action = rental_order_3.order_line.action_view_concurrent_orders() + self.assertEqual( + action.get("domain", False), [("id", "in", [rental_order_2.id])] + ) + + #RO 4 + rental_order_4 = self.create_rental_order( + self.date_5_day_later, self.date_25_day_later, 1 + ) + self.assertEqual( + rental_order_4.order_line.concurrent_orders, 'none' + ) + + #RO 5 + rental_order_5 = self.create_rental_order( + self.today, self.date_2_day_later, 3 + ) + res = rental_order_5.order_line.onchange_start_end_date() + self.assertEqual(res.get("warning", False), expected_warning) + self.assertEqual( + rental_order_5.order_line.concurrent_orders, 'order' + ) + action = rental_order_5.order_line.action_view_concurrent_orders() + self.assertEqual( + action.get("domain", False), [("id", "in", [rental_order_1.id])] + ) + + #RO 6 + rental_order_6 = self.create_rental_order( + self.date_5_day_later, self.date_15_day_later, 1 + ) + self.assertEqual( + rental_order_6.order_line.concurrent_orders, 'none' + ) diff --git a/rental_check_availability/views/sale_view.xml b/rental_check_availability/views/sale_view.xml new file mode 100644 index 00000000..7e5e3ba6 --- /dev/null +++ b/rental_check_availability/views/sale_view.xml @@ -0,0 +1,57 @@ + + + + sale_rental.view_order_form + sale.order + + + + + + + + + From 8b6afb7a96b6a4bc41296220959f2df2be29b508 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 26 Oct 2021 11:41:30 +0000 Subject: [PATCH 2/6] [ADD] icon.png --- .../static/description/icon.png | Bin 0 -> 9455 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 rental_check_availability/static/description/icon.png diff --git a/rental_check_availability/static/description/icon.png b/rental_check_availability/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#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u;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 From 5dcaec30c5754688f758502724eaea4478d16677 Mon Sep 17 00:00:00 2001 From: oca-travis Date: Mon, 1 Nov 2021 16:14:28 +0000 Subject: [PATCH 3/6] [UPD] Update rental_check_availability.pot --- rental_check_availability/i18n/rental_check_availability.pot | 2 -- 1 file changed, 2 deletions(-) diff --git a/rental_check_availability/i18n/rental_check_availability.pot b/rental_check_availability/i18n/rental_check_availability.pot index 0452b728..7de29b8c 100644 --- a/rental_check_availability/i18n/rental_check_availability.pot +++ b/rental_check_availability/i18n/rental_check_availability.pot @@ -6,8 +6,6 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 12.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-18 12:24+0000\n" -"PO-Revision-Date: 2021-10-18 12:24+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" From 2aeaef5478a3e4f246fe42c8b53251a8a5ac5342 Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Mon, 1 Nov 2021 16:14:49 +0000 Subject: [PATCH 4/6] Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: vertical-rental-12.0/vertical-rental-12.0-rental_check_availability Translate-URL: https://translation.odoo-community.org/projects/vertical-rental-12-0/vertical-rental-12-0-rental_check_availability/ --- rental_check_availability/i18n/de.po | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rental_check_availability/i18n/de.po b/rental_check_availability/i18n/de.po index 2bc9ae15..46dc2fde 100644 --- a/rental_check_availability/i18n/de.po +++ b/rental_check_availability/i18n/de.po @@ -10,11 +10,11 @@ msgstr "" "PO-Revision-Date: 2021-10-18 14:06+0200\n" "Last-Translator: <>\n" "Language-Team: \n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" -"Language: de\n" "X-Generator: Poedit 3.0\n" #. module: rental_check_availability @@ -72,5 +72,9 @@ msgstr "Zeitgleiche Aufträge anzeigen." #. module: rental_check_availability #: code:addons/rental_check_availability/models/sale.py:49 #, python-format -msgid "You want to rent %.2f %s but you only have %.2f %s available in the selected period." -msgstr "Sie versuchen %.2f %s Einheiten zu vermieten, es sind aber nur %.2f %s Einheiten im aktuellen Bestand verfügbar." +msgid "" +"You want to rent %.2f %s but you only have %.2f %s available in the selected " +"period." +msgstr "" +"Sie versuchen %.2f %s Einheiten zu vermieten, es sind aber nur %.2f %s " +"Einheiten im aktuellen Bestand verfügbar." From bd61619bc0216d7cfb02d11c05c2ee657e751682 Mon Sep 17 00:00:00 2001 From: cpatel Date: Wed, 20 Apr 2022 11:23:27 +0200 Subject: [PATCH 5/6] [IMP] rental_check_availability: black, isort, prettier --- .../README/CONTRIBUTORS.rst | 1 - .../README/DESCRIPTION.rst | 1 - rental_check_availability/README/HISTORY.rst | 1 - rental_check_availability/README/USAGE.rst | 1 - rental_check_availability/models/sale.py | 2 +- .../tests/test_check_availability.py | 61 ++++++++----------- rental_check_availability/views/sale_view.xml | 45 ++++++++------ .../odoo/addons/rental_check_availability | 1 + setup/rental_check_availability/setup.py | 6 ++ 9 files changed, 61 insertions(+), 58 deletions(-) create mode 120000 setup/rental_check_availability/odoo/addons/rental_check_availability create mode 100644 setup/rental_check_availability/setup.py diff --git a/rental_check_availability/README/CONTRIBUTORS.rst b/rental_check_availability/README/CONTRIBUTORS.rst index ebff9100..a6aaabaa 100644 --- a/rental_check_availability/README/CONTRIBUTORS.rst +++ b/rental_check_availability/README/CONTRIBUTORS.rst @@ -5,4 +5,3 @@ Contributors Odoo Community Association (OCA)/Elego Software Solutions GmbH * Ben Brich (www.humanilog.org) * Yu Weng (www.elegosoft.com) - diff --git a/rental_check_availability/README/DESCRIPTION.rst b/rental_check_availability/README/DESCRIPTION.rst index fd17723a..f82f2be0 100644 --- a/rental_check_availability/README/DESCRIPTION.rst +++ b/rental_check_availability/README/DESCRIPTION.rst @@ -19,4 +19,3 @@ After the installation of this module the availability is checked in considerati of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. In case of insufficient products in stock the user receives visual notification on respective sale order line and can access the list of concurrent sale orders directly. - diff --git a/rental_check_availability/README/HISTORY.rst b/rental_check_availability/README/HISTORY.rst index acd02dbe..7263b56c 100644 --- a/rental_check_availability/README/HISTORY.rst +++ b/rental_check_availability/README/HISTORY.rst @@ -8,4 +8,3 @@ Changelog - dd988a2f 2021-06-09 12:42:47 +0200 wagner@elegosoft.com update documentation (issue #3613) - 78a00cdd 2021-04-28 02:43:00 +0200 yweng@elegosoft.com (origin/feature_4222_blp622_rental_check_availability_v12, feature_4222_blp622_rental_check_availability_v12) [IMP] adjust tree view of sale.order and hide the button 'show concurrent order' for product with zero quantity - 0cc27ac8 2021-03-28 21:45:23 +0200 yweng@elegosoft.com (origin/feature_4046_blp564_rental_check_availability_v12) [ADD] Module rental_check_availability (issue 4046) - diff --git a/rental_check_availability/README/USAGE.rst b/rental_check_availability/README/USAGE.rst index d8f48ca4..5c58c398 100644 --- a/rental_check_availability/README/USAGE.rst +++ b/rental_check_availability/README/USAGE.rst @@ -15,4 +15,3 @@ To use this module, you need to: #. To check the concurrent order for a critical sale order line just click on the inline button being displayed in the sale order line. - diff --git a/rental_check_availability/models/sale.py b/rental_check_availability/models/sale.py index ece20589..179d9dcc 100644 --- a/rental_check_availability/models/sale.py +++ b/rental_check_availability/models/sale.py @@ -1,5 +1,5 @@ # Part of rental-vertical See LICENSE file for full copyright and licensing details. -from odoo import models, fields, api, exceptions, _ +from odoo import _, api, exceptions, fields, models class SaleOrder(models.Model): diff --git a/rental_check_availability/tests/test_check_availability.py b/rental_check_availability/tests/test_check_availability.py index 0219e5b4..04b43a80 100644 --- a/rental_check_availability/tests/test_check_availability.py +++ b/rental_check_availability/tests/test_check_availability.py @@ -1,10 +1,15 @@ # Part of rental-vertical See LICENSE file for full copyright and licensing details. from dateutil.relativedelta import relativedelta -from odoo.addons.rental_base.tests.stock_common import RentalStockCommon -from odoo.addons.rental_pricelist.tests.test_rental_pricelist import _run_sol_onchange_display_product_id, _run_sol_onchange_date + from odoo import fields +from odoo.addons.rental_base.tests.stock_common import RentalStockCommon +from odoo.addons.rental_pricelist.tests.test_rental_pricelist import ( + _run_sol_onchange_date, + _run_sol_onchange_display_product_id, +) + class TestRentalCheckAvailability(RentalStockCommon): def setUp(self): @@ -79,68 +84,54 @@ def test_00_check_availability(self): # RO 5 (qty: 3) today - 2 (order) # RO 6 (qty: 1) 5 --------- 15 (none) expected_warning = { - 'title': 'Not enough stock!', - 'message': 'You want to rent 3.00 Unit(s) but you only have 2.00 Unit(s) available in the selected period.' + "title": "Not enough stock!", + "message": "You want to rent 3.00 Unit(s) but you only have 2.00 Unit(s) available in the selected period.", } - #create some quantity of productA (qty: 4) - self.env['stock.quant']._update_available_quantity(self.productA, self.warehouse0.rental_in_location_id, 4) - #RO 1 - rental_order_1 = self.create_rental_order( - self.today, self.date_10_day_later, 2 + # create some quantity of productA (qty: 4) + self.env["stock.quant"]._update_available_quantity( + self.productA, self.warehouse0.rental_in_location_id, 4 ) + # RO 1 + rental_order_1 = self.create_rental_order(self.today, self.date_10_day_later, 2) rental_order_1.action_confirm() - self.assertEqual( - rental_order_1.order_line.concurrent_orders, 'none' - ) + self.assertEqual(rental_order_1.order_line.concurrent_orders, "none") - #RO 2 + # RO 2 rental_order_2 = self.create_rental_order( self.date_20_day_later, self.date_30_day_later, 2 ) - self.assertEqual( - rental_order_2.order_line.concurrent_orders, 'none' - ) + self.assertEqual(rental_order_2.order_line.concurrent_orders, "none") - #RO 3 + # RO 3 rental_order_3 = self.create_rental_order( self.date_27_day_later, self.date_30_day_later, 3 ) res = rental_order_3.order_line.onchange_start_end_date() self.assertEqual(res.get("warning", False), expected_warning) - self.assertEqual( - rental_order_3.order_line.concurrent_orders, 'quotation' - ) + self.assertEqual(rental_order_3.order_line.concurrent_orders, "quotation") action = rental_order_3.order_line.action_view_concurrent_orders() self.assertEqual( action.get("domain", False), [("id", "in", [rental_order_2.id])] ) - #RO 4 + # RO 4 rental_order_4 = self.create_rental_order( self.date_5_day_later, self.date_25_day_later, 1 ) - self.assertEqual( - rental_order_4.order_line.concurrent_orders, 'none' - ) + self.assertEqual(rental_order_4.order_line.concurrent_orders, "none") - #RO 5 - rental_order_5 = self.create_rental_order( - self.today, self.date_2_day_later, 3 - ) + # RO 5 + rental_order_5 = self.create_rental_order(self.today, self.date_2_day_later, 3) res = rental_order_5.order_line.onchange_start_end_date() self.assertEqual(res.get("warning", False), expected_warning) - self.assertEqual( - rental_order_5.order_line.concurrent_orders, 'order' - ) + self.assertEqual(rental_order_5.order_line.concurrent_orders, "order") action = rental_order_5.order_line.action_view_concurrent_orders() self.assertEqual( action.get("domain", False), [("id", "in", [rental_order_1.id])] ) - #RO 6 + # RO 6 rental_order_6 = self.create_rental_order( self.date_5_day_later, self.date_15_day_later, 1 ) - self.assertEqual( - rental_order_6.order_line.concurrent_orders, 'none' - ) + self.assertEqual(rental_order_6.order_line.concurrent_orders, "none") diff --git a/rental_check_availability/views/sale_view.xml b/rental_check_availability/views/sale_view.xml index 7e5e3ba6..1bb05ff4 100644 --- a/rental_check_availability/views/sale_view.xml +++ b/rental_check_availability/views/sale_view.xml @@ -1,23 +1,27 @@ - + sale_rental.view_order_form sale.order - - - diff --git a/setup/rental_check_availability/odoo/addons/rental_check_availability b/setup/rental_check_availability/odoo/addons/rental_check_availability new file mode 120000 index 00000000..ea97753f --- /dev/null +++ b/setup/rental_check_availability/odoo/addons/rental_check_availability @@ -0,0 +1 @@ +../../../../rental_check_availability \ No newline at end of file diff --git a/setup/rental_check_availability/setup.py b/setup/rental_check_availability/setup.py new file mode 100644 index 00000000..28c57bb6 --- /dev/null +++ b/setup/rental_check_availability/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) From f23c190ccd6421ed98a6f7eddcad572d7404de4f Mon Sep 17 00:00:00 2001 From: cpatel Date: Wed, 20 Apr 2022 12:14:33 +0200 Subject: [PATCH 6/6] [MIG] rental_check_availability: Migration to 14.0 --- rental_check_availability/README.rst | 46 +++++++++++++++++++ .../README/CONTRIBUTORS.rst | 5 +- .../README/DESCRIPTION.rst | 10 ++-- rental_check_availability/README/HISTORY.rst | 8 +--- rental_check_availability/__manifest__.py | 42 ++++------------- rental_check_availability/i18n/de.po | 46 +++++++++++++------ .../i18n/rental_check_availability.pot | 45 +++++++++++++----- rental_check_availability/models/sale.py | 13 ++---- .../static/description/index.html | 10 ++-- .../tests/test_check_availability.py | 5 +- rental_check_availability/views/sale_view.xml | 4 +- 11 files changed, 140 insertions(+), 94 deletions(-) create mode 100644 rental_check_availability/README.rst diff --git a/rental_check_availability/README.rst b/rental_check_availability/README.rst new file mode 100644 index 00000000..fab23a32 --- /dev/null +++ b/rental_check_availability/README.rst @@ -0,0 +1,46 @@ +Rental Check Availability +==================================================== + +*This file has been generated on 2022-04-20-11-34-50. Changes to it will be overwritten.* + +Summary +------- + +Extends the sale_rental module for checking availability of the rented product. + +Description +----------- + +This module activates availability checks on stockable products related to rental services in +sale orders. In the base functionality only the total amount of products in stock is checked and user is +informed when the amount of products to rent out in a sale order is higher. + +After the installation of this module the availability is checked in consideration of the total amount +of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. +In case of insufficient products in stock the user receives visual notification on respective sale order line +and can access the list of concurrent sale orders directly. + + +Usage +----- + +To use this module, you need to: + +#. Go to Rental Orders and create a new one. + +#. Add a product available for being rented out in sale order line. + +#. If there is not enough stock on hand to fullfil the order and + possible concurrent ones the sale order line will be colorized. + Yellow marks that there are concurrent quotations and red indicates + concurrent orders. + +#. To check the concurrent order for a critical sale order line just click + on the inline button being displayed in the sale order line. + +Changelog +--------- + +- 8d191ff7 2022-04-10 15:41:16 +0200 wagner@elegosoft.com (HEAD -> v14, origin/v14) add missing/lost documentation (issue #4516) +- 4509f78a 2022-02-23 20:48:33 +0100 wagner@elegosoft.com (origin/feature_4516_add_files_ported_from_v12_v14, feature_4516_add_files_ported_from_v12_v14) add files ported to v14 by cpatel and khanhbui (issue #4516) + diff --git a/rental_check_availability/README/CONTRIBUTORS.rst b/rental_check_availability/README/CONTRIBUTORS.rst index a6aaabaa..357fa53c 100644 --- a/rental_check_availability/README/CONTRIBUTORS.rst +++ b/rental_check_availability/README/CONTRIBUTORS.rst @@ -2,6 +2,5 @@ Contributors ------------ -Odoo Community Association (OCA)/Elego Software Solutions GmbH -* Ben Brich (www.humanilog.org) -* Yu Weng (www.elegosoft.com) +elego Software Solutions GmbH, Odoo Community Association (OCA) +Ben Brich (www.humanilog.org), Yu Weng (www.elegosoft.com) diff --git a/rental_check_availability/README/DESCRIPTION.rst b/rental_check_availability/README/DESCRIPTION.rst index f82f2be0..4bb39ded 100644 --- a/rental_check_availability/README/DESCRIPTION.rst +++ b/rental_check_availability/README/DESCRIPTION.rst @@ -1,7 +1,7 @@ Rental Check Availability ==================================================== -*This file has been generated on 2021-10-25-10-18-19. Changes to it will be overwritten.* +*This file has been generated on 2022-04-20-11-34-50. Changes to it will be overwritten.* Summary ------- @@ -12,10 +12,10 @@ Description ----------- This module activates availability checks on stockable products related to rental services in -sale orders. In the base functionality only the total amount of products in stock is checked and user is +sale orders. In the base functionality, only the total amount of products in stock is checked and the user is informed when the amount of products to rent out in a sale order is higher. -After the installation of this module the availability is checked in consideration of the total amount -of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. -In case of insufficient products in stock the user receives visual notification on respective sale order line +After the installation of this module, the availability is checked in consideration of the total amount +of goods in stock and the amount of products used in concurrent sale orders at a certain desired timeframe. +In case of insufficient products in stock, the user receives a visual notification on the respective sale order line and can access the list of concurrent sale orders directly. diff --git a/rental_check_availability/README/HISTORY.rst b/rental_check_availability/README/HISTORY.rst index 7263b56c..d3b08eb7 100644 --- a/rental_check_availability/README/HISTORY.rst +++ b/rental_check_availability/README/HISTORY.rst @@ -2,9 +2,5 @@ Changelog --------- -- 39845816 2021-10-21 14:15:20 +0200 yweng@elegosoft.com (origin/feature_4436_blp1250_unittest_rental_check_availability_v12) [IMP] update translations and manifest of module rental_pricelist_interval and rental_check_availability (issue 4436) -- d8665dd9 2021-10-19 12:26:31 +0200 yweng@elegosoft.com [IMP] Add Unittest for module rental_check_availability and adjust Unittest of rental_pricelist and rental_pricelist_interval (issue 4436) -- 8b4d40c4 2021-09-23 09:19:24 +0200 wagner@elegosoft.com regenerate doc (issue #4016) -- dd988a2f 2021-06-09 12:42:47 +0200 wagner@elegosoft.com update documentation (issue #3613) -- 78a00cdd 2021-04-28 02:43:00 +0200 yweng@elegosoft.com (origin/feature_4222_blp622_rental_check_availability_v12, feature_4222_blp622_rental_check_availability_v12) [IMP] adjust tree view of sale.order and hide the button 'show concurrent order' for product with zero quantity -- 0cc27ac8 2021-03-28 21:45:23 +0200 yweng@elegosoft.com (origin/feature_4046_blp564_rental_check_availability_v12) [ADD] Module rental_check_availability (issue 4046) +- 8d191ff7 2022-04-10 15:41:16 +0200 wagner@elegosoft.com (HEAD -> v14, origin/v14) add missing/lost documentation (issue #4516) +- 4509f78a 2022-02-23 20:48:33 +0100 wagner@elegosoft.com (origin/feature_4516_add_files_ported_from_v12_v14, feature_4516_add_files_ported_from_v12_v14) add files ported to v14 by cpatel and khanhbui (issue #4516) diff --git a/rental_check_availability/__manifest__.py b/rental_check_availability/__manifest__.py index e1106bde..ec5a3b72 100644 --- a/rental_check_availability/__manifest__.py +++ b/rental_check_availability/__manifest__.py @@ -2,39 +2,16 @@ { "name": "Rental Check Availability", - "summary": "Extends the sale_rental module for checking availability of the rented product.", - "description": """ -This module activates availability checks on stockable products related to rental services in -sale orders. In the base functionality only the total amount of products in stock is checked and user is -informed when the amount of products to rent out in a sale order is higher. - -After the installation of this module the availability is checked in consideration of the total amount -of goods in stock and the amount of products used in concurrent sale orders at the certain desired timeframe. -In case of insufficient products in stock the user receives visual notification on respective sale order line -and can access the list of concurrent sale orders directly. -""", - "usage": """ -To use this module, you need to: - -#. Go to Rental Orders and create a new one. - -#. Add a product available for being rented out in sale order line. - -#. If there is not enough stock on hand to fullfil the order and - possible concurrent ones the sale order line will be colorized. - Yellow marks that there are concurrent quotations and red indicates - concurrent orders. - -#. To check the concurrent order for a critical sale order line just click - on the inline button being displayed in the sale order line. -""", - "contributors": """ -* Ben Brich (www.humanilog.org) -* Yu Weng (www.elegosoft.com) -""", - "version": "12.0.1.0.0", + "summary": "Extends the sale_rental module for checking availability" + "of the rented product.", + "version": "14.0.1.0.0", "category": "Rental", - "author": "Odoo Community Association (OCA)/Elego Software Solutions GmbH", + "author": "elego Software Solutions GmbH, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/vertical-rental", + "contributors": [ + "Ben Brich (www.humanilog.org)", + "Yu Weng (www.elegosoft.com)", + ], "depends": [ "rental_pricelist", ], @@ -44,5 +21,6 @@ "demo": [], "qweb": [], "application": False, + "installable": True, "license": "AGPL-3", } diff --git a/rental_check_availability/i18n/de.po b/rental_check_availability/i18n/de.po index 46dc2fde..f487e56a 100644 --- a/rental_check_availability/i18n/de.po +++ b/rental_check_availability/i18n/de.po @@ -4,18 +4,16 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-18 11:56+0000\n" -"PO-Revision-Date: 2021-10-18 14:06+0200\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2022-01-06 14:13+0000\n" +"PO-Revision-Date: 2022-01-06 14:13+0000\n" +"Last-Translator: \n" "Language-Team: \n" -"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" +"Content-Transfer-Encoding: \n" "Plural-Forms: \n" -"X-Generator: Poedit 3.0\n" #. module: rental_check_availability #: model_terms:ir.ui.view,arch_db:rental_check_availability.view_order_form_order_line_tree_color @@ -28,29 +26,47 @@ msgid "Concurrent Orders" msgstr "Zeitgleiche Aufträge" #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:114 +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order__display_name +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order__id +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__id +msgid "ID" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order____last_update +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line____last_update +msgid "Last Modified on" +msgstr "Zuletzt geändert am" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format msgid "No found concurrent Rental Order/Quotation(s)." msgstr "Es konnten keine zeitgleichen Aufträge gefunden werden." #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__none msgid "None" msgstr "Keine" #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:48 +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format msgid "Not enough stock!" msgstr "Bestand nicht ausreichend!" #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__order msgid "Order" msgstr "Auftrag" #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__quotation msgid "Quotation" msgstr "Angebot" @@ -70,11 +86,11 @@ msgid "View concurrent Order/Quotation(s)" msgstr "Zeitgleiche Aufträge anzeigen." #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:49 +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format msgid "" -"You want to rent %.2f %s but you only have %.2f %s available in the selected " -"period." +"You want to rent %.2f %s but you only have %.2f %s available in the selected" +" period." msgstr "" "Sie versuchen %.2f %s Einheiten zu vermieten, es sind aber nur %.2f %s " "Einheiten im aktuellen Bestand verfügbar." diff --git a/rental_check_availability/i18n/rental_check_availability.pot b/rental_check_availability/i18n/rental_check_availability.pot index 7de29b8c..676918f3 100644 --- a/rental_check_availability/i18n/rental_check_availability.pot +++ b/rental_check_availability/i18n/rental_check_availability.pot @@ -1,12 +1,14 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * rental_check_availability +# * rental_check_availability # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2022-01-06 14:13+0000\n" +"PO-Revision-Date: 2022-01-06 14:13+0000\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -24,35 +26,53 @@ msgid "Concurrent Orders" msgstr "" #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:114 +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order__display_name +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__display_name +msgid "Display Name" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order__id +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line__id +msgid "ID" +msgstr "" + +#. module: rental_check_availability +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order____last_update +#: model:ir.model.fields,field_description:rental_check_availability.field_sale_order_line____last_update +msgid "Last Modified on" +msgstr "" + +#. module: rental_check_availability +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format msgid "No found concurrent Rental Order/Quotation(s)." msgstr "" #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__none msgid "None" msgstr "" #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:48 +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format msgid "Not enough stock!" msgstr "" #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__order msgid "Order" msgstr "" #. module: rental_check_availability -#: selection:sale.order.line,concurrent_orders:0 +#: model:ir.model.fields.selection,name:rental_check_availability.selection__sale_order_line__concurrent_orders__quotation msgid "Quotation" msgstr "" #. module: rental_check_availability #: model:ir.model,name:rental_check_availability.model_sale_order -msgid "Sale Order" +msgid "Sales Order" msgstr "" #. module: rental_check_availability @@ -66,8 +86,9 @@ msgid "View concurrent Order/Quotation(s)" msgstr "" #. module: rental_check_availability -#: code:addons/rental_check_availability/models/sale.py:49 +#: code:addons/rental_check_availability/models/sale.py:0 #, python-format -msgid "You want to rent %.2f %s but you only have %.2f %s available in the selected period." +msgid "" +"You want to rent %.2f %s but you only have %.2f %s available in the selected" +" period." msgstr "" - diff --git a/rental_check_availability/models/sale.py b/rental_check_availability/models/sale.py index 179d9dcc..45750fac 100644 --- a/rental_check_availability/models/sale.py +++ b/rental_check_availability/models/sale.py @@ -5,7 +5,6 @@ class SaleOrder(models.Model): _inherit = "sale.order" - @api.multi def action_check_rental_availability(self): for order in self: for line in order.order_line: @@ -24,8 +23,7 @@ class SaleOrderLine(models.Model): default="none", ) - # (override) _check_rental_availability in module rental_pricelist - @api.multi + # (override) from module rental_pricelist def _check_rental_availability(self): self.ensure_one() res = {} @@ -61,6 +59,7 @@ def _check_rental_availability(self): self.concurrent_orders = "none" return res + # (override) from module rental_pricelist @api.onchange("start_date", "end_date", "product_uom") def onchange_start_end_date(self): res = {} @@ -70,7 +69,6 @@ def onchange_start_end_date(self): res = self._check_rental_availability() return res - @api.multi def _get_concurrent_order_lines(self): self.ensure_one() domain = [] @@ -90,7 +88,6 @@ def _get_concurrent_order_lines(self): res = self.search(domain) return res - @api.multi def _get_concurrent_orders(self): self.ensure_one() sols = self._get_concurrent_order_lines() @@ -103,7 +100,6 @@ def _get_concurrent_orders(self): "sale_order_ids": quotations.ids + orders.ids, } - @api.multi def action_view_concurrent_orders(self): self.ensure_one() record_ids = self._get_concurrent_orders()["sale_order_ids"] @@ -113,7 +109,6 @@ def action_view_concurrent_orders(self): return action raise exceptions.UserError(_("No found concurrent Rental Order/Quotation(s).")) - @api.multi def _get_max_overlapping_rental_qty(self): self.ensure_one() lines = self._get_concurrent_order_lines() @@ -126,7 +121,7 @@ def _get_max_overlapping_rental_qty(self): ("end_date", ">=", line.start_date), ] ) - tmp_qty = sum(l.rental_qty for l in ol_lines) + tmp_qty = sum(line.rental_qty for line in ol_lines) if tmp_qty > max_qty: max_qty = tmp_qty ol_lines = self.search( @@ -136,7 +131,7 @@ def _get_max_overlapping_rental_qty(self): ("end_date", ">=", line.end_date), ] ) - tmp_qty = sum(l.rental_qty for l in ol_lines) + tmp_qty = sum(line.rental_qty for line in ol_lines) if tmp_qty > max_qty: max_qty = tmp_qty return max_qty diff --git a/rental_check_availability/static/description/index.html b/rental_check_availability/static/description/index.html index 380ba763..f7cc6a69 100644 --- a/rental_check_availability/static/description/index.html +++ b/rental_check_availability/static/description/index.html @@ -363,7 +363,7 @@

Rental Check Availability

-

This file has been generated on 2021-10-25-10-18-19. Changes to it will be overwritten.

+

This file has been generated on 2022-04-20-11-34-50. Changes to it will be overwritten.

Summary

Extends the sale_rental module for checking availability of the rented product.

@@ -395,12 +395,8 @@

Usage

Changelog

    -
  • 39845816 2021-10-21 14:15:20 +0200 yweng@elegosoft.com (origin/feature_4436_blp1250_unittest_rental_check_availability_v12) [IMP] update translations and manifest of module rental_pricelist_interval and rental_check_availability (issue 4436)
  • -
  • d8665dd9 2021-10-19 12:26:31 +0200 yweng@elegosoft.com [IMP] Add Unittest for module rental_check_availability and adjust Unittest of rental_pricelist and rental_pricelist_interval (issue 4436)
  • -
  • 8b4d40c4 2021-09-23 09:19:24 +0200 wagner@elegosoft.com regenerate doc (issue #4016)
  • -
  • dd988a2f 2021-06-09 12:42:47 +0200 wagner@elegosoft.com update documentation (issue #3613)
  • -
  • 78a00cdd 2021-04-28 02:43:00 +0200 yweng@elegosoft.com (origin/feature_4222_blp622_rental_check_availability_v12, feature_4222_blp622_rental_check_availability_v12) [IMP] adjust tree view of sale.order and hide the button 'show concurrent order' for product with zero quantity
  • -
  • 0cc27ac8 2021-03-28 21:45:23 +0200 yweng@elegosoft.com (origin/feature_4046_blp564_rental_check_availability_v12) [ADD] Module rental_check_availability (issue 4046)
  • +
  • 8d191ff7 2022-04-10 15:41:16 +0200 wagner@elegosoft.com (HEAD -> v14, origin/v14) add missing/lost documentation (issue #4516)
  • +
  • 4509f78a 2022-02-23 20:48:33 +0100 wagner@elegosoft.com (origin/feature_4516_add_files_ported_from_v12_v14, feature_4516_add_files_ported_from_v12_v14) add files ported to v14 by cpatel and khanhbui (issue #4516)
diff --git a/rental_check_availability/tests/test_check_availability.py b/rental_check_availability/tests/test_check_availability.py index 04b43a80..78ddfa9b 100644 --- a/rental_check_availability/tests/test_check_availability.py +++ b/rental_check_availability/tests/test_check_availability.py @@ -76,7 +76,7 @@ def create_rental_order(self, start_date, end_date, qty): return rental_order def test_00_check_availability(self): - # Rental Orders + # Rental Orders Info # RO 1 (qty: 2) today -------- 10 (none) # RO 2 (qty: 2) 20 ----------- 30 (none) # RO 3 (qty: 3) 27 - 30 (quotation) @@ -85,7 +85,8 @@ def test_00_check_availability(self): # RO 6 (qty: 1) 5 --------- 15 (none) expected_warning = { "title": "Not enough stock!", - "message": "You want to rent 3.00 Unit(s) but you only have 2.00 Unit(s) available in the selected period.", + "message": "You want to rent 3.00 Units but you only " + "have 2.00 Units available in the selected period.", } # create some quantity of productA (qty: 4) self.env["stock.quant"]._update_available_quantity( diff --git a/rental_check_availability/views/sale_view.xml b/rental_check_availability/views/sale_view.xml index 1bb05ff4..8035464d 100644 --- a/rental_check_availability/views/sale_view.xml +++ b/rental_check_availability/views/sale_view.xml @@ -15,7 +15,7 @@ type="object" icon="fa-list-alt" class="oe_inline" - string="View concurrent Order/Quotation(s)" + title="View concurrent Order/Quotation(s)" attrs="{'invisible': [ '|', ('concurrent_orders','=', 'none'), @@ -38,8 +38,6 @@ - - sale_rental.view_order_form sale.order