diff --git a/ext/custom-addons/tz_last_order/__init__.py b/ext/custom-addons/tz_last_order/__init__.py new file mode 100644 index 00000000..3350f727 --- /dev/null +++ b/ext/custom-addons/tz_last_order/__init__.py @@ -0,0 +1,8 @@ +################################################################################### +# +# Copyright 2018-Today TZAustria +# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). +# +################################################################################### + +from . import models \ No newline at end of file diff --git a/ext/custom-addons/tz_last_order/__manifest__.py b/ext/custom-addons/tz_last_order/__manifest__.py new file mode 100644 index 00000000..a2f0b891 --- /dev/null +++ b/ext/custom-addons/tz_last_order/__manifest__.py @@ -0,0 +1,35 @@ +################################################################################### +# +# Copyright 2018-Today TZAustria +# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). +# +# 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 . +# +################################################################################### + +{ + "name": "Last Order (Offer)", + "summary": """Adds Last order date""", + 'version': '11.0.1.0.0', + 'author': 'TZAustria', + 'support': 'andreas.osim@glaser-co.at', + 'website': 'https://www.tzaustria.at', + 'depends': ['base','crm'], + 'installable': True, + 'auto_install': False, + 'depends': ['base','account','dp_custom',], + "data": [ + "views/res_partner_view.xml", + ], +} \ No newline at end of file diff --git a/ext/custom-addons/tz_last_order/models/__init__.py b/ext/custom-addons/tz_last_order/models/__init__.py new file mode 100644 index 00000000..5e860e1b --- /dev/null +++ b/ext/custom-addons/tz_last_order/models/__init__.py @@ -0,0 +1,8 @@ +################################################################################### +# +# Copyright 2020-Today TZAustria +# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses). +# +################################################################################### + +from . import res_partner diff --git a/ext/custom-addons/tz_last_order/models/res_partner.py b/ext/custom-addons/tz_last_order/models/res_partner.py new file mode 100644 index 00000000..23714a37 --- /dev/null +++ b/ext/custom-addons/tz_last_order/models/res_partner.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models, api + +class ResPartner(models.Model): + _inherit = "res.partner" + + last_order = fields.Char(string="Letzter Auftrag", readonly=True, compute="get_last_order", store=True, copy=False) + last_order_date = fields.Date(string="Letztes Auftragsdatum", readonly=True, compute="get_last_order", store=True, copy=False) + + @api.multi + def get_last_order(self): + for partner in self: + order_ids = self.env['sale.order'].search([('partner_id', '=', partner.id), + ('state', 'not in', ['cancel'])]) + order = order_ids and max(order_ids) + if order: + partner.last_order = order.name + partner.last_order_date = order.date_order diff --git a/ext/custom-addons/tz_last_order/static/description/icon.png b/ext/custom-addons/tz_last_order/static/description/icon.png new file mode 100644 index 00000000..32c1481d Binary files /dev/null and b/ext/custom-addons/tz_last_order/static/description/icon.png differ diff --git a/ext/custom-addons/tz_last_order/views/res_partner_view.xml b/ext/custom-addons/tz_last_order/views/res_partner_view.xml new file mode 100644 index 00000000..002afa17 --- /dev/null +++ b/ext/custom-addons/tz_last_order/views/res_partner_view.xml @@ -0,0 +1,17 @@ + + + + res.partner.form.inherit + res.partner + + + + + + + \ No newline at end of file