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

[15.0] [MIG] rental_product_pack #44

Open
wants to merge 16 commits into
base: 15.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions rental_product_pack/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Rental Product Pack
====================================================

*This file has been generated on 2023-02-19-14-21-34. Changes to it will be overwritten.*

Summary
-------

Manage rentals with product packs

Description
-----------

This module allows to manage rentals with product packs.
You can define product packs as described in the module product_pack.
The components of the pack are added to both rental stock pickings after order confirmation.


Usage
-----

Install the module.
No further configuration is needed.

Create at least one storable product that will be a component of a pack.
* Go to Rentals > Configuration > Settings.
* Please activate the checkbox for using 'Product Variants'.
* Go to Rentals > Products > Products.
* Create a new storable product.

Create a rentable pack product.
* Create a new storable product.
* Activate the checkbox 'Can be Rented' and 'Is Pack'.
* Go to page 'Pack'.
* Choose Pack Type (e.g. Non-detailled) and add the previously created storable products that are part of this pack.
* Go to page 'Sales & Purchase'.
* Create the rental service and configure its name and price.

Create a rental order:
* Go to Rentals > Customer > Rental Quotations.
* Create a new order and choose the type 'Rental Order'.
* Add the rental service of the rentable pack product as an order line.
* Set the quantity.
* Choose start and end date.
* Confirm the order.
* Check out the two deliveries, one for outgoing and one for incoming delivery.
* You can see all parts of the pack in both stock pickings.

Hint:
Refer to the usage information of the OCA module product_pack to learn how to
define product packs.
Please note, that this module does not include the behavior of the module sale_product_pack.

Changelog
---------

- 9089b1d5 2022-04-15 14:16:12 +0200 [email protected] (tag: odoo-fox-v15_v15_int_current_daily, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-26, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-25, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-23, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-22, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-21, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-17, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-16, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-15, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-13, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-12, tag: bp_fox_v15_integration-ceqp-2, tag: bp_fox_v15_integration-cep-27, tag: bp_fox_v15_integration-cep-26, tag: bp_fox_v15_integration-cep-25, tag: bp_fox_v15_integration-cep-23, tag: bp_fox_v15_integration-cep-22, tag: bp_fox_v15_integration-cep-21, tag: bp_fox_v15_integration-cep-17, tag: bp_fox_v15_integration-cep-16, tag: bp_fox_v15_integration-cep-15, tag: bp_fox_v15_integration-cep-13, tag: bp_fox_v15_integration-cep-12, tag: baseline_odoo-fox-v15_v15_fox_v15_daily_build-26, origin/fox_v15_integration-cep-26, origin/fox_v15_integration-cep-25, origin/fox_v15_integration-cep-23, origin/fox_v15_integration-cep-22, origin/fox_v15_integration-cep-21, origin/fox_v15_integration-cep-17, origin/fox_v15_integration-cep-16, origin/fox_v15_integration-cep-15, origin/fox_v15_integration-cep-13, origin/fox_v15_integration-cep-12) update module versions for v15 and remove old migration scripts (issue #4967)
- 8d191ff7 2022-04-10 15:41:16 +0200 [email protected] add missing/lost documentation (issue #4516)
- 4509f78a 2022-02-23 20:48:33 +0100 [email protected] (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)

5 changes: 5 additions & 0 deletions rental_product_pack/README/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

Contributors
------------

elego Software Solutions GmbH, Odoo Community Association (OCA)
16 changes: 16 additions & 0 deletions rental_product_pack/README/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Rental Product Pack
====================================================

*This file has been generated on 2023-02-19-14-21-34. Changes to it will be overwritten.*

Summary
-------

Manage rentals with product packs

Description
-----------

This module allows to manage rentals with product packs.
You can define product packs as described in the module product_pack.
The components of the pack are added to both rental stock pickings after order confirmation.
7 changes: 7 additions & 0 deletions rental_product_pack/README/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

Changelog
---------

- 9089b1d5 2022-04-15 14:16:12 +0200 [email protected] (tag: odoo-fox-v15_v15_int_current_daily, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-26, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-25, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-23, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-22, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-21, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-17, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-16, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-15, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-13, tag: daily_odoo-fox-v15_v15_fox_v15_daily_build-12, tag: bp_fox_v15_integration-ceqp-2, tag: bp_fox_v15_integration-cep-27, tag: bp_fox_v15_integration-cep-26, tag: bp_fox_v15_integration-cep-25, tag: bp_fox_v15_integration-cep-23, tag: bp_fox_v15_integration-cep-22, tag: bp_fox_v15_integration-cep-21, tag: bp_fox_v15_integration-cep-17, tag: bp_fox_v15_integration-cep-16, tag: bp_fox_v15_integration-cep-15, tag: bp_fox_v15_integration-cep-13, tag: bp_fox_v15_integration-cep-12, tag: baseline_odoo-fox-v15_v15_fox_v15_daily_build-26, origin/fox_v15_integration-cep-26, origin/fox_v15_integration-cep-25, origin/fox_v15_integration-cep-23, origin/fox_v15_integration-cep-22, origin/fox_v15_integration-cep-21, origin/fox_v15_integration-cep-17, origin/fox_v15_integration-cep-16, origin/fox_v15_integration-cep-15, origin/fox_v15_integration-cep-13, origin/fox_v15_integration-cep-12) update module versions for v15 and remove old migration scripts (issue #4967)
- 8d191ff7 2022-04-10 15:41:16 +0200 [email protected] add missing/lost documentation (issue #4516)
- 4509f78a 2022-02-23 20:48:33 +0100 [email protected] (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)
35 changes: 35 additions & 0 deletions rental_product_pack/README/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Usage
-----

Install the module.
No further configuration is needed.

Create at least one storable product that will be a component of a pack.
* Go to Rentals > Configuration > Settings.
* Please activate the checkbox for using 'Product Variants'.
* Go to Rentals > Products > Products.
* Create a new storable product.

Create a rentable pack product.
* Create a new storable product.
* Activate the checkbox 'Can be Rented' and 'Is Pack'.
* Go to page 'Pack'.
* Choose Pack Type (e.g. Non-detailled) and add the previously created storable products that are part of this pack.
* Go to page 'Sales & Purchase'.
* Create the rental service and configure its name and price.

Create a rental order:
* Go to Rentals > Customer > Rental Quotations.
* Create a new order and choose the type 'Rental Order'.
* Add the rental service of the rentable pack product as an order line.
* Set the quantity.
* Choose start and end date.
* Confirm the order.
* Check out the two deliveries, one for outgoing and one for incoming delivery.
* You can see all parts of the pack in both stock pickings.

Hint:
Refer to the usage information of the OCA module product_pack to learn how to
define product packs.
Please note, that this module does not include the behavior of the module sale_product_pack.
2 changes: 2 additions & 0 deletions rental_product_pack/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.
from . import models
24 changes: 24 additions & 0 deletions rental_product_pack/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.

{
"name": "Rental Product Pack",
"version": "15.0.1.0.0",
"category": "Rental",
"summary": "Manage rentals with product packs",
"author": "elego Software Solutions GmbH, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/vertical-rental",
"depends": [
"rental_base",
"product_pack",
],
"data": [
"security/ir.model.access.csv",
"views/product_view.xml",
"views/product_pack_line_view.xml",
],
"demo": [],
"qweb": [],
"application": False,
"installable": True,
"license": "AGPL-3",
}
77 changes: 77 additions & 0 deletions rental_product_pack/i18n/de.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * rental_product_pack
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-29 16:26+0000\n"
"PO-Revision-Date: 2021-12-29 16:26+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_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__used_pack_line_count
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__used_pack_line_count
msgid "# Used Pack Line Count"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__display_name
msgid "Display Name"
msgstr "Anzeigename"

#. module: rental_product_pack
#: model_terms:ir.ui.view,arch_db:rental_product_pack.product_template_only_form_view
#: model_terms:ir.ui.view,arch_db:rental_product_pack.rental_product_pack_form
msgid "Found in packs"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__id
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__id
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order__id
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__id
msgid "ID"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move____last_update
msgid "Last Modified on"
msgstr "Zuletzt geändert am"

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_product_product
msgid "Product"
msgstr "Produkt"

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_product_template
msgid "Product Template"
msgstr "Produktvorlage"

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__rental_pack_move_id
msgid "Rental Main Pack Move"
msgstr "Lagerbewegung des Hauptmietproduktes"

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_sale_order
msgid "Sales Order"
msgstr "Verkaufsauftrag"

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_stock_move
msgid "Stock Move"
msgstr "Lagerbewegung"
77 changes: 77 additions & 0 deletions rental_product_pack/i18n/rental_product_pack.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * rental_product_pack
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-29 16:26+0000\n"
"PO-Revision-Date: 2021-12-29 16:26+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_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__used_pack_line_count
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__used_pack_line_count
msgid "# Used Pack Line Count"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order__display_name
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__display_name
msgid "Display Name"
msgstr ""

#. module: rental_product_pack
#: model_terms:ir.ui.view,arch_db:rental_product_pack.product_template_only_form_view
#: model_terms:ir.ui.view,arch_db:rental_product_pack.rental_product_pack_form
msgid "Found in packs"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product__id
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template__id
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order__id
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__id
msgid "ID"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_product_product____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_product_template____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_sale_order____last_update
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move____last_update
msgid "Last Modified on"
msgstr ""

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_product_product
msgid "Product"
msgstr ""

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_product_template
msgid "Product Template"
msgstr ""

#. module: rental_product_pack
#: model:ir.model.fields,field_description:rental_product_pack.field_stock_move__rental_pack_move_id
msgid "Rental Main Pack Move"
msgstr ""

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: rental_product_pack
#: model:ir.model,name:rental_product_pack.model_stock_move
msgid "Stock Move"
msgstr ""
4 changes: 4 additions & 0 deletions rental_product_pack/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.
from . import sale
from . import stock
from . import product
26 changes: 26 additions & 0 deletions rental_product_pack/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.

from odoo import api, fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

used_pack_line_count = fields.Integer(
string="# Used Pack Line Count",
compute="_compute_used_pack_line_count",
)

@api.depends("pack_line_ids")
def _compute_used_pack_line_count(self):
for rec in self:
rec.used_pack_line_count = len(rec.used_in_pack_line_ids)


class ProductProduct(models.Model):
_inherit = "product.product"

used_pack_line_count = fields.Integer(
string="# Used Pack Line Count",
related="product_tmpl_id.used_pack_line_count",
)
33 changes: 33 additions & 0 deletions rental_product_pack/models/sale.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.

from odoo import models


class SaleOrder(models.Model):
_inherit = "sale.order"

def action_confirm(self):
res = super().action_confirm()
for order in self:
out_pickings = order.picking_ids.filtered(
lambda x: x.picking_type_id.code == "outgoing" and x.state != "cancel"
)
in_pickings = order.picking_ids.filtered(
lambda x: x.picking_type_id.code == "incoming" and x.state != "cancel"
)
for picking in out_pickings:
for move in picking.move_ids_without_package:
if move.product_id and move.product_id.pack_ok:
for line in move.product_id.pack_line_ids:
qty = move.product_uom_qty * line.quantity
move.copy(
{
"product_id": line.product_id.id,
"product_uom_qty": qty,
"rental_pack_move_id": move.id,
"picking_id": move.picking_id.id,
}
)
out_pickings.action_confirm()
in_pickings.action_confirm()
return res
12 changes: 12 additions & 0 deletions rental_product_pack/models/stock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Part of rental-vertical See LICENSE file for full copyright and licensing details.

from odoo import fields, models


class StockMove(models.Model):
_inherit = "stock.move"

rental_pack_move_id = fields.Many2one(
string="Rental Main Pack Move",
comodel_name="stock.move",
)
2 changes: 2 additions & 0 deletions rental_product_pack/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
product_pack.access_product_pack_line_user,product.pack.line,product_pack.model_product_pack_line,base.group_user,1,1,1,1
Binary file added rental_product_pack/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading