Browse Source

Merge pull request #7 from coopiteasy/12.0-fix-capital_request_invoice

[FIX] emc: Release capital request report
pull/9/head
Houssine BAKKALI 5 years ago
committed by GitHub
parent
commit
8442e1e33c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      easy_my_coop/__manifest__.py
  2. 390
      easy_my_coop/report/cooperator_invoice_G002.xml

2
easy_my_coop/__manifest__.py

@ -5,7 +5,7 @@
{
"name": "Easy My Coop",
"version": "12.0.1.0.0",
"version": "12.0.1.0.1",
"depends": [
"base",
"sale",

390
easy_my_coop/report/cooperator_invoice_G002.xml

@ -1,242 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>
<template id="theme_invoice_G002_document">
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
<div class="page">
<head>
<link href="/easy_my_coop/static/src/css/coop_report.css" rel="stylesheet"/>
<template id="theme_invoice_G002_document">
<style type="text/css">
/* Montserrat */
@font-face {
font-family: 'Montserrat-Regular';
font-style: normal;
src: local('Montserrat Regular'), url('/theme_light/static/font/Montserrat-Regular.ttf') format('truetype');
}
/* Roboto Regular */
@font-face {
font-family: 'Roboto-Regular';
font-style: normal;
src: local('Roboto Regular'), url('/theme_light/static/font/Roboto-Regular.ttf') format('truetype');
}
/* Roboto Bold */
@font-face {
font-family: 'Roboto-Bold';
font-style: normal;
src: local('Roboto Bold'), url('/theme_light/static/font/Roboto-Bold.ttf') format('truetype');
}
/* BEBASNEUE Bold */
@font-face {
font-family: 'Bebasneue-Bold';
font-style: normal;
src: local('Bebasneue-Bold'), url('/theme_light/static/font/BEBASNEUE_BOLD.ttf') format('truetype');
}
</style>
</head>
<!--<t t-call="theme_light.invoice_header"/>-->
<t t-call="web.external_layout">
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" />
<t t-set="address">
<address t-field="o.partner_id" t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' />
<div t-if="o.partner_id.vat" class="mt16"><t t-esc="o.company_id.country_id.vat_label or 'Tax ID'"/>: <span t-field="o.partner_id.vat"/></div>
</t>
<div class="page">
<h2>
<span t-if="o.release_capital_request">Request to Release Capital</span>
<span t-else="">
<span t-if="o.type == 'out_invoice' and o.state in ('open', 'in_payment', 'paid')">Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_refund'">Credit Note</span>
<span t-if="o.type == 'in_refund'">Vendor Credit Note</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
</span>
<span t-field="o.number"/>
</h2>
<div class="row">
<div class="col-xs-5 col-xs-offset-7 easymy-coop-address" style="top:90px;">
<address t-field="o.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": true}' />
<span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span>
<div id="informations" class="row mt32 mb32">
<div class="col-auto mw-100 mb-2" t-if="o.name" name="description">
<strong>Description:</strong>
<p class="m-0" t-field="o.name"/>
</div>
<div class="col-auto mw-100 mb-2" t-if="o.date_invoice" name="invoice_date">
<strong>Request Date:</strong>
<p class="m-0" t-field="o.date_invoice"/>
</div>
<div name="reference" class="col-auto mw-100 mb-2" t-if="o.reference">
<strong>Structured Communication:</strong>
<p class="m-0" t-field="o.reference"/>
</div>
<div name="account_number" class="col-auto mw-100 mb-2">
<strong>Account Number:</strong>
<t t-foreach="o.company_id.bank_journal_ids" t-as="journal">
<t t-set="b" t-value="journal.bank_account_id"/>
<t t-if="o.release_capital_request and journal.get_cooperator_payment">
<p class="m-0" t-field="b.acc_number"/>
</t>
<t t-if="not o.release_capital_request and journal.get_general_payment">
<p t-field="b.acc_number"/>
</t>
</t>
</div>
<div name="contact" class="col-auto mw-100 mb-2">
<strong>Your Contact:</strong>
<p t-field="o.user_id"/>
</div>
</div>
</div>
<div style="position:absolute; top:364px">
<h2 style="font-family:Bebasneue-Bold;font-size:20pt;line-height:14pt;">
<span t-if="o.release_capital_request == True">REQUEST TO RELEASE CAPITAL</span>
<span t-if="o.release_capital_request == False">
<span t-if="o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')">Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'proforma2'">PRO-FORMA</span>
<span t-if="o.type == 'out_invoice' and o.state == 'draft'">Draft Invoice</span>
<span t-if="o.type == 'out_invoice' and o.state == 'cancel'">Cancelled Invoice</span>
<span t-if="o.type == 'out_refund'">Refund</span>
<span t-if="o.type == 'in_refund'">Vendor Refund</span>
<span t-if="o.type == 'in_invoice'">Vendor Bill</span>
</span>
<span t-field="o.number"/>
<div style="width:220px;position:relative;top:10px;border-bottom: 4pt solid #e7511e;"/>
</h2>
<t t-set="display_discount" t-value="any([l.discount for l in o.invoice_line_ids])"/>
<table class="table table-sm o_main_table" name="invoice_line_table">
<thead>
<tr>
<t t-set="colspan" t-value="5"/>
<th class="text-left"><span>Description</span></th>
<th class="d-none text-left"><span>Source Document</span></th>
<th class="text-right"><span>Part Type</span></th>
<th class="text-right"><span>Quantity</span></th>
<th t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}"><span>Unit Price</span></th>
<th class="text-right">
<span groups="account.group_show_line_subtotals_tax_excluded">Amount</span>
<span groups="account.group_show_line_subtotals_tax_included">Total Price</span>
</th>
</tr>
</thead>
<tbody class="invoice_tbody">
<t t-set="current_subtotal" t-value="0"/>
<div class="row mt32 mb32 easymy-coop-info-title" style="top:102px;">
<div class="col-xs-2" t-if="o.name">
<strong>Description:</strong>
<p t-field="o.name"/>
</div>
<div class="col-xs-2" t-if="o.release_capital_request == True and o.date_invoice">
<strong>Request Date:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.release_capital_request == False and o.date_invoice">
<strong>Invoice Date:</strong>
<p t-field="o.date_invoice"/>
</div>
<div class="col-xs-2" t-if="o.release_capital_request == False and (o.date_due and o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid'))">
<strong>Due Date:</strong>
<p t-field="o.date_due"/>
</div>
<div class="col-xs-2" t-if="o.release_capital_request == False and o.origin">
<strong>Source:</strong>
<p t-field="o.origin"/>
</div>
<div class="col-xs-2" t-if="o.release_capital_request == False and o.partner_id.ref">
<strong>Customer Code:</strong>
<p t-field="o.partner_id.ref"/>
</div>
<div name="reference" class="col-xs-3" t-if="o.reference">
<strong>Structured Communication:</strong>
<p t-field="o.reference"/>
</div>
<div name="account_number" class="col-xs-3">
<strong>Account Number:</strong>
<t t-foreach="o.company_id.bank_journal_ids" t-as="journal">
<t t-set="b" t-value="journal.bank_account_id"/>
<t t-if="o.release_capital_request == True and journal.get_cooperator_payment">
<p t-field="b.acc_number"/>
</t>
<t t-if="o.release_capital_request == False and journal.get_general_payment">
<p t-field="b.acc_number"/>
</t>
</t>
</div>
<div name="contact" class="col-xs-3" t-if="o.user_id">
<strong>Your contact:</strong>
<p t-field="o.user_id"/>
</div>
</div>
<t t-foreach="o.invoice_line_ids" t-as="line">
<!-- Is there a discount on at least one line? -->
<t t-set="display_discount" t-value="any([l.discount for l in o.invoice_line_ids])"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<t t-set="current_subtotal" t-value="current_subtotal + line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
<table class="table border-easymy-coop" style="position:relative;top:85px;width:90%;align:center;">
<thead class="easymy-coop-info-title">
<tr>
<th>Description</th>
<th t-if="o.release_capital_request == True">Part Type</th>
<th class="text-right">Quantity</th>
<th class="text-right">Unit Price</th>
<th t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">Disc.(%)</th>
<th t-if="o.release_capital_request == False" class="text-right">Taxes</th>
<th class="text-right">Price</th>
</tr>
</thead>
<tbody class="invoice_tbody easymy-coop-normal">
<tr t-foreach="o.invoice_line_ids" t-as="l">
<td><span t-field="l.name"/></td>
<td t-if="o.release_capital_request == True">
<span t-field="l.product_id.short_name"/>
</td>
<td class="text-right">
<span t-if="l.quantity%1>0"><span t-esc='"%0.2f" % l.quantity'/></span>
<span t-if="l.quantity%1==0"><span t-esc='"%0.0f" % l.quantity'/></span>
<!-- <span t-field="l.quantity"/> -->
<span t-if="o.release_capital_request == False" t-field="l.uom_id" groups="product.group_uom"/>
</td>
<td class="text-right">
<span t-field="l.price_unit"/>
</td>
<td t-if="display_discount" class="text-right" groups="sale.group_discount_per_so_line">
<span t-field="l.discount"/>
</td>
<td t-if="o.release_capital_request == False" class="text-right">
<span t-esc="', '.join(map(lambda x: (x.description or x.name), l.invoice_line_tax_ids))"/>
</td>
<td class="text-right">
<span t-field="l.price_subtotal"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
<tr t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''">
<t t-if="not line.display_type" name="account_invoice_line_accountable">
<td name="account_invoice_line_name"><span t-field="line.name"/></td>
<td class="d-none"><span t-field="line.origin"/></td>
<td class="text-right">
<span t-field="line.product_id.short_name"/>
</td>
<td class="text-right">
<span t-field="line.quantity"/>
<span t-field="line.uom_id" groups="uom.group_uom"/>
</td>
<td t-attf-class="text-right {{ 'd-none d-md-table-cell' if report_type == 'html' else '' }}">
<span t-field="line.price_unit"/>
</td>
<td class="text-right o_price_total">
<span t-field="line.price_subtotal" groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="line.price_total" groups="account.group_show_line_subtotals_tax_included"/>
</td>
</t>
<t t-if="line.display_type == 'line_section'">
<td colspan="99">
<span t-field="line.name"/>
</td>
<t t-set="current_section" t-value="line"/>
<t t-set="current_subtotal" t-value="0"/>
</t>
<t t-if="line.display_type == 'line_note'">
<td colspan="99">
<span t-field="line.name"/>
</td>
</t>
</tr>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed easymy-coop-info-title" style="position:relative;top:130px;width:68%">
<tr t-if="o.release_capital_request == False">
<td><strong>Subtotal</strong></td>
<td class="text-right">
<span t-field="o.amount_untaxed" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
<t t-if="o.release_capital_request == False">
<t t-foreach="o._get_tax_amount_by_group()" t-as="amount_by_group">
<tr>
<td><span t-esc="amount_by_group[0]"/></td>
<td class="text-right">
<span t-esc="amount_by_group[1]"/>
</td>
</tr>
</t>
</t>
<tr class="border-top-easymy-coop">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-field="o.amount_total" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
</table>
</div>
</div>
<t t-if="current_section and (line_last or o.invoice_line_ids[line_index+1].display_type == 'line_section')">
<tr class="is-subtotal text-right">
<td colspan="99">
<strong class="mr16">Subtotal</strong>
<span
t-esc="current_subtotal"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'
/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
<div class="row" t-if="o.tax_line_ids">
<div class="col-xs-6">
<table class="table border-easymy-coop">
<thead>
<tr>
<th>Tax</th>
<th class="text-right">Base</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.tax_line_ids" t-as="t">
<td>
<span t-field="t.name"/>
</td>
<td class="text-right">
<span t-field="t.base"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
<td class="text-right">
<span t-field="t.amount"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="clearfix">
<div id="total" class="row">
<div t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto">
<table class="table table-sm">
<tr class="border-black o_total">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-field="o.amount_total"/>
</td>
</tr>
</table>
</div>
</div>
</div>
<p t-if="o.reference">
Please use the following communication for your payment : <b><span t-field="o.reference"/></b>
</p>
<p t-if="o.comment" name="comment">
<span t-field="o.comment"/>
</p>
<p t-if="o.payment_term_id" name="payment_term">
<span t-field="o.payment_term_id.note"/>
</p>
<p t-if="o.fiscal_position_id.note" name="note">
<span t-field="o.fiscal_position_id.note"/>
</p>
<div id="qrcode" t-if="(o.partner_id.country_id.code in ['BE', 'AT', 'DE', 'FI', 'NL']) and (o.company_id.qr_code) and (o.currency_id.name == 'EUR') and (o.partner_bank_id.acc_number != False)">
<p t-if="(o.partner_bank_id.qr_code_valid)">
<strong class="text-center">Scan me with your banking app.</strong><br /><br />
<img class="border border-dark rounded" t-att-src="o.partner_bank_id.build_qr_code_url(o.residual,(o.reference) if (o.reference) else o.number)"/>
</p>
<p t-if="(o.partner_bank_id.qr_code_valid == False)">
<strong class="text-center">The SEPA QR Code informations are not set correctly.</strong><br />
</p>
</div>
</div>
</t>
<p t-if="o.comment">
<strong>Comment:</strong>
<span t-field="o.comment"/>
</p>
<p t-if="o.release_capital_request == False and o.payment_term_id">
<span t-field="o.payment_term_id.note"/>
</p>
<p t-if="o.release_capital_request == False and o.fiscal_position_id.note">
<strong>Fiscal Position Remark:</strong>
<span t-field="o.fiscal_position_id.note"/>
</p>
</div>
</div>
</t>
</template>
<template id="theme_invoice_G002">
<t t-call="web.html_container">
<t t-set="data_report_margin_top" t-value="10"/>
<t t-set="data_report_header_spacing" t-value="5"/>
<t t-set="data_report_dpi" t-value="110"/>
<template id="theme_invoice_G002">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="easy_my_coop.theme_invoice_G002_document" t-lang="o.partner_id.lang"/>
</t>
</t>
</template>
<t t-foreach="docs" t-as="o">
<t t-call="easy_my_coop.theme_invoice_G002_document" t-lang="o.partner_id.lang"/>
</t>
</t>
</template>
</data>
</openerp>
</odoo>
Loading…
Cancel
Save