From be3aef1a1114fd46587693640a21a9ea1e6f2239 Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Fri, 24 Nov 2017 16:04:34 +0100 Subject: [PATCH] Fall 4430: Preislisten / Preisberechnung --- .../dp_sale_hide_discount/__init__.py | 22 +++++++++ .../dp_sale_hide_discount/__manifest__.py | 39 ++++++++++++++++ .../dp_sale_hide_discount/models/__init__.py | 22 +++++++++ .../dp_sale_hide_discount/models/sale.py | 43 ++++++++++++++++++ .../static/description/icon.png | Bin 0 -> 2225 bytes .../views/sale_views.xml | 15 ++++++ 6 files changed, 141 insertions(+) create mode 100644 ext/custom-addons/dp_sale_hide_discount/__init__.py create mode 100644 ext/custom-addons/dp_sale_hide_discount/__manifest__.py create mode 100644 ext/custom-addons/dp_sale_hide_discount/models/__init__.py create mode 100644 ext/custom-addons/dp_sale_hide_discount/models/sale.py create mode 100644 ext/custom-addons/dp_sale_hide_discount/static/description/icon.png create mode 100644 ext/custom-addons/dp_sale_hide_discount/views/sale_views.xml diff --git a/ext/custom-addons/dp_sale_hide_discount/__init__.py b/ext/custom-addons/dp_sale_hide_discount/__init__.py new file mode 100644 index 00000000..15bca215 --- /dev/null +++ b/ext/custom-addons/dp_sale_hide_discount/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# datenpol gmbh +# Copyright (C) 2013-TODAY datenpol gmbh () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import models diff --git a/ext/custom-addons/dp_sale_hide_discount/__manifest__.py b/ext/custom-addons/dp_sale_hide_discount/__manifest__.py new file mode 100644 index 00000000..8e521e03 --- /dev/null +++ b/ext/custom-addons/dp_sale_hide_discount/__manifest__.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# datenpol gmbh +# Copyright (C) 2013-TODAY datenpol gmbh () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +# noinspection PyStatementEffect +{ + 'name': 'Hide discount in sale order', + 'category': 'Sale', + 'version': '11.0.1.0.0', + 'description': """Individuelle Anpassungen""", + 'author': 'Datenpol gmbh', + 'website': 'http://www.datenpol.at/', + 'depends': [ + 'sale' + ], + 'data': [ + 'views/sale_views.xml' + ], + 'installable': True, + 'auto_install': False, +} diff --git a/ext/custom-addons/dp_sale_hide_discount/models/__init__.py b/ext/custom-addons/dp_sale_hide_discount/models/__init__.py new file mode 100644 index 00000000..5ed628c3 --- /dev/null +++ b/ext/custom-addons/dp_sale_hide_discount/models/__init__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 20014-2016 datenpol gmbh (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from . import sale diff --git a/ext/custom-addons/dp_sale_hide_discount/models/sale.py b/ext/custom-addons/dp_sale_hide_discount/models/sale.py new file mode 100644 index 00000000..858b92f5 --- /dev/null +++ b/ext/custom-addons/dp_sale_hide_discount/models/sale.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# datenpol gmbh +# Copyright (C) 2013-TODAY datenpol gmbh () +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +from odoo import api, fields, models, _ + + +class SaleOrderLine(models.Model): + _inherit = 'sale.order.line' + + unit_price_incl_discount = fields.Float(string='Preis/ME inkl. Rabatt', compute='_compute_unit_price_incl_discount') + hide_discount = fields.Boolean(string='Rabatt verstecken') + + @api.multi + def _compute_unit_price_incl_discount(self): + for line in self: + unit_price_incl_discount = line.price_unit * (1 - (line.discount or 0.0) / 100.0) + line.unit_price_incl_discount = round(unit_price_incl_discount, 2) + + @api.depends('product_uom_qty', 'discount', 'price_unit', 'tax_id', 'hide_discount') + def _compute_amount(self): + super(SaleOrderLine, self)._compute_amount() + for line in self: + if line.hide_discount: + line.update({ + 'price_unit': line.unit_price_incl_discount + }) diff --git a/ext/custom-addons/dp_sale_hide_discount/static/description/icon.png b/ext/custom-addons/dp_sale_hide_discount/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..8387d76554e8c52cf9256f9dc3f0358744f26f8e GIT binary patch literal 2225 zcmV;i2u}BjP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{005UN6GXZYpd*5GTM;9mttz230kztuXpqw7k0!Bk-aY#xp76VI(r5cRu^;~ayve)o z`g`Zx^W&a#fjsiaBab}t$Rm%O1kLpVeEvYW6vi3`uOQG;0ObG{0Vo1c82h&o0Amac z3c?@*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H6kBA0LH<;%Te|RgT3qgu|NJ!3x&T~~aD7on zm6@Sqv4i~=ddeyubQ5T`@^$W&jBhPlS@qw0OV+(HThi$D2P+Hj8hw>O8xnm~hU?3^ zO7v!}<)48*B5Y5$%jm;mTT}85HNuFG1qz~tn{<{Z&-$ek47^5!U86Tjdv#U$`}~1& zQ-~mef|#axF()pah?fK#*PaY9@k<0cl?s_Yf1q5F@hB4-)pY!n_vF&GCl-~iYYM>L z#XAuO&I!UGOY}3uJMmQkEX4vMS<1vqh-oE&O4zt_iwFlzc5TmONpi-oewsY6i9R)x zdSw8)fAv#BA}5=yHzBz|9(m-EM;>|Pk)!w@TDLdXvm#rS00000NkvXXu0mjf$QcM^ literal 0 HcmV?d00001 diff --git a/ext/custom-addons/dp_sale_hide_discount/views/sale_views.xml b/ext/custom-addons/dp_sale_hide_discount/views/sale_views.xml new file mode 100644 index 00000000..f62dec0d --- /dev/null +++ b/ext/custom-addons/dp_sale_hide_discount/views/sale_views.xml @@ -0,0 +1,15 @@ + + + + + sale_order_form_view + sale.order + + + + + + + + +