1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# product_images_sync module for OpenERP
5
# Copyright (C) 2012 Akretion (http://www.akretion.com). All Rights Reserved
6
# @author Alexis de Lattre <alexis.delattre@akretion.com>
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU Affero General Public License as
10
# published by the Free Software Foundation, either version 3 of the
11
# License, or (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU Affero General Public License for more details.
18
# You should have received a copy of the GNU Affero General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>.
21
##############################################################################
23
from osv import osv, fields
24
from base_external_referentials.decorator import only_for_referential, commit_now
26
# TODO : move field last_images_export_date in this module ? (-> will need to update dependancy ?)
28
class sale_shop(osv.osv):
29
_inherit = 'sale.shop'
31
def export_images(self, cr, uid, ids, context=None):
32
return self.export_resources(cr, uid, ids, 'product.images', context=context)
36
class product_images(osv.osv):
37
_inherit = 'product.images'
39
@only_for_referential('prestashop')
40
def _get_last_exported_date(self, cr, uid, external_session, context=None):
41
return self.pool.get('sale.shop').browse(cr, uid, external_session.sync_from_object.id, context=context).last_images_export_date
43
@only_for_referential('prestashop')
45
def _set_last_exported_date(self, cr, uid, external_session, date, context=None):
46
return self.pool.get('sale.shop').write(cr, uid,
47
external_session.sync_from_object.id,
48
{'last_images_export_date': date}, context=context)