From c9a737cf5def655a0e6f14de9c8dd1fd3477ac90 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Tue, 8 May 2018 14:57:11 +0200 Subject: [PATCH] Feedback 1674: --- ext/custom-addons/dp_custom/models/account.py | 1 + ext/custom-addons/dp_custom/models/sale.py | 3 +- .../dp_custom/views/account_views.xml | 1 + .../dp_reports/reports/report_templates.xml | 7 +++ .../dp_reports_account/__manifest__.py | 1 + .../models/report_helper.py | 30 ++++++++++++- .../dp_reports_account/reports/invoice.xml | 45 ++++++++++++------- 7 files changed, 68 insertions(+), 20 deletions(-) diff --git a/ext/custom-addons/dp_custom/models/account.py b/ext/custom-addons/dp_custom/models/account.py index 98231b1d..6d63bffa 100644 --- a/ext/custom-addons/dp_custom/models/account.py +++ b/ext/custom-addons/dp_custom/models/account.py @@ -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): diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 98bfbfb4..e8d00995 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -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) diff --git a/ext/custom-addons/dp_custom/views/account_views.xml b/ext/custom-addons/dp_custom/views/account_views.xml index 7140f1de..d1138cec 100644 --- a/ext/custom-addons/dp_custom/views/account_views.xml +++ b/ext/custom-addons/dp_custom/views/account_views.xml @@ -20,6 +20,7 @@ + diff --git a/ext/custom-addons/dp_reports/reports/report_templates.xml b/ext/custom-addons/dp_reports/reports/report_templates.xml index 56e67c0a..706af52d 100644 --- a/ext/custom-addons/dp_reports/reports/report_templates.xml +++ b/ext/custom-addons/dp_reports/reports/report_templates.xml @@ -118,6 +118,13 @@ +
+
+ + Die AGBs sind auf der Homepage verfügbar. + +
+
    diff --git a/ext/custom-addons/dp_reports_account/__manifest__.py b/ext/custom-addons/dp_reports_account/__manifest__.py index 0466a343..e69dec95 100644 --- a/ext/custom-addons/dp_reports_account/__manifest__.py +++ b/ext/custom-addons/dp_reports_account/__manifest__.py @@ -13,6 +13,7 @@ 'account_invoicing', 'report_intrastat', 'dp_reports', + 'dp_custom', 'dp_sale_hide_discount', ], 'data': [ diff --git a/ext/custom-addons/dp_reports_account/models/report_helper.py b/ext/custom-addons/dp_reports_account/models/report_helper.py index a64d5e32..9560838a 100644 --- a/ext/custom-addons/dp_reports_account/models/report_helper.py +++ b/ext/custom-addons/dp_reports_account/models/report_helper.py @@ -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 diff --git a/ext/custom-addons/dp_reports_account/reports/invoice.xml b/ext/custom-addons/dp_reports_account/reports/invoice.xml index 66283856..e3c35760 100644 --- a/ext/custom-addons/dp_reports_account/reports/invoice.xml +++ b/ext/custom-addons/dp_reports_account/reports/invoice.xml @@ -55,20 +55,16 @@
-
+
- Rechnungsdatum: + Rechnungsdatum: - +
Email: - - - Artikel: - - +
@@ -89,7 +85,7 @@ Pos. Anzahl - Gewicht + Gewicht Artikel EP @@ -102,7 +98,7 @@ - + @@ -125,7 +121,20 @@ - + + + + Zwischensumme + + + + + + + Zwischensumme + + + - + - + kg @@ -166,14 +175,16 @@ - - - + + + % +