Dokumentenvorlagen: Angebot/Auftrag und Rechnung Feedback

develop
Ahmed Aly 2018-01-08 10:42:22 +01:00
parent 9fbe0c0f1e
commit 440889d56a
2 changed files with 260 additions and 223 deletions

View File

@ -20,3 +20,22 @@ class SaleOrder(models.AbstractModel):
'field_set_in_lines': self._field_set_in_lines, 'field_set_in_lines': self._field_set_in_lines,
'formatLang': self._formatLang, 'formatLang': self._formatLang,
} }
class SaleOrderProForma(models.AbstractModel):
_name = 'report.sale.report_saleorder_pro_forma'
_inherit = 'report.abstract_report'
_template = 'sale.report_saleorder_pro_forma'
@api.model
def get_report_values(self, docids, data=None):
model = 'sale.order'
docs = self.env[model].browse(docids)
return {
'doc_ids': docids,
'doc_model': model,
'docs': docs,
'data': data,
'field_set_in_lines': self._field_set_in_lines,
'formatLang': self._formatLang,
}

View File

@ -1,238 +1,256 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<data> <!-- Sale Order Body -->
<!-- Sale Order Body --> <template id="report_saleorder_document">
<template id="report_saleorder_document"> <t t-call="web.external_layout">
<t t-call="web.external_layout"> <t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/> <div class="page">
<div class="page"> <div class="row">
<div class="row"> <div style="width:32%;padding-left:15px;padding-right:15px;float: left;">
<div style="width:32%;padding-left:15px;padding-right:15px;float: left;"> <u style="font-size: large;">Kundendaten</u>
<u style="font-size: large;">Kundendaten</u> <br/>
<br/> <strong>
<strong> <span t-esc="o.partner_id.name"/>
<span t-esc="o.partner_id.name"/> </strong>
</strong> <br/>
<br/> <span t-esc="o.partner_id.street"/>
<span t-esc="o.partner_id.street"/> <br/>
<br/> <span t-esc="o.partner_id.zip"/>
<span t-esc="o.partner_id.zip"/> <span t-esc="o.partner_id.city"/>
<span t-esc="o.partner_id.city"/> <br/>
<br/> <span t-esc="o.partner_id.country_id.name"/>
<span t-esc="o.partner_id.country_id.name"/> <br/>
<br/> Email:
Email: <span t-esc="o.partner_id.email"/>
<span t-esc="o.partner_id.email"/> <br/>
<br/> Telefon:
Telefon: <span t-esc="o.partner_id.phone"/>
<span t-esc="o.partner_id.phone"/>
</div>
<div style="width:30%;padding-left:15px;padding-right:10px;float: left;">
<u style="font-size: large;">Lieferadresse</u>
<br/>
<strong>
<span t-esc="o.partner_shipping_id.name"/>
</strong>
<br/>
<span t-esc="o.partner_shipping_id.street"/>
<br/>
<span t-esc="o.partner_shipping_id.zip"/>
<span t-esc="o.partner_shipping_id.city"/>
<br/>
<span t-esc="o.partner_shipping_id.country_id.name"/>
</div>
<div class="text-right" style="width:38%;float: left;margin-top: 80px;">
<div class="row" style="margin-right:0px;" t-if="o.partner_id.ref">
<span class="col-xs-6 text-left">Kundennr.:</span>
<span class="col-xs-6" t-field="o.partner_id.ref"/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.partner_id.vat">
<span class="col-xs-6 text-left">Ihre UID:</span>
<span class="col-xs-6" t-field="o.partner_id.vat"/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.client_order_ref">
<span class="col-xs-6 text-left">Ihre Referenz:</span>
<span class="col-xs-6" t-field="o.client_order_ref"/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.state in ['draft','sent'] and o.date_order">
<span class="col-xs-6 text-left">Angebotsdatum:</span>
<span class="col-xs-6" t-field="o.date_order"
t-options='{"format": "dd.MM.yyyy"}'/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.earliest_scheduled_date">
<span class="col-xs-6 text-left">Lieferdatum:</span>
<span class="col-xs-6" t-field="o.earliest_scheduled_date"
t-options='{"format": "dd.MM.yyyy"}'/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.state in ['draft','sent'] and o.validity_date">
<span class="col-xs-6 text-left">Gültig bis:</span>
<span class="col-xs-6" t-field="o.validity_date"
t-options='{"format": "dd.MM.yyyy"}'/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.state not in ['draft','sent'] and o.confirmation_date">
<span class="col-xs-6 text-left">Bestelldatum:</span>
<span class="col-xs-6" t-field="o.confirmation_date"
t-options='{"format": "dd.MM.yyyy"}'/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.user_id">
<span class="col-xs-6 text-left">Ansprechpartner:</span>
<span class="col-xs-6" t-field="o.user_id"/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.user_id and o.user_id.email">
<span class="col-xs-6 text-left">Email:</span>
<span class="col-xs-6" t-field="o.user_id.email"/>
</div>
<div class="row" style="margin-right:0px;" t-if="o.user_id and o.user_id.phone">
<span class="col-xs-6 text-left">Telefon:</span>
<span class="col-xs-6" t-field="o.user_id.phone"/>
</div>
<div class="row oe_mt16" style="margin-right:0px;" >
<span class="col-xs-offset-2 col-xs-4 text-left">Positionen:</span>
<span class="col-xs-6" t-field="o.positions"/>
</div>
<div class="row" style="margin-right:0px;" >
<span class="col-xs-offset-2 col-xs-4 text-left">Artikel:</span>
<span class="col-xs-6" t-field="o.num_items"/>
</div>
</div>
</div> </div>
<div style="width:30%;padding-left:15px;padding-right:10px;float: left;">
<div class="row oe_mt32"> <u style="font-size: large;">Lieferadresse</u>
<div class="col-xs-12 text-left"> <br/>
<h4> <strong>
<span t-if="o.state not in ['draft','sent']">Auftragsbestätigung</span> <span t-esc="o.partner_shipping_id.name"/>
<span t-if="o.state in ['draft','sent']">Angebot</span> </strong>
<span t-field="o.quote_name"/> <br/>
</h4> <span t-esc="o.partner_shipping_id.street"/>
</div> <br/>
<span t-esc="o.partner_shipping_id.zip"/>
<span t-esc="o.partner_shipping_id.city"/>
<br/>
<span t-esc="o.partner_shipping_id.country_id.name"/>
</div> </div>
<div class="text-right" style="width:38%;float: left;;">
<table class="oe_mt32 table table-condensed"> <div class="row" style="margin-right:0px;" t-if="o.partner_id.ref">
<t t-set="discount_is_set" t-value="field_set_in_lines(o.order_line, 'discount')"/> <span class="col-xs-6 text-left">Kundennr.:</span>
<thead> <span class="col-xs-6" t-field="o.partner_id.ref"/>
<tr> </div>
<th class="text-center">Pos.</th> <div class="row" style="margin-right:0px;" t-if="o.partner_id.vat">
<th class="text-center">Anzahl</th> <span class="col-xs-6 text-left">Ihre UID:</span>
<th class="text-right">Gewicht</th> <span class="col-xs-6" t-field="o.partner_id.vat"/>
<th class="text-right">Einzelpreis</th> </div>
<th class="text-left">Artikel</th> <div class="row" style="margin-right:0px;" t-if="o.client_order_ref">
<th class="text-right" t-if="discount_is_set">Rabatt</th> <span class="col-xs-6 text-left">Ihre Referenz:</span>
<th class="text-right">Gesamtpreis</th> <span class="col-xs-6" t-field="o.client_order_ref"/>
</tr> </div>
</thead> <div class="row" style="margin-right:0px;" t-if="o.state in ['draft','sent'] and o.date_order">
<tbody class="sale_tbody"> <span class="col-xs-6 text-left">Angebotsdatum:</span>
<t t-set="pos_nr" t-value="0"/> <span class="col-xs-6" t-field="o.date_order"
<t t-foreach="o.order_line" t-as="order_line"> t-options='{"format": "dd.MM.yyyy"}'/>
<tr> </div>
<t t-set="pos_nr" t-value="pos_nr+1"/> <div class="row" style="margin-right:0px;" t-if="o.earliest_scheduled_date">
<td class="text-center"> <span class="col-xs-6 text-left">Lieferdatum:</span>
<span t-esc="pos_nr"/> <span class="col-xs-6" t-field="o.earliest_scheduled_date"
</td> t-options='{"format": "dd.MM.yyyy"}'/>
<td class="text-left"> </div>
<span t-field="order_line.product_uom_qty"/> <div class="row" style="margin-right:0px;"
</td> t-if="o.state in ['draft','sent'] and o.validity_date">
<td class="text-right"> <span class="col-xs-6 text-left">Gültig bis:</span>
<span t-field="order_line.product_id.weight"/> <span class="col-xs-6" t-field="o.validity_date"
</td> t-options='{"format": "dd.MM.yyyy"}'/>
<td class="text-right"> </div>
<span t-field="order_line.price_unit"/> <div class="row" style="margin-right:0px;"
</td> t-if="o.state not in ['draft','sent'] and o.confirmation_date">
<td rowspan="2" class="text-left"> <span class="col-xs-6 text-left">Bestelldatum:</span>
<t t-if="order_line.product_id.default_code"> <span class="col-xs-6" t-field="o.confirmation_date"
<strong> t-options='{"format": "dd.MM.yyyy"}'/>
<span t-field="order_line.product_id.default_code"/> </div>
</strong> <div class="row" style="margin-right:0px;" t-if="o.user_id">
<br/> <span class="col-xs-6 text-left">Ansprechpartner:</span>
</t> <span class="col-xs-6" t-field="o.user_id"/>
<span> </div>
<strong>Zolltarif Nr.:</strong> <div class="row" style="margin-right:0px;" t-if="o.user_id and o.user_id.email">
<span t-field="order_line.product_id.intrastat_id"/> <span class="col-xs-6 text-left">Email:</span>
</span> <span class="col-xs-6" t-field="o.user_id.email"/>
<br/> </div>
<span t-field="order_line.name"/> <div class="row" style="margin-right:0px;" t-if="o.user_id and o.user_id.phone">
</td> <span class="col-xs-6 text-left">Telefon:</span>
<span class="col-xs-6" t-field="o.user_id.phone"/>
<td rowspan="2" class="text-right" t-if="discount_is_set"> </div>
<span t-field="order_line.discount"/> <div class="row oe_mt16" style="margin-right:0px;">
</td> <span class="col-xs-6 text-left">Positionen:</span>
<td rowspan="2" class="text-right"> <span class="col-xs-6" t-field="o.positions"/>
<span t-field="order_line.price_subtotal"/> </div>
</td> <div class="row" style="margin-right:0px;">
</tr> <span class="col-xs-6 text-left">Artikel:</span>
<tr> <span class="col-xs-6" t-field="o.num_items"/>
<td colspan="4" style="border: 0;text-align: center;">
<img t-if="order_line.product_id.image_medium"
t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()"/>
</td>
</tr>
</t>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Zwischensumme</strong>
</td>
<td class="text-right">
<span t-field="o.amount_untaxed"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
<tr>
<td>
<span>MwSt.</span>
</td>
<td class="text-right">
<span t-field="o.amount_tax"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
<tr class="border-black">
<td>
<strong>Gesamtsumme</strong>
</td>
<td class="text-right">
<span t-field="o.amount_total"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</table>
</div> </div>
</div>
<div class="row">
<p class="col-xs-12">
<span t-field="o.note"/>
</p>
<p class="col-xs-12" t-if="o.incoterm.name">
Lieferkonditionen:
<span t-esc="o.incoterm.name"/>
<br/>
</p>
<p class="col-xs-12" t-if="o.payment_term_id.note">
<span t-esc="o.payment_term_id.note"/>
<br/>
</p>
</div> </div>
</div> </div>
<div class="row oe_mt32">
<div class="col-xs-12 text-left">
<h4>
<t t-if="not (env.context.get('proforma', False) or is_pro_forma)">
<span t-if="o.state not in ['draft','sent']">Auftragsbestätigung</span>
<span t-if="o.state in ['draft','sent']">Angebot</span>
</t>
<t t-if="env.context.get('proforma', False) or is_pro_forma">
<span>Proformarechnung</span>
</t>
<span t-field="o.quote_name"/>
</h4>
</div>
</div>
<table class="oe_mt32 table table-condensed">
<t t-set="discount_is_set" t-value="field_set_in_lines(o.order_line, 'discount')"/>
<thead>
<tr>
<th class="text-center">Pos.</th>
<th class="text-center">Anzahl</th>
<th class="text-right">Gewicht</th>
<th class="text-right">Einzelpreis</th>
<th class="text-left">Artikel</th>
<th class="text-right" t-if="discount_is_set">Rabatt</th>
<th class="text-right">Gesamtpreis</th>
</tr>
</thead>
<tbody class="sale_tbody">
<t t-set="pos_nr" t-value="0"/>
<t t-foreach="o.order_line" t-as="order_line">
<tr>
<t t-set="pos_nr" t-value="pos_nr+1"/>
<td class="text-center">
<span t-esc="pos_nr"/>
</td>
<td class="text-left">
<span t-field="order_line.product_uom_qty"/>
</td>
<td class="text-right">
<span t-field="order_line.product_id.weight"/>
<span t-field="order_line.product_uom"/>
</td>
<td class="text-right">
<span t-field="order_line.price_unit"/>
</td>
<td rowspan="2" class="text-left">
<t t-if="order_line.product_id.default_code">
<strong>
<span t-field="order_line.product_id.default_code"/>
</strong>
<br/>
</t>
<span>
<strong>Zolltarif Nr.:</strong>
<span t-field="order_line.product_id.intrastat_id"/>
</span>
<br/>
<span t-field="order_line.name"/>
</td>
<td rowspan="2" class="text-right" t-if="discount_is_set">
<span t-field="order_line.discount"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="order_line.price_subtotal"/>
</td>
</tr>
<tr>
<td colspan="4" style="border: 0;text-align: center;">
<img t-if="order_line.product_id.image_medium"
t-att-src="'data:image/png;base64,%s' % order_line.product_id.image_medium.decode()"/>
</td>
</tr>
</t>
</tbody>
</table>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td>
<strong>Zwischensumme</strong>
</td>
<td class="text-right">
<span t-field="o.amount_untaxed"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
<tr>
<td>
<span>MwSt.</span>
</td>
<td class="text-right">
<span t-field="o.amount_tax"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
<tr class="border-black">
<td>
<strong>Gesamtsumme</strong>
</td>
<td class="text-right">
<span t-field="o.amount_total"
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<p class="col-xs-12">
<span t-field="o.note"/>
</p>
<p class="col-xs-12" t-if="o.incoterm.name">
Lieferkonditionen:
<span t-esc="o.incoterm.name"/>
<br/>
</p>
<p class="col-xs-12" t-if="o.payment_term_id.note">
Zahlungskonditionen:
<span t-esc="o.payment_term_id.note"/>
<br/>
</p>
</div>
</div>
</t>
</template>
<template id="sale.report_saleorder">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="dp_reports_sale.report_saleorder_document" t-lang="o.partner_id.lang"/>
</t> </t>
</template> </t>
</template>
<template id="sale.report_saleorder"> <template id="sale.report_saleorder_pro_forma">
<t t-call="web.html_container"> <t t-call="web.html_container">
<t t-foreach="docs" t-as="o"> <t t-set="is_pro_forma" t-value="True"/>
<t t-call="dp_reports_sale.report_saleorder_document" t-lang="o.partner_id.lang"/> <t t-foreach="docs" t-as="o">
</t> <t t-call="dp_reports_sale.report_saleorder_document" t-lang="o.partner_id.lang"/>
</t> </t>
</template> </t>
</template>
</data>
<record id="sale.action_report_saleorder" model="ir.actions.report"> <record id="sale.action_report_saleorder" model="ir.actions.report">
<field name="paperformat_id" ref="dp_reports.paperformat_a4_european"/> <field name="paperformat_id" ref="dp_reports.paperformat_a4_european"/>
</record> </record>
<record id="sale.action_report_pro_forma_invoice" model="ir.actions.report">
<field name="paperformat_id" ref="dp_reports.paperformat_a4_european"/>
</record>
</odoo> </odoo>