[NEW] Addons creation - product_rental_bookings

This commit is contained in:
Stéphan Sainléger
2022-04-19 11:54:03 +02:00
parent 73749bcfb6
commit 8e2973526a
55 changed files with 10183 additions and 0 deletions

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="recurring_report">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
<div class="page">
<div class="oe_structure" />
<div class="row">
<div class="col-xs-6"></div>
<div class="col-xs-5 col-xs-offset-1">
<strong>Customer Details:</strong>
<div t-field="doc.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<p t-if="doc.partner_id.vat">
<t t-esc="doc.company_id.country_id.vat_label or 'TIN'" />
:
<span t-field="doc.partner_id.vat" />
</p>
</div>
</div>
<h2>
<center>
<span>Recurring Invoice Details :</span>
</center>
</h2>
<h4>
<center>
<span>Contract -</span>
<span t-field="doc.name" />
</center>
</h4>
<div class="row mt32 mb32" id="informations">
<div t-if="doc.contract_date" class="col-xs-3" style="margin-right: 60px;">
<strong>Date Ordered:</strong>
<p t-field="doc.contract_date" />
</div>
<div t-if="doc.contractor_id" class="col-xs-3" style="margin-right: 60px;">
<strong>Contractor:</strong>
<p t-field="doc.contractor_id" />
</div>
<div name="account_payment_term" t-if="doc.account_payment_term" class="col-xs-3" style="margin-right: 60px;">
<strong>Payment Terms:</strong>
<p t-field="doc.account_payment_term" />
</div>
<div name="from_date" t-if="doc.from_date" class="col-xs-3" style="margin-right: 60px;">
<strong>From Date:</strong>
<p t-field="doc.from_date" />
</div>
<div name="to_date" t-if="doc.to_date" class="col-xs-3" style="margin-right: 60px;">
<strong>To Date:</strong>
<p t-field="doc.to_date" />
</div>
</div>
<div class="row mt32 mb32" id="informations">
<div t-if="doc.cost_frequency" class="col-xs-3" style="margin-right: 60px;">
<strong>Interval Type:</strong>
<p t-field="doc.cost_frequency" />
</div>
<div t-if="doc.cost_generated" class="col-xs-3" style="margin-right: 60px;">
<strong>Recurring Amount:</strong>
<p t-field="doc.cost_generated" />
</div>
<div t-if="doc.security_deposit" class="col-xs-3" style="margin-right: 60px;">
<strong>Security Deposite:</strong>
<p t-field="doc.security_deposit" />
</div>
<div t-if="doc.first_payment" class="col-xs-3" style="margin-right: 60px;">
<strong>First Payment Amount:</strong>
<p t-field="doc.first_payment" />
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>
<strong>Date</strong>
</th>
<th class="text-center">
<strong>Payment State</strong>
</th>
<th class="text-center">
<strong>Amount</strong>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="doc.recurring_line" t-as="line">
<td>
<t t-if="line.date_today">
<span t-field="line.date_today" />
</t>
</td>
<td class="text-center">
<t t-if="line.payment_info">
<span t-field="line.payment_info" />
</t>
</td>
<td class="text-right">
<t t-if="line.recurring_amount">
<span t-field="line.recurring_amount" />
</t>
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-2 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="doc.sum_cost" />
</td>
</tr>
</table>
</div>
</div>
</div>
</t>
</template>
<template id="rental_recurring_report_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="product_rental_bookings.recurring_report" t-lang="doc.partner_id.lang" />
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="rental_contract">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" />
<div class="page">
<div class="oe_structure" />
<div class="row">
<div class="col-xs-6"></div>
<div class="col-xs-5 col-xs-offset-1">
<strong>Customer Details:</strong>
<div t-field="doc.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<p t-if="doc.partner_id.vat">
<t t-esc="doc.company_id.country_id.vat_label or 'TIN'" />
:
<span t-field="doc.partner_id.vat" />
</p>
</div>
</div>
<h2>
<center>
<span>Contract -</span>
<span t-field="doc.name" />
</center>
</h2>
<div class="row mt32 mb32" id="informations">
<div t-if="doc.contract_date" class="col-xs-3" style="margin-right: 60px">
<strong>Date Ordered:</strong>
<p t-field="doc.contract_date" />
</div>
<div t-if="doc.contractor_id" class="col-xs-3" style="margin-right: 60px">
<strong>Contractor:</strong>
<p t-field="doc.contractor_id" />
</div>
<div name="account_payment_term" t-if="doc.account_payment_term" class="col-xs-3" style="margin-right: 60px">
<strong>Payment Terms:</strong>
<p t-field="doc.account_payment_term" />
</div>
<div name="from_date" t-if="doc.from_date" class="col-xs-3" style="margin-right: 60px">
<strong>From Date:</strong>
<p t-field="doc.from_date" />
</div>
<div name="to_date" t-if="doc.to_date" class="col-xs-3" style="margin-right: 60px">
<strong>To Date:</strong>
<p t-field="doc.to_date" />
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>
<strong>Description</strong>
</th>
<th>
<strong>Based On</strong>
</th>
<th class="text-center">
<strong>Days</strong>
</th>
<th class="text-center">
<strong>Tax</strong>
</th>
<th class="text-center">
<strong>Price</strong>
</th>
<th class="text-center">
<strong>subtotal</strong>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="doc.product_contract_lines_ids" t-as="line">
<td>
<span t-field="line.product_id.name" />
</td>
<td class="text-center">
<span t-field="line.price_based" />
</td>
<td class="text-center">
<span t-field="line.enter_days" />
</td>
<td class="text-center">
<span t-esc="','.join(map(lambda x: x.name, line.tax_id))" />
</td>
<td class="text-center">
<span t-field="line.price" />
</td>
<td class="text-center">
<span t-field="line.sub_total" />
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Subtotal</strong>
</td>
<td class="text-right">
<span t-field="doc.untaxed_amount" />
</td>
</tr>
<tr>
<td>Taxes</td>
<td class="text-right">
<span t-field="doc.taxes" />
</td>
</tr>
<tr>
<td>Extra Charges</td>
<td class="text-right">
<span t-field="doc.extra_charges" />
</td>
</tr>
<tr class="border-black">
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="doc.total_amount" />
</td>
</tr>
</table>
</div>
</div>
<p t-field="doc.terms_condition" />
<div class="oe_structure" />
</div>
<div class="row" style="padding-top: 280px">
<div class="row">
<div style="margin-left: 40px;">
<strong>Contractor Signature</strong>
<br />
<img t-att-src="'data:image/png;base64,%s' % to_text(doc.signature_contractor)" height="70" width="100" />
</div>
<div style="margin-left: 480px;">
<strong>Customer Signature</strong>
<br />
<img t-att-src="'data:image/png;base64,%s' % to_text(doc.signature_customer)" height="70" width="100" />
</div>
</div>
</div>
</t>
</template>
<template id="rental_contract_report_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="product_rental_bookings.rental_contract" t-lang="doc.partner_id.lang" />
</t>
</t>
</template>
</odoo>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="product_rental_order_report" model="ir.actions.report">
<field name="name">Rental/Order</field>
<field name="model">rental.product.order</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">product_rental_bookings.rental_order_template</field>
<field name="report_file">product_rental_bookings.rental_order_report</field>
<field name="print_report_name">'Rental/Order'</field>
<field name="binding_model_id" ref="model_rental_product_order" />
<field name="binding_type">report</field>
</record>
<record id="product_rental_contract_report" model="ir.actions.report">
<field name="name">Rental Contract</field>
<field name="model">rental.product.contract</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">product_rental_bookings.rental_contract_report_template</field>
<field name="report_file">product_rental_bookings.rental_contract_report</field>
<field name="print_report_name">'Rental Contract'</field>
<field name="binding_model_id" ref="model_rental_product_contract" />
<field name="binding_type">report</field>
</record>
<record id="product_contract_recurring_report" model="ir.actions.report">
<field name="name">Recurring Invoice</field>
<field name="model">rental.product.contract</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">product_rental_bookings.rental_recurring_report_template</field>
<field name="report_file">product_rental_bookings.rental_contract_recurring</field>
<field name="print_report_name">'Recurring Invoice'</field>
<field name="binding_model_id" ref="model_rental_product_contract" />
<field name="binding_type">report</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="report_product_rental_order">
<t t-call="web.external_layout">
<t t-set="doc" t-value="doc.with_context({'lang':doc.customer_name.lang})" />
<div class="page">
<div class="oe_structure" />
<div class="row">
<div class="col-xs-6"></div>
<div class="col-xs-5 col-xs-offset-1">
<strong>Customer Details:</strong>
<div t-field="doc.customer_name" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<p t-if="doc.customer_name.vat">
<t t-esc="doc.company_id.country_id.vat_label or 'TIN'" />
:
<span t-field="doc.customer_name.vat" />
</p>
</div>
</div>
<h2>
<center>
<span>Rental Order -</span>
<span t-field="doc.res_number" />
</center>
</h2>
<div class="row mt32 mb32" id="informations">
<div t-if="doc.book_date" class="col-xs-6" style="margin-right: 60px">
<strong>Date Ordered:</strong>
<p t-field="doc.book_date" />
</div>
<div t-if="doc.user_id" class="col-xs-6" style="margin-right: 60px">
<strong>Salesperson:</strong>
<p t-field="doc.user_id" />
</div>
<div name="account_payment_term" t-if="doc.account_payment_term" class="col-xs-6" style="margin-right: 60px">
<strong>Payment Terms:</strong>
<p t-field="doc.account_payment_term" />
</div>
<div name="from_date" t-if="doc.from_date" class="col-xs-6" style="margin-right: 60px">
<strong>From Date:</strong>
<p t-field="doc.from_date" />
</div>
<div name="to_date" t-if="doc.to_date" class="col-xs-6" style="margin-right: 60px">
<strong>To Date:</strong>
<p t-field="doc.to_date" />
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>
<strong>Description</strong>
</th>
<th>
<strong>Based On</strong>
</th>
<th class="text-center">
<strong>Days</strong>
</th>
<th class="text-center">
<strong>Tax</strong>
</th>
<th class="text-center">
<strong>Price</strong>
</th>
<th class="text-center">
<strong>subtotal</strong>
</th>
</tr>
</thead>
<tbody>
<tr t-foreach="doc.product_order_lines_ids" t-as="line">
<td>
<span t-field="line.product_id.name" />
</td>
<td class="text-center">
<span t-field="line.price_based" />
</td>
<td class="text-center">
<span t-field="line.enter_days" />
</td>
<td class="text-center">
<span t-esc="','.join(map(lambda x: x.name, line.tax_id))" />
</td>
<td class="text-center">
<span t-field="line.price" />
</td>
<td class="text-center">
<span t-field="line.sub_total" />
</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Subtotal</strong>
</td>
<td class="text-right">
<span t-field="doc.untaxed_amount" />
</td>
</tr>
<tr>
<td>Taxes</td>
<td class="text-right">
<span t-field="doc.taxes" />
</td>
</tr>
<tr>
<td>Extra Charges</td>
<td class="text-right">
<span t-field="doc.extra_charges" />
</td>
</tr>
<tr class="border-black">
<td>
<strong>Total</strong>
</td>
<td class="text-right">
<span t-field="doc.total_amount" />
</td>
</tr>
</table>
</div>
</div>
<p t-field="doc.terms_condition" />
<div class="oe_structure" />
</div>
</t>
</template>
<template id="rental_order_template">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="product_rental_bookings.report_product_rental_order" t-lang="doc.customer_name
.lang" />
</t>
</t>
</template>
</odoo>