[NEW] Addons creation - product_rental_inspection
This commit is contained in:
3
product_rental_inspection/__init__.py
Executable file
3
product_rental_inspection/__init__.py
Executable file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
64
product_rental_inspection/__manifest__.py
Executable file
64
product_rental_inspection/__manifest__.py
Executable file
@@ -0,0 +1,64 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
"name": "Product Rental Inspection",
|
||||
"category": "Product",
|
||||
"version": "14.0.1.0",
|
||||
"summary": "Register inspection process and cost on your rental booking",
|
||||
"author": "Elabore",
|
||||
"website": "https://elabore.coop/",
|
||||
"installable": True,
|
||||
"application": False,
|
||||
"auto_install": False,
|
||||
"description": """
|
||||
=========================
|
||||
Product Rental Inspection
|
||||
=========================
|
||||
This module allows the registering of inspection process on the rent products.
|
||||
|
||||
Installation
|
||||
============
|
||||
Just install product_rental_inspection, 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/product_inspection.xml",
|
||||
"views/stock_picking.xml",
|
||||
"views/sequence.xml",
|
||||
"report/inspection_report.xml",
|
||||
"report/inspection_report_template.xml",
|
||||
"views/menus.xml",
|
||||
],
|
||||
"qweb": [],
|
||||
}
|
263
product_rental_inspection/i18n/fr.po
Normal file
263
product_rental_inspection/i18n/fr.po
Normal file
@@ -0,0 +1,263 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_rental_inspection
|
||||
#
|
||||
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_inspection
|
||||
#: model:ir.actions.report,print_report_name:product_rental_inspection.report_inspection_pass
|
||||
msgid "'Inspection Report'"
|
||||
msgstr "'Rapport d'inspection'"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.inspection_report_template
|
||||
msgid "#No."
|
||||
msgstr "#Num"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.inspection_report_template
|
||||
msgid ""
|
||||
"<strong>Inspection Date:</strong>\n"
|
||||
" <br/>"
|
||||
msgstr ""
|
||||
"<strong>Date d'inspection :</strong>\n"
|
||||
" <br/>"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.inspection_report_template
|
||||
msgid ""
|
||||
"<strong>Responsible:</strong>\n"
|
||||
" <br/>"
|
||||
msgstr ""
|
||||
"<strong>Responsable :</strong>\n"
|
||||
" <br/>"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.inspection_report_template
|
||||
msgid ""
|
||||
"<strong>Source Document:</strong>\n"
|
||||
" <br/>"
|
||||
"<strong>Document source :</strong>\n"
|
||||
" <br/>"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: code:addons/product_rental_inspection/models/product_contract.py:0
|
||||
#: code:addons/product_rental_inspection/models/product_inspection.py:0
|
||||
#, python-format
|
||||
msgid "Account Move"
|
||||
msgstr "Mouvement de compte"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__company_id
|
||||
msgid "Company"
|
||||
msgstr "Société"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_form_id
|
||||
msgid "Create Invoice"
|
||||
msgstr "Créer une facture"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "Créer par"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__create_date
|
||||
msgid "Created on"
|
||||
msgstr "Créer le"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__currency_id
|
||||
msgid "Currency"
|
||||
msgstr "Devise"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__customer_id
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_search
|
||||
msgid "Customer"
|
||||
msgstr "Client"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__date
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.product_booking_id
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__total_delayed_amount
|
||||
msgid "Delayed Amount"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__delayed_line_ids
|
||||
msgid "Delayed Lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "Nom affiché"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields.selection,name:product_rental_inspection.selection__rental_product_inspection__state__done
|
||||
#: model:ir.model.fields.selection,name:product_rental_inspection.selection__rental_product_operation__state__done
|
||||
msgid "Done"
|
||||
msgstr "Fait"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__total_fuel_charged
|
||||
msgid "Fuel Charged Amount"
|
||||
msgstr "Montant frais carburant"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_product_delayed__inspection_id
|
||||
msgid "Inspection"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.view_rental_order_graph
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.view_rental_order_pivot
|
||||
msgid "Inspection Analysis"
|
||||
msgstr "Analyse d'inspection"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_form_id
|
||||
msgid "Inspection Number"
|
||||
msgstr "Numéro d'inspection"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.actions.report,name:product_rental_inspection.report_inspection_pass
|
||||
msgid "Inspection Report"
|
||||
msgstr "Rapport d'inspection"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.ui.menu,name:product_rental_inspection.product_inspection_analysis
|
||||
msgid "Inspections"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.stock_picking_form_inherit
|
||||
msgid "Inspections Created"
|
||||
msgstr "Inspections créées"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "Dernière modification le"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "Dernière mise à jour par"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__write_date
|
||||
msgstr "Dernière mise à jour le"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__location_id
|
||||
msgid "Location"
|
||||
msgstr "Point de vente"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_form_id
|
||||
msgid "Mark as Done"
|
||||
msgstr "Marqué comme Fait"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_search
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_form_id
|
||||
msgid "Pause Inspection"
|
||||
msgstr "Mettre en pause l'inspection"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields.selection,name:product_rental_inspection.selection__rental_product_inspection__state__pause
|
||||
msgid "Paused"
|
||||
msgstr "En pause"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__phone
|
||||
msgid "Phone Number"
|
||||
msgstr "Numéro de téléphone"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__product_id
|
||||
msgid "Product"
|
||||
msgstr "Article"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: code:addons/product_rental_inspection/models/product_inspection.py:0
|
||||
#: model:ir.model,name:product_rental_inspection.model_rental_product_inspection
|
||||
#, python-format
|
||||
msgid "Product Inspection"
|
||||
msgstr "Inspection du produit"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.inspection_report_template
|
||||
msgid "Product:"
|
||||
msgstr "Produit :"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields.selection,name:product_rental_inspection.selection__rental_product_inspection__state__ready
|
||||
msgid "Ready"
|
||||
msgstr "Prêt"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__ref_number
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_search
|
||||
msgid "Reference Number"
|
||||
msgstr "Numéro de référence"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: code:addons/product_rental_inspection/models/stock_picking.py:0
|
||||
#: model:ir.actions.act_window,name:product_rental_inspection.action_product_inspection_analysis
|
||||
#: model:ir.actions.act_window,name:product_rental_inspection.action_product_inspection_move
|
||||
#, python-format
|
||||
msgid "Rental Inspection"
|
||||
msgstr "Inspection de location"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__responsible_person_id
|
||||
msgid "Responsible"
|
||||
msgstr "Responsable"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_form_id
|
||||
msgid "Resume Inspection"
|
||||
msgstr "Reprendre l'inspection"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__source_document
|
||||
msgid "Source Document"
|
||||
msgstr "Document source"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model:ir.model.fields,field_description:product_rental_inspection.field_rental_product_inspection__state
|
||||
msgid "State"
|
||||
msgstr "État"
|
||||
|
||||
#. module: product_rental_inspection
|
||||
#: model_terms:ir.ui.view,arch_db:product_rental_inspection.rental_product_inspection_search
|
||||
msgid "Undone"
|
||||
msgstr "Revenir en arrière"
|
4
product_rental_inspection/models/__init__.py
Normal file
4
product_rental_inspection/models/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import product_inspection
|
||||
from . import stock_picking
|
138
product_rental_inspection/models/product_inspection.py
Executable file
138
product_rental_inspection/models/product_inspection.py
Executable file
@@ -0,0 +1,138 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from datetime import date
|
||||
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class RentalProductInspection(models.Model):
|
||||
_name = "rental.product.inspection"
|
||||
_description = "Product Inspection"
|
||||
_rec_name = "ref_number"
|
||||
|
||||
product_id = fields.Many2one("product.product", string="Product")
|
||||
ref_number = fields.Char(string="Reference Number", default="New")
|
||||
customer_id = fields.Many2one("res.partner", string="Customer")
|
||||
location_id = fields.Many2one("stock.location", string="Location")
|
||||
phone = fields.Char(string="Phone Number")
|
||||
responsible_person_id = fields.Many2one("hr.employee", string="Responsible")
|
||||
source_document = fields.Char(string="Source Document")
|
||||
date = fields.Datetime(string="Date", default=lambda self: fields.Datetime.now())
|
||||
state = fields.Selection(
|
||||
[("ready", "Ready"), ("pause", "Paused"), ("done", "Done")], default="ready"
|
||||
)
|
||||
delayed_line_ids = fields.One2many(
|
||||
"product.delayed", "inspection_id", string="Delayed Lines"
|
||||
)
|
||||
company_id = fields.Many2one(
|
||||
"res.company", string="Company", default=lambda self: self.env.user.company_id
|
||||
)
|
||||
total_delayed_amount = fields.Float(string="Delayed Amount", readonly=True)
|
||||
total_fuel_charged = fields.Float(string="Fuel Charged Amount")
|
||||
currency_id = fields.Many2one("res.currency", related="company_id.currency_id")
|
||||
|
||||
def create_invoice(self):
|
||||
inv_obj = self.env["account.move"]
|
||||
total_amount = 0
|
||||
invoice_line_data = []
|
||||
account_id = self.env["account.account"].search(
|
||||
[("code", "like", "708000"), ("company_id", "=", self.company_id.id)]
|
||||
)
|
||||
if not account_id:
|
||||
user_type_id = self.env.ref("account.data_account_type_revenue")
|
||||
account_id = self.env["account.account"].create(
|
||||
{
|
||||
"code": "708000",
|
||||
"name": "Location",
|
||||
"company_id": self.company_id.id,
|
||||
"user_type_id": user_type_id.id,
|
||||
}
|
||||
)
|
||||
for each_delay in self.delayed_line_ids:
|
||||
if each_delay.invoice_state == "draft" and each_delay.delayed_amount > 0:
|
||||
total_amount += each_delay.delayed_amount
|
||||
invoice_line_data.append(
|
||||
(
|
||||
0,
|
||||
0,
|
||||
{
|
||||
"product_id": self.product_id.id,
|
||||
"name": "Delay Charge Invoice " + self.ref_number,
|
||||
"account_id": account_id.id,
|
||||
"price_unit": each_delay.delayed_amount,
|
||||
"quantity": 1,
|
||||
},
|
||||
)
|
||||
)
|
||||
each_delay.invoice_state = "to_invoice"
|
||||
|
||||
if total_amount > 0:
|
||||
invoice = inv_obj.create(
|
||||
{
|
||||
"ref": self.ref_number,
|
||||
"invoice_origin": self.ref_number,
|
||||
"partner_id": self.customer_id.id,
|
||||
"move_type": "out_invoice",
|
||||
"invoice_date": date.today(),
|
||||
"invoice_line_ids": invoice_line_data,
|
||||
}
|
||||
)
|
||||
invoice.action_post()
|
||||
|
||||
if invoice:
|
||||
return {
|
||||
"name": _("Account Move"),
|
||||
"view_mode": "form",
|
||||
"view_id": self.env.ref("account.view_move_form").id,
|
||||
"view_type": "tree,form",
|
||||
"res_model": "account.move",
|
||||
"type": "ir.actions.act_window",
|
||||
"res_id": invoice.id,
|
||||
}
|
||||
|
||||
@api.model
|
||||
def default_get(self, vals):
|
||||
res = super(RentalProductInspection, self).default_get(vals)
|
||||
sequence = self.env["ir.sequence"].next_by_code("product_inspection") or _(
|
||||
"Product Inspection"
|
||||
)
|
||||
if self._context.get("active_model") == "stock.picking":
|
||||
res.update(
|
||||
{
|
||||
"ref_number": sequence,
|
||||
}
|
||||
)
|
||||
return res
|
||||
|
||||
@api.onchange("customer_id")
|
||||
def onchange_filter_product(self):
|
||||
if self._context.get("product_list"):
|
||||
return {
|
||||
"domain": {
|
||||
"product_id": [("id", "in", self._context.get("product_list"))]
|
||||
}
|
||||
}
|
||||
|
||||
def done(self):
|
||||
self.state = "done"
|
||||
|
||||
def pause(self):
|
||||
self.state = "pause"
|
||||
|
||||
def resume(self):
|
||||
self.state = "ready"
|
||||
|
||||
|
||||
class ProductDelayed(models.Model):
|
||||
_name = "product.delayed"
|
||||
_description = "Product Delayed"
|
||||
|
||||
inspection_id = fields.Many2one("rental.product.inspection", string="Inspection")
|
||||
name = fields.Char(string="Description")
|
||||
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")
|
||||
delayed_amount = fields.Float(string="Delayed Amount")
|
||||
invoice_state = fields.Selection(
|
||||
[("draft", "Draft"), ("to_invoice", "To Invoice")], default="draft"
|
||||
)
|
27
product_rental_inspection/models/stock_picking.py
Normal file
27
product_rental_inspection/models/stock_picking.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
def action_view_inspections(self):
|
||||
product_ids = [
|
||||
product.product_id.id for product in self.move_ids_without_package
|
||||
]
|
||||
ctx = {
|
||||
"default_customer_id": self.partner_id.id,
|
||||
"default_source_document": self.origin,
|
||||
"default_location_id": self.location_id.id,
|
||||
"default_phone": self.partner_id.phone,
|
||||
"product_list": product_ids,
|
||||
}
|
||||
return {
|
||||
"name": _("Rental Inspection"),
|
||||
"view_type": "form",
|
||||
"view_mode": "tree,form",
|
||||
"res_model": "rental.product.inspection",
|
||||
"type": "ir.actions.act_window",
|
||||
"context": ctx,
|
||||
}
|
15
product_rental_inspection/report/inspection_report.xml
Executable file
15
product_rental_inspection/report/inspection_report.xml
Executable file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="report_inspection_pass" model="ir.actions.report">
|
||||
<field name="name">Inspection Report</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="report_type">qweb-pdf</field>
|
||||
<field name="report_name">product_rental_bookings.inspection_report_template</field>
|
||||
<field name="report_file">product_rental_bookings.inspection_report_template</field>
|
||||
<field name="print_report_name">'Inspection Report'</field>
|
||||
<field name="binding_model_id" ref="model_rental_product_inspection" />
|
||||
<field name="binding_type">report</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
44
product_rental_inspection/report/inspection_report_template.xml
Executable file
44
product_rental_inspection/report/inspection_report_template.xml
Executable file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="report_inspection_document">
|
||||
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
|
||||
<t t-call="web.external_layout"></t>
|
||||
</template>
|
||||
|
||||
<template id="inspection_report_template">
|
||||
<t t-call="web.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-call="web.external_layout">
|
||||
<div class="page">
|
||||
|
||||
<h1>
|
||||
#No.
|
||||
<span t-field="o.ref_number" />
|
||||
</h1>
|
||||
<h2>
|
||||
Product:
|
||||
<span t-field="o.product_id.name" />
|
||||
</h2>
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
<strong>Inspection Date:</strong>
|
||||
<br />
|
||||
<span t-field="o.date" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<strong>Source Document:</strong>
|
||||
<br />
|
||||
<span t-field="o.source_document" />
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<strong>Responsible:</strong>
|
||||
<br />
|
||||
<span t-field="o.responsible_person_id.name" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
3
product_rental_inspection/security/ir.model.access.csv
Executable file
3
product_rental_inspection/security/ir.model.access.csv
Executable file
@@ -0,0 +1,3 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_rental_product_inspection,access_rental_product_inspection,model_rental_product_inspection,,1,1,1,1
|
||||
access_product_delayed,access_product_delayed,model_product_delayed,base.group_user,1,1,1,1
|
|
11
product_rental_inspection/security/security.xml
Executable file
11
product_rental_inspection/security/security.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="0">
|
||||
<record id="product_inspection_rule" model="ir.rule">
|
||||
<field name="name">Product Inspection Rule</field>
|
||||
<field name="model_id" ref="model_rental_product_inspection" />
|
||||
<field eval="True" name="global" />
|
||||
<field name="domain_force">['|',('company_id','=',user.company_id.id),('company_id','=',False)]</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
8
product_rental_inspection/views/menus.xml
Normal file
8
product_rental_inspection/views/menus.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<menuitem id="product_inspection_analysis" name="Inspections" parent="product_rental_bookings.rental_product_analysis" action="action_product_inspection_analysis" sequence="4" />
|
||||
|
||||
</data>
|
||||
</odoo>
|
108
product_rental_inspection/views/product_inspection.xml
Executable file
108
product_rental_inspection/views/product_inspection.xml
Executable file
@@ -0,0 +1,108 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="rental_product_inspection_search" model="ir.ui.view">
|
||||
<field name="name">Product Inspection</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<field name="ref_number" filter_domain="[('name','ilike',self)]" string="Name" />
|
||||
<field name="customer_id" filter_domain="[('customer_id','ilike',self)]" string="Customer" />
|
||||
<filter string="Undone" name="undone" domain="[('state','!=','done')]" />
|
||||
<filter string="Reference Number" name="move_type" domain="[]" context="{'group_by': 'source_document'}" />
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="rental_product_inspection_form_id" model="ir.ui.view">
|
||||
<field name="name">Product Inspection</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<field name="state" widget="statusbar" />
|
||||
<button name="done" string="Mark as Done" type="object" class="oe_highlight" states="ready" />
|
||||
<button name="pause" string="Pause Inspection" type="object" class="oe_highlight" states="ready" />
|
||||
<button name="resume" string="Resume Inspection" type="object" class="oe_highlight" states="pause" />
|
||||
<button name="create_invoice" type="object" string="Create Invoice" class="oe_highlight" />
|
||||
</header>
|
||||
<sheet>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="ref_number" placeholder="Inspection Number" readonly="1" />
|
||||
</h1>
|
||||
<h1>
|
||||
<field name="product_id" />
|
||||
</h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="customer_id" />
|
||||
<field name="phone" />
|
||||
<field name="location_id" />
|
||||
<!-- <field name="total_charged_amount" invisible="1"/>-->
|
||||
</group>
|
||||
<group>
|
||||
<field name="date" />
|
||||
<field name="source_document" />
|
||||
<field name="responsible_person_id" />
|
||||
<field name="total_delayed_amount" invisible="1" />
|
||||
<field name="total_fuel_charged" invisible="1" />
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="rental_product_inspection_tree_id" model="ir.ui.view">
|
||||
<field name="name">Product Inspection</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-muted="state=='done'" decoration-info="state=='pause'" decoration-danger="state=='ready'">
|
||||
<field name="ref_number" />
|
||||
<field name="product_id" />
|
||||
<field name="source_document" />
|
||||
<field name="state" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_rental_order_pivot">
|
||||
<field name="name">rental.product.inspection.pivot</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="arch" type="xml">
|
||||
<pivot string="Inspection Analysis">
|
||||
<field name="product_id" type="row" />
|
||||
<field name="date" type="col" />
|
||||
</pivot>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_rental_order_graph">
|
||||
<field name="name">rental.product.inspection.pivot</field>
|
||||
<field name="model">rental.product.inspection</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Inspection Analysis">
|
||||
<field name="product_id" type="row" />
|
||||
<field name="date" type="col" />
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_product_inspection_move" model="ir.actions.act_window">
|
||||
<field name="name">Rental Inspection</field>
|
||||
<field name="res_model">rental.product.inspection</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'search_default_undone': 1}</field>
|
||||
</record>
|
||||
|
||||
<record id="action_product_inspection_analysis" model="ir.actions.act_window">
|
||||
<field name="name">Rental Inspection</field>
|
||||
<field name="res_model">rental.product.inspection</field>
|
||||
<field name="view_mode">pivot,graph</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
16
product_rental_inspection/views/sequence.xml
Executable file
16
product_rental_inspection/views/sequence.xml
Executable file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="sequence_product_inspection" model="ir.sequence">
|
||||
<field name="name">Product Inspection</field>
|
||||
<field name="code">product_inspection</field>
|
||||
<field name="prefix">INS</field>
|
||||
<field name="padding">2</field>
|
||||
<field name="suffix">/%(month)s/%(day)s</field>
|
||||
<field name="company_id" eval="False" />
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</odoo>
|
16
product_rental_inspection/views/stock_picking.xml
Normal file
16
product_rental_inspection/views/stock_picking.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="stock_picking_form_inherit_inspection" model="ir.ui.view">
|
||||
<field name="name">view.picking.form.inherit.inspection</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="product_rental_bookings.stock_picking_form_inherit" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//button[@name='delivery']" position="after">
|
||||
<button name="action_view_inspections" attrs="{'invisible': [('state', 'in', ['draft','waiting', 'confirmed', 'done', 'cancel']),
|
||||
]}" string="Inspections Created" type="object" class="oe_highlight" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
Reference in New Issue
Block a user