Feedback 1674:

develop
Ahmed Aly 2018-05-08 14:57:11 +02:00
parent 6ebcf75dc0
commit c9a737cf5d
7 changed files with 68 additions and 20 deletions

View File

@ -29,6 +29,7 @@ class AccountInvoiceLine(models.Model):
lot_id = fields.Many2one(comodel_name='stock.production.lot', string='Lot')
weight = fields.Float(string='Gewicht', compute='_compute_weight')
hide_intrastat_code = fields.Boolean('ZV', help='Zolltarifnummer verbergen')
dealer_discount = fields.Boolean(string='Händlerrabatt')
@api.model
def create(self, vals):

View File

@ -517,7 +517,8 @@ class SaleOrderLine(models.Model):
'quantity': 1.0,
'uom_id': self.env.ref('product.product_uom_unit').id,
'name': 'Händlerrabatt {}%'.format(discount),
'hide_intrastat_code': True
'hide_intrastat_code': True,
'dealer_discount': True
})
del vals['discount']
invoice_lines |= self.env['account.invoice.line'].create(vals)

View File

@ -20,6 +20,7 @@
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree//field[@name='invoice_line_tax_ids']" position="before">
<field name="hide_intrastat_code"/>
<field name="dealer_discount" invisible="1"/>
</xpath>
</field>
</record>

View File

@ -118,6 +118,13 @@
</strong>
</div>
</div>
<div class="row" style="padding-left:0;">
<div class="col-xs-12 text-center">
<strong>
Die AGBs sind auf der Homepage verfügbar.
</strong>
</div>
</div>
<div class="row">
<div class="col-xs-12 text-right">
<ul class="list-inline">

View File

@ -13,6 +13,7 @@
'account_invoicing',
'report_intrastat',
'dp_reports',
'dp_custom',
'dp_sale_hide_discount',
],
'data': [

View File

@ -4,9 +4,35 @@ from odoo import api, models, _
from odoo.exceptions import ValidationError
class AccountReportHelper(models.AbstractModel):
_name = "report.account_abstract_report"
_inherit = ["report.abstract_report"]
@api.model
def _field_set_in_lines(self, lines, field):
fields = field.split('.')
for line in lines:
temp = None
for idx, field in enumerate(fields):
if not temp and idx == 0:
temp = line.__getattribute__(field)
if field == 'discount':
temp = temp and not line.__getattribute__('hide_discount')
elif not temp and idx != 0:
return False
else:
if len(temp) > 1:
temp = temp[0].__getattribute__(field)
else:
temp = temp.__getattribute__(field)
if temp:
return True
return False
class AccountInvoice(models.AbstractModel):
_name = 'report.account.report_invoice'
_inherit = 'report.abstract_report'
_inherit = 'report.account_abstract_report'
_template = 'account.report_invoice'
@api.model
@ -25,7 +51,7 @@ class AccountInvoice(models.AbstractModel):
class AccountInvoiceWithIntrastat(models.AbstractModel):
_name = 'report.dp_reports_account.report_invoice_with_intrastat'
_inherit = 'report.abstract_report'
_inherit = 'report.account_abstract_report'
_template = 'dp_reports_account.report_invoice_with_intrastat'
@api.model

View File

@ -55,20 +55,16 @@
<span class="col-xs-2" t-field="o.positions"/>
</div>
<div class="row height-20">
<div class="col-xs-3">
<div class="col-xs-3" style="padding-right: 0px;">
<strong>
<span class="col-xs-8" style="padding: 0px">Rechnungsdatum:</span>
<span style="padding-right: 5px">Rechnungsdatum:</span>
</strong>
<span class="col-xs-4" style="padding: 0px" t-field="o.date_invoice"/>
<span style="padding: 0px" t-field="o.date_invoice"/>
</div>
<strong>
<span class="col-xs-2">Email:</span>
</strong>
<span class="col-xs-3" t-field="o.user_id.email"/>
<strong>
<span class="col-xs-2">Artikel:</span>
</strong>
<span class="col-xs-2" t-field="o.num_items"/>
<span class="col-xs-3" t-field="res_company.email"/>
</div>
<div class="row">
<div class="col-xs-3"/>
@ -89,7 +85,7 @@
<tr>
<th class="text-center">Pos.</th>
<th class="text-right">Anzahl</th>
<th class="text-right">Gewicht</th>
<th class="text-right" style="width: 11mm;">Gewicht</th>
<th class="text-right"/>
<th class="text-left">Artikel</th>
<th class="text-right">EP</th>
@ -102,7 +98,7 @@
<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="6">
<td colspan="5">
<strong>
<t t-esc="layout_category['name']"/>
<t t-if="layout_category.get('order_id')">
@ -125,7 +121,20 @@
</t>
</strong>
</td>
<td class="text-right" t-if="discount_is_set"/>
<t t-if="discount_is_set">
<td class="text-right" colspan="2">
<strong>
<span style="color: #A72523;">Zwischensumme</span>
</strong>
</td>
</t>
<t t-if="not discount_is_set">
<td class="text-right">
<strong>
<span style="color: #A72523;">Zwischensumme</span>
</strong>
</td>
</t>
<td class="text-right" id="subtotal">
<strong>
<span t-esc="layout_category['price_subtotal']"
@ -140,12 +149,12 @@
<span t-esc="pos_nr"/>
</td>
<td class="text-right">
<t t-if="invoice_line.quantity">
<t t-if="invoice_line.quantity and not invoice_line.dealer_discount">
<span t-esc="o._formatLang(invoice_line.quantity, False).strip('0').strip(',').strip('.')"/>
</t>
</td>
<td class="text-right">
<t t-if="invoice_line.weight">
<t t-if="invoice_line.weight and not invoice_line.dealer_discount">
<span t-field="invoice_line.weight"/>
kg
</t>
@ -166,14 +175,16 @@
<span t-field="invoice_line.name"/>
</td>
<td class="text-right">
<span t-if="invoice_line.hide_discount"
<span t-if="invoice_line.hide_discount and not invoice_line.dealer_discount"
t-field="invoice_line.price_reduce"/>
<span t-if="not invoice_line.hide_discount"
<span t-if="not invoice_line.hide_discount and not invoice_line.dealer_discount"
t-field="invoice_line.price_unit"/>
</td>
<td class="text-right" t-if="discount_is_set">
<span t-if="not invoice_line.hide_discount and invoice_line.discount"
t-field="invoice_line.discount"/>
<t t-if="not invoice_line.hide_discount and invoice_line.discount">
<span t-esc="o._formatLang(invoice_line.discount, False).strip('0').strip(',').strip('.')"/>
%
</t>
</td>
<td class="text-right">
<span t-field="invoice_line.price_subtotal"/>