diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 58e5ffc6..113532b7 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -553,9 +553,9 @@ class SaleOrder(models.Model): if vals.get('order_line',False): self._reset_sequence() - if self.partner_id: - self.partner_id.last_order_changed = datetime.now() - + # if self.partner_id: + # self.partner_id.last_order_changed = datetime.now() + # return res @api.multi diff --git a/ext/custom-addons/tz_last_order/models/__init__.py b/ext/custom-addons/tz_last_order/models/__init__.py index 5e860e1b..df084f95 100644 --- a/ext/custom-addons/tz_last_order/models/__init__.py +++ b/ext/custom-addons/tz_last_order/models/__init__.py @@ -6,3 +6,4 @@ ################################################################################### from . import res_partner +from . import sale diff --git a/ext/custom-addons/tz_last_order/models/sale.py b/ext/custom-addons/tz_last_order/models/sale.py new file mode 100644 index 00000000..1c5a6315 --- /dev/null +++ b/ext/custom-addons/tz_last_order/models/sale.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from odoo import fields, models, api, _ +from datetime import datetime + +class SaleOrder(models.Model): + _inherit = "sale.order" + + @api.multi + def write(self, vals): + + res = super(SaleOrder, self).write(vals) + + if self.partner_id: + self.partner_id.last_order_changed = datetime.now() + + return res