Skip to content

Commit

Permalink
Merge 3597c79 into 3ed037e
Browse files Browse the repository at this point in the history
  • Loading branch information
danhpvo committed Nov 12, 2019
2 parents 3ed037e + 3597c79 commit b4df0b7
Show file tree
Hide file tree
Showing 99 changed files with 45,243 additions and 0 deletions.
119 changes: 119 additions & 0 deletions sale_rental/README.rst
@@ -0,0 +1,119 @@
===========
Sale Rental
===========

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/11.0/sale_rental
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-11-0/sale-workflow-11-0-sale_rental
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/167/11.0
:alt: Try me on Runbot

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

With this module, you can rent products with Odoo. This module supports:

* regular rentals.
* rental extensions.
* sale of rented products.

**Table of contents**

.. contents::
:local:

Configuration
=============

In the menu *Sales > Products > Product Variants*, on the form view of a stockable product or consumable, in the *Rental* tab, there is a button *Create Rental Service* which starts a wizard to generate the corresponding rental service.

In the menu *Warehouse > Configuration > Warehouses*, on the form view of the warehouse, in the *Technical Information* tab, you will see two additional stock locations: *Rental In* (stock of products to rent) and *Rental Out* (products currently rented). In the *Warehouse Configuration* tab, make sure that the option *Rental Allowed* is checked.

To use the module, you need to have access to the form view of sale order lines. For that, you must add your user to one of these groups:

* Manage Product Packaging
* Properties on lines

Upon module installation, all users are automatically added to the group *Manage Product Packaging*.

Usage
=====

In a sale order line (form view, not tree view), if you select a rental service, you can :

* create a new rental with a start date and an end date: when the sale order is confirmed, it will generate a delivery order and an incoming shipment.
* extend an existing rental: the incoming shipment will be postponed to the end date of the extension.

In a sale order line, if you select a product that has a corresponding rental service, you can decide to sell the rented product that the customer already has. If the sale order is confirmed, the incoming shipment will be cancelled and a new delivery order will be created with a stock move from *Rental Out* to *Customers*.

Please refer to this screencast https://www.youtube.com/watch?v=9o0QrGryBn8 to get a demo of the installation, configuration and use of this module (note that this screencast is for Odoo v7).

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/167/11.0

Known issues / Roadmap
======================

This module has the following limitations:

* No support for planning/agenda of the rented products
* The unit of measure of the rental services must be *Day* (the rental per hours / per week / per month is not supported for the moment)
* In case of selling rented product, the incoming shipment should be created manually

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_rental%0Aversion:%2011.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
~~~~~~~

* Akretion
* Sodexis

Contributors
~~~~~~~~~~~~

* Alexis de Lattre <alexis.delattre@akretion.com>
* Sodexis <dev@sodexis.com>
* Danh Vo <https://github.com/danhvophuong>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/11.0/sale_rental>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
8 changes: 8 additions & 0 deletions sale_rental/__init__.py
@@ -0,0 +1,8 @@
# Copyright 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2016 Sodexis (http://sodexis.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from .hooks import post_init_hook
from . import models
from . import wizard
29 changes: 29 additions & 0 deletions sale_rental/__manifest__.py
@@ -0,0 +1,29 @@
# Copyright 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2016 Sodexis (http://sodexis.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Sale Rental',
'version': '11.0.1.0.0',
'category': 'Sales Management',
'license': 'AGPL-3',
'summary': 'Manage Rental of Products',
'author': 'Akretion, Sodexis, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/sale-workflow',
'depends': ['sale_start_end_dates', 'sale_stock', 'sales_team'],
'data': [
'data/rental_data.xml',
'views/sale_order.xml',
'views/stock.xml',
'views/sale_rental.xml',
'wizard/create_rental_product_view.xml',
'views/product.xml',
'menu/menu.xml',
'security/ir.model.access.csv',
'security/sale_rental_security.xml',
],
'post_init_hook': 'post_init_hook',
'demo': ['demo/rental_demo.xml'],
'installable': True,
}
27 changes: 27 additions & 0 deletions sale_rental/data/rental_data.xml
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2016 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
Copyright 2016 Sodexis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->

<odoo noupdate="1">

<record id="route_warehouse0_rental" model="stock.location.route">
<field name="name">Rent</field>
<field name="sequence">100</field>
<field name="warehouse_selectable" eval="True"/>
<field name="product_selectable" eval="False"/>
</record>

<record id="route_warehouse0_sell_rented_product" model="stock.location.route">
<field name="name">Sell Rented Product</field>
<field name="sequence">100</field>
</record>

<record id="stock.warehouse0" model="stock.warehouse">
<field name="rental_allowed" eval="True"/>
</record>

</odoo>
64 changes: 64 additions & 0 deletions sale_rental/demo/rental_demo.xml
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2014-2016 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
Copyright 2016 Sodexis
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->


<odoo noupdate="1">

<record id="rent_product_product_6" model="product.product">
<field name="name">Rental of one iPad Mini</field>
<field name="default_code">RENT-A1232</field>
<field name="categ_id" ref="product.product_category_5"/>
<field name="sale_ok" eval="True"/>
<field name="list_price">5</field>
<field name="type">service</field>
<field name="uom_id" ref="product.product_uom_day"/>
<field name="uom_po_id" ref="product.product_uom_day"/>
<field name="must_have_dates" eval="True"/>
<field name="rented_product_id" ref="product.product_product_6"/>
</record>

<record id="rent_product_product_8" model="product.product">
<field name="name">Rental of one iMac</field>
<field name="default_code">RENT-A1090</field>
<field name="categ_id" ref="product.product_category_5"/>
<field name="sale_ok" eval="True"/>
<field name="list_price">4</field>
<field name="type">service</field>
<field name="uom_id" ref="product.product_uom_day"/>
<field name="uom_po_id" ref="product.product_uom_day"/>
<field name="must_have_dates" eval="True"/>
<field name="rented_product_id" ref="product.product_product_8"/>
</record>

<record id="rent_product_product_25" model="product.product">
<field name="name">Rental of one Laptop E5023</field>
<field name="default_code">RENT-LAP-E5</field>
<field name="categ_id" ref="product.product_category_5"/>
<field name="sale_ok" eval="True"/>
<field name="list_price">6</field>
<field name="type">service</field>
<field name="uom_id" ref="product.product_uom_day"/>
<field name="uom_po_id" ref="product.product_uom_day"/>
<field name="must_have_dates" eval="True"/>
<field name="rented_product_id" ref="product.product_product_25"/>
</record>

<!-- Create inventory on Rental In for these products -->
<record id="rental_inventory" model="stock.inventory">
<field name="name">Inventory for rented products</field>
</record>

<function model="stock.inventory" name="create_demo_and_validate">
<function eval="[[('id', '=', ref('rental_inventory'))]]" model="stock.inventory" name="search"/>
</function>

<record id="base.user_demo" model="res.users">
<field name="groups_id" eval="[(4, ref('product.group_product_variant'))]"/>
</record>

</odoo>
14 changes: 14 additions & 0 deletions sale_rental/hooks.py
@@ -0,0 +1,14 @@
# © 2016-2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID
from odoo.api import Environment


# DONE
def post_init_hook(cr, registry):
env = Environment(cr, SUPERUSER_ID, {})
users = env['res.users'].search(
['|', ('active', '=', True), ('active', '=', False)])
users.write({
'groups_id': [(4, env.ref('product.group_stock_packaging').id)]})

0 comments on commit b4df0b7

Please sign in to comment.