Browse Source

Addition of field write_date and method _get_write_date

partner_gogocarto
Stéphan Sainléger 4 years ago
committed by default
parent
commit
e5f4766c63
  1. 6
      partner_gogocarto_export_api/models/res_partner.py

6
partner_gogocarto_export_api/models/res_partner.py

@ -1,5 +1,6 @@
from odoo import models, fields, api
from ast import literal_eval
# import datetime
import logging
_logger = logging.getLogger(__name__)
@ -16,6 +17,9 @@ class ResPartner(models.Model):
,('partner_latitude', '!=', float())
]
def _get_last_update(self):
return self.write_date.strftime("%d-%m-%Y, %H:%M:%S")
def _get_industry_label(self):
if self.industry_id:
return self.industry_id.name
@ -41,6 +45,8 @@ class ResPartner(models.Model):
self._add_simple_node(element, "name")
self._add_simple_node(element, "partner_longitude")
self._add_simple_node(element, "partner_latitude")
# to detect the changes in the export compared to the previous one, so that Gogocarto does not import all the data at each synchronization.
self._add_computed_node(element, "last_update", self._get_last_update)
return self.add_fields(element, self._get_export_fields())

Loading…
Cancel
Save