Dokumentenvorlagen: Angebot/Auftrag und Rechnung

develop
Ahmed Aly 2018-01-02 13:29:42 +01:00
parent 4def9ef90a
commit 9fbe0c0f1e
4 changed files with 183 additions and 85 deletions

View File

@ -37,3 +37,24 @@ class AccountPaymentTerm(models.Model):
_inherit = 'account.payment.term'
code = fields.Char(string='Code')
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
positions = fields.Integer(string='Positionen', compute='_compute_positions')
num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items')
@api.multi
def _compute_positions(self):
for record in self:
record.positions = len(record.invoice_line_ids)
@api.multi
def _compute_num_items(self):
for record in self:
num_items = 0
for line in record.invoice_line_ids:
if line.uom_id == self.env.ref('product.product_uom_unit'): # wenn die Mengeneinheit Stk. ist
num_items += line.quantity
record.num_items = num_items

View File

@ -43,6 +43,22 @@ class SaleOrder(models.Model):
internal_notes = fields.Text()
assembly_notes = fields.Text()
earliest_scheduled_date = fields.Datetime(compute='_compute_earliest_scheduled_date')
positions = fields.Integer(string='Positionen', compute='_compute_positions')
num_items = fields.Integer(string='Anzahl der Artikel', compute='_compute_num_items')
@api.multi
def _compute_positions(self):
for record in self:
record.positions = len(record.order_line)
@api.multi
def _compute_num_items(self):
for record in self:
num_items = 0
for line in record.order_line:
if line.product_uom == self.env.ref('product.product_uom_unit'): # wenn die Mengeneinheit Stk. ist
num_items += line.product_uom_qty
record.num_items = num_items
@api.multi
def _compute_earliest_scheduled_date(self):

View File

@ -7,7 +7,9 @@
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<div class="page">
<div class="row">
<div class="col-xs-6" name="invoice_address">
<div name="invoice_address" style="width:32%;padding-left:15px;padding-right:15px;float: left;">
<u style="font-size: large;">Kundendaten</u>
<br/>
<strong>
<span t-esc="o.partner_id.name"/>
</strong>
@ -18,42 +20,68 @@
<span t-esc="o.partner_id.city"/>
<br/>
<span t-esc="o.partner_id.country_id.name"/>
<br/>
Email:
<span t-esc="o.partner_id.email"/>
<br/>
Telefon:
<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="row">
<div class="col-xs-offset-6 col-xs-6 text-right" style="padding-right:0;">
<div class="col-xs-12" style="padding-right:2px;" t-if="o.partner_id.ref">
<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="col-xs-12" style="padding-right:2px;" t-if="o.partner_id.vat">
<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="col-xs-12" style="padding-right:2px;" t-if="o.name">
<div class="row" style="margin-right:0px;" t-if="o.name">
<span class="col-xs-6 text-left">Ihre Referenz:</span>
<span class="col-xs-6" t-field="o.name"/>
</div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.origin">
<div class="row" style="margin-right:0px;" t-if="o.origin">
<span class="col-xs-6 text-left">Referenzbeleg:</span>
<span class="col-xs-6" t-field="o.origin"/>
</div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.date_invoice">
<div class="row" style="margin-right:0px;" t-if="o.date_invoice">
<span class="col-xs-6 text-left">Rechnungsdatum:</span>
<span class="col-xs-6" t-field="o.date_invoice"/>
</div>
<div class="col-xs-12" style="padding-right:2px;" t-if="o.user_id">
<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="col-xs-12" style="padding-right:2px;" t-if="o.user_id and o.user_id.email">
<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="col-xs-12" style="padding-right:2px;" t-if="o.user_id and o.user_id.phone">
<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>
@ -74,16 +102,14 @@
</div>
<table class="mt32 table table-condensed">
<t t-set="art_number_is_set"
t-value="field_set_in_lines(o.invoice_line_ids, 'product_id.default_code')"/>
<t t-set="discount_is_set" t-value="field_set_in_lines(o.invoice_line_ids, 'discount')"/>
<thead>
<tr>
<th class="text-center">Pos</th>
<th class="text-center" t-if="art_number_is_set">Art-Nr.</th>
<th class="text-left">Bezeichnung</th>
<th class="text-center">Menge</th>
<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>
@ -91,30 +117,50 @@
<tbody class="invoice_tbody">
<t t-set="pos_nr" t-value="0"/>
<tr t-foreach="o.invoice_line_ids" 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-center" t-if="art_number_is_set">
<span t-field="invoice_line.product_id.default_code"/>
</td>
<td class="text-left">
<span t-field="invoice_line.name"/>
</td>
<td class="text-center">
<td class="text-right">
<span t-field="invoice_line.quantity"/>
</td>
<td class="text-right">
<span t-field="invoice_line.product_id.weight"/>
</td>
<td class="text-right">
<span t-field="invoice_line.price_unit"/>
</td>
<td class="text-right" t-if="discount_is_set">
<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" t-if="discount_is_set">
<span t-field="invoice_line.discount"/>
</td>
<td class="text-right">
<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;">
<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>
@ -156,11 +202,14 @@
<p class="col-xs-12">
<span t-field="o.comment"/>
</p>
<p class="col-xs-12">
<t t-if="o.payment_term_id.note">
<t t-esc="o.payment_term_id.note"/>
<p class="col-xs-12" t-if="o.incoterms_id.name">
Lieferkonditionen:
<span t-esc="o.incoterms_id.name"/>
<br/>
</p>
<p class="col-xs-12" t-if="o.payment_term_id.note">
<span t-esc="o.payment_term_id.note"/>
<br/>
</t>
</p>
</div>
</div>

View File

@ -7,8 +7,8 @@
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})"/>
<div class="page">
<div class="row">
<div style="width:31%;padding-left:15px;padding-right:5px;float: left;">
Kundendaten
<div style="width:32%;padding-left:15px;padding-right:15px;float: left;">
<u style="font-size: large;">Kundendaten</u>
<br/>
<strong>
<span t-esc="o.partner_id.name"/>
@ -27,8 +27,8 @@
Telefon:
<span t-esc="o.partner_id.phone"/>
</div>
<div style="width:27%;padding-left:5px;padding-right:5px;float: left;">
Lieferadresse
<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"/>
@ -41,51 +41,59 @@
<br/>
<span t-esc="o.partner_shipping_id.country_id.name"/>
</div>
<div class="text-right" style="width:42%;padding-right:2px;float: left;margin-top: 80px;">
<div t-if="o.partner_id.ref">
<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 t-if="o.partner_id.vat">
<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 t-if="o.client_order_ref">
<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 t-if="o.state in ['draft','sent'] and o.date_order">
<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 t-if="o.earliest_scheduled_date">
<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 t-if="o.state in ['draft','sent'] and o.validity_date">
<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 t-if="o.state not in ['draft','sent'] and o.confirmation_date">
<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 t-if="o.user_id">
<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 t-if="o.user_id and o.user_id.email">
<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 t-if="o.user_id and o.user_id.phone">
<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>
@ -94,22 +102,20 @@
<h4>
<span t-if="o.state not in ['draft','sent']">Auftragsbestätigung</span>
<span t-if="o.state in ['draft','sent']">Angebot</span>
<span t-field="o.name"/>
<span t-field="o.quote_name"/>
</h4>
</div>
</div>
<table class="oe_mt32 table table-condensed">
<t t-set="art_number_is_set"
t-value="field_set_in_lines(o.order_line, 'product_id.default_code')"/>
<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" t-if="art_number_is_set">Art-Nr.</th>
<th class="text-left">Bezeichnung</th>
<th class="text-center">Menge</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>
@ -122,23 +128,30 @@
<td class="text-center">
<span t-esc="pos_nr"/>
</td>
<td class="text-center" t-if="art_number_is_set">
<span t-field="order_line.product_id.default_code"/>
</td>
<td rowspan="2" class="text-left">
<span t-field="order_line.name"/>
<br/>
<p>
Zolltarif Nr.:
<span t-field="order_line.product_id.intrastat_id"/>
</p>
</td>
<td rowspan="2" class="text-center">
<td class="text-left">
<span t-field="order_line.product_uom_qty"/>
</td>
<td rowspan="2" class="text-right">
<td class="text-right">
<span t-field="order_line.product_id.weight"/>
</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>
@ -147,7 +160,7 @@
</td>
</tr>
<tr>
<td colspan="2" style="border: 0;text-align: center;">
<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>
@ -199,9 +212,8 @@
<span t-esc="o.incoterm.name"/>
<br/>
</p>
<p class="col-xs-12" t-if="o.payment_term_id.name">
Zahlungskonditionen:
<span t-esc="o.payment_term_id.name"/>
<p class="col-xs-12" t-if="o.payment_term_id.note">
<span t-esc="o.payment_term_id.note"/>
<br/>
</p>
</div>