[NEW] Addons creation - product_rental_delay_management
This commit is contained in:
3
product_rental_delay_management/__init__.py
Executable file
3
product_rental_delay_management/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
59
product_rental_delay_management/__manifest__.py
Executable file
59
product_rental_delay_management/__manifest__.py
Executable file
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
"name": "Product Rental Delay Management",
|
||||
"category": "Product",
|
||||
"version": "14.0.1.0",
|
||||
"summary": "Management delays and their costs on your rental booking",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"description": """
|
||||
===============================
|
||||
Product Rental Delay Management
|
||||
===============================
|
||||
This module allows the registering of delay information which impact the total booking cost.
|
||||
|
||||
Installation
|
||||
============
|
||||
Just install product_rental_delay_management, all dependencies will be installed by default.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/elabore-coop/.../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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Images
|
||||
------
|
||||
* Elabore: `Icon <https://elabore.coop/web/image/res.company/1/logo?unique=f3db262>`_.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* Stéphan Sainléger <https://github.com/stephansainleger>
|
||||
|
||||
Funders
|
||||
-------
|
||||
The development of this module has been financially supported by:
|
||||
* Elabore (https://elabore.coop)
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
This module is maintained by ELABORE.
|
||||
|
||||
""",
|
||||
"depends": ["product_rental_bookings"],
|
||||
"data": [
|
||||
"security/ir.model.access.csv",
|
||||
"views/stock_picking.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
}
|
141
product_rental_delay_management/i18n/fr.po
Normal file
141
product_rental_delay_management/i18n/fr.po
Normal file
@@ -0,0 +1,141 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_rental_delay_management
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 14.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-29 14:44+0000\n"
|
||||
"PO-Revision-Date: 2021-09-29 14:44+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: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__delay_cost_per_hour
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__delay_cost_per_hour
|
||||
msgid "Cost/Hour"
|
||||
msgstr "Tarif horaire"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__create_uid
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créer par"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__create_date
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créer le"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__delayed_amount
|
||||
msgid "Delayed Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_delay_management.stock_picking_form_inherit
|
||||
msgid "Delayed Hours"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_stock_picking__product_delay_line_ids
|
||||
msgid "Delayed Hours "
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__name
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__display_name
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields.selection,name:product_rental_delay_management.selection__product_delayed__invoice_state__draft
|
||||
msgid "Draft"
|
||||
msgstr "Brouillon"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__id
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__invoice_state
|
||||
msgid "Invoice State"
|
||||
msgstr "État de la facture"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_stock_picking__is_delayed
|
||||
msgid "Is Delayed"
|
||||
msgstr "Est reporté"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed____last_update
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__write_uid
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière mise à jour par"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__write_date
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "Dernière mise à jour le"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model,name:product_rental_delay_management.model_product_delayed
|
||||
msgid "Product Delayed"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model,name:product_rental_delay_management.model_product_delayed_lines
|
||||
msgid "Product Delayed Lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__product_delay_id
|
||||
msgid "Product Move"
|
||||
msgstr "Mouvement du produit"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__product_id
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__product_id
|
||||
msgid "Product Name"
|
||||
msgstr "Nom du produit"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__products_checked
|
||||
msgid "Select Products"
|
||||
msgstr "Sélectionner les produits"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__sub_total
|
||||
msgid "Sub Total"
|
||||
msgstr "Sous-total"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields.selection,name:product_rental_delay_management.selection__product_delayed__invoice_state__to_invoice
|
||||
msgid "To Invoice"
|
||||
msgstr "A facturer"
|
||||
|
||||
#. module: product_rental_delay_management
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed__delayed_hours
|
||||
#: model:ir.model.fields,field_description:product_rental_delay_management.field_product_delayed_lines__delayed_hours
|
||||
msgid "Total Hours"
|
||||
msgstr "Nombre d'heures totales"
|
4
product_rental_delay_management/models/__init__.py
Normal file
4
product_rental_delay_management/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import product_delay_lines
|
||||
from . import stock_picking
|
@@ -0,0 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ProductDelayLines(models.Model):
|
||||
_name = "product.delayed.lines"
|
||||
_description = "Product Delayed Lines"
|
||||
|
||||
@api.depends("delayed_hours", "delay_cost_per_hour")
|
||||
def _get_subtotal(self):
|
||||
for each in self:
|
||||
each.sub_total = each.delayed_hours * each.delay_cost_per_hour
|
||||
|
||||
product_delay_id = fields.Many2one("stock.picking", string="Product Move")
|
||||
product_id = fields.Many2one("product.product", string="Product Name")
|
||||
delay_cost_per_hour = fields.Float(string="Cost/Hour")
|
||||
delayed_hours = fields.Float(string="Total Hours")
|
||||
sub_total = fields.Float(string="Sub Total", compute="_get_subtotal", store=True)
|
||||
products_checked = fields.Boolean(string="Select Products")
|
32
product_rental_delay_management/models/stock_picking.py
Normal file
32
product_rental_delay_management/models/stock_picking.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tests import Form
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
product_delay_line_ids = fields.One2many(
|
||||
"product.delayed.lines", "product_delay_id", string="Delayed Hours "
|
||||
)
|
||||
is_delayed = fields.Boolean(string="Is Delayed")
|
||||
|
||||
@api.depends("product_delay_line_ids")
|
||||
def _compute_total(self):
|
||||
for record in self:
|
||||
for line in record.product_delay_line_ids:
|
||||
record.total_amount += line.sub_total
|
||||
|
||||
def delivery(self):
|
||||
product_delay_line_ids = []
|
||||
if any([each.products_checked for each in self.move_ids_without_package]):
|
||||
deliver_move_id = super(StockPicking, self).delivery()
|
||||
deliver_move_id.write(
|
||||
{
|
||||
"product_delay_line_ids": product_delay_line_ids,
|
||||
}
|
||||
)
|
2
product_rental_delay_management/security/ir.model.access.csv
Executable file
2
product_rental_delay_management/security/ir.model.access.csv
Executable file
@@ -0,0 +1,2 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_product_delayed_lines,access_product_delayed_lines,model_product_delayed_lines,,1,1,1,1
|
|
39
product_rental_delay_management/views/stock_picking.xml
Normal file
39
product_rental_delay_management/views/stock_picking.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="stock_picking_form_inherit" model="ir.ui.view">
|
||||
<field name="name">view.picking.form.inherit</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='picking_type_id']" position="after">
|
||||
<field name="is_delayed" attrs="{'invisible': [('state', 'in', ['waiting', 'assigned', 'done', 'cancel'])]}" />
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//page[@name='operations']" position="after">
|
||||
<page string="Delayed Hours" attrs="{'invisible':[('is_delayed','=',False)]}">
|
||||
<group>
|
||||
<field name="product_delay_line_ids" nolabel="1">
|
||||
<tree editable="bottom">
|
||||
<field name="product_delay_id" invisible="1" />
|
||||
<field name="product_id" />
|
||||
<field name="delay_cost_per_hour" />
|
||||
<field name="delayed_hours" widget="float_time" />
|
||||
<field name="sub_total" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<group class="oe_subtotal_footer oe_right" colspan="2" name="delay_cost_total">
|
||||
<div class="oe_subtotal_footer_separator oe_inline o_td_label" invisible="1">
|
||||
<label for="total_amount" />
|
||||
</div>
|
||||
<field name="total_amount" nolabel="1" class="oe_subtotal_footer_separator" widget='monetary' />
|
||||
</group>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</odoo>
|
Reference in New Issue
Block a user