Fall 5041: Anpassungen Rechnungsreport, US01 umgesetzt

develop
Roman Widmann 2018-03-07 14:43:24 +01:00
parent f8c775176a
commit 06c0d8f1a9
3 changed files with 96 additions and 64 deletions

View File

@ -2,3 +2,4 @@
from . import report_helper
from . import account_invoice

View File

@ -0,0 +1,21 @@
# Copyright 2018-Today datenpol gmbh (<http://www.datenpol.at>)
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
from odoo import api, models
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
def order_lines_layouted(self):
res = super(AccountInvoice, self).order_lines_layouted()
uncategorized = False
# Rechnungszeilen ohne Kategorie löschen und an den Anfang stellen
for idx1, page in enumerate(res):
for idx2, category in enumerate(page):
if category.get('name') == 'Uncategorized':
uncategorized = page.pop(idx2)
if uncategorized:
res[idx1] = [uncategorized] + res[idx1]
return res

View File

@ -67,73 +67,83 @@
<span class="col-xs-2" t-field="o.name"/>
</div>
<div class="row mt32"/>
<table class="table table-condensed">
<t t-set="discount_is_set" t-value="field_set_in_lines(o.invoice_line_ids, 'discount')"/>
<thead class="table-header">
<tr>
<th class="text-center">Pos.</th>
<th class="text-center">Anzahl</th>
<th class="text-right">Gewicht</th>
<th class="text-right"></th>
<th class="text-left">Artikel</th>
<th class="text-right">EP</th>
<th class="text-right" t-if="discount_is_set">Rabatt</th>
<th class="text-right">Gesamtpreis</th>
</tr>
</thead>
<tbody class="invoice-tbody">
<t t-set="pos_nr" t-value="0"/>
<t t-foreach="o.invoice_line_ids" t-as="invoice_line">
<t t-foreach="o.order_lines_layouted()" t-as="page" name="lines_layouted">
<table class="table table-condensed">
<t t-set="discount_is_set" t-value="field_set_in_lines(o.invoice_line_ids, 'discount')"/>
<thead class="table-header">
<tr>
<t t-set="pos_nr" t-value="pos_nr+1"/>
<td class="text-center">
<span t-esc="pos_nr"/>
</td>
<td class="text-right">
<span t-field="invoice_line.quantity"/>
</td>
<td class="text-right">
<span t-field="invoice_line.product_id.weight"/> kg
</td>
<td class="text-right">
</td>
<td rowspan="2" class="text-left">
<t t-if="invoice_line.product_id.default_code">
<strong>
<span t-field="invoice_line.product_id.default_code"/>
</strong>
<br/>
</t>
<span>
<strong>Zolltarif Nr.:</strong>
<span t-field="invoice_line.product_id.intrastat_id"/>
</span>
<br/>
<span t-field="invoice_line.name"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="invoice_line.price_unit"/>
</td>
<td rowspan="2" class="text-right" t-if="discount_is_set">
<span t-field="invoice_line.discount"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="invoice_line.price_subtotal"/>
</td>
<th class="text-center">Pos.</th>
<th class="text-center">Anzahl</th>
<th class="text-right">Gewicht</th>
<th class="text-right"></th>
<th class="text-left">Artikel</th>
<th class="text-right">EP</th>
<th class="text-right" t-if="discount_is_set">Rabatt</th>
<th class="text-right">Gesamtpreis</th>
</tr>
</thead>
<tr>
<td colspan="4" style="border: 0;text-align: center;">
<!-- Fall 5078, Rechnung - keine Bilder mehr
<img t-if="invoice_line.product_id.image_medium"
t-att-src="'data:image/png;base64,%s' % invoice_line.product_id.image_medium.decode()"/>
-->
</td>
</tr>
</t>
</tbody>
</table>
<tbody class="invoice-tbody">
<t t-set="pos_nr" t-value="0"/>
<t t-foreach="page" t-as="layout_category">
<tr t-if="layout_category['name'] != 'Uncategorized'">
<td colspan="7">
<strong><t t-esc="layout_category['name']"/></strong>
</td>
</tr>
<t t-foreach="layout_category['lines']" t-as="invoice_line">
<!-- <t t-foreach="o.invoice_line_ids" t-as="invoice_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-right">
<span t-field="invoice_line.quantity"/>
</td>
<td class="text-right">
<span t-field="invoice_line.product_id.weight"/> kg
</td>
<td class="text-right">
</td>
<td rowspan="2" class="text-left">
<t t-if="invoice_line.product_id.default_code">
<strong>
<span t-field="invoice_line.product_id.default_code"/>
</strong>
<br/>
</t>
<span>
<strong>Zolltarif Nr.:</strong>
<span t-field="invoice_line.product_id.intrastat_id"/>
</span>
<br/>
<span t-field="invoice_line.name"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="invoice_line.price_unit"/>
</td>
<td rowspan="2" class="text-right" t-if="discount_is_set">
<span t-field="invoice_line.discount"/>
</td>
<td rowspan="2" class="text-right">
<span t-field="invoice_line.price_subtotal"/>
</td>
</tr>
<tr>
<td colspan="4" style="border: 0;text-align: center;">
<!-- Fall 5078, Rechnung - keine Bilder mehr
<img t-if="invoice_line.product_id.image_medium"
t-att-src="'data:image/png;base64,%s' % invoice_line.product_id.image_medium.decode()"/>
-->
</td>
</tr>
</t>
</t>
</tbody>
</table>
</t>
<div class="row">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">