~ecommerce-addons-core-editors/e-commerce-addons/github-6.1

« back to all changes in this revision

Viewing changes to base_sale_multichannels/wizard/export_product.py

  • Committer: sebastien beau
  • Date: 2012-08-21 13:57:44 UTC
  • mto: (269.1.1)
  • mto: This revision was merged to the branch mainline in revision 273.
  • Revision ID: git-v1:5a17b67295468f3c90564a729144ebc41da38618
[REF] refactor/clean code due to orm change in 6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
##############################################################################
21
21
 
22
22
 
23
 
from osv import fields,osv
24
 
from tools.translate import _
 
23
from openerp.osv.orm import TransientModel
 
24
from openerp.osv import fields
 
25
from openerp.osv.osv import except_osv
 
26
from openerp.tools.translate import _
25
27
from base_external_referentials.external_osv import ExternalSession
26
28
 
27
 
class product_export_wizard(osv.osv_memory):
 
29
class product_export_wizard(TransientModel):
28
30
    _name = 'product.export.wizard'
29
31
    _description = 'product export wizard'
30
32
 
52
54
 
53
55
        for shop in sale_shop_obj.browse(cr, uid, shop_ids, context=context):
54
56
            if not shop.referential_id:
55
 
                raise osv.except_osv(_("User Error"), _(("The shop '%s' doesn't have any external "
 
57
                raise except_osv(_("User Error"), _(("The shop '%s' doesn't have any external "
56
58
                                            "referential are you sure that it's an externe sale shop?"
57
59
                                            "If yes syncronize it before exporting product"))%(shop.name,))
58
60
            external_session = ExternalSession(shop.referential_id, shop)
60
62
            none_exportable_product = set(product_ids) - set([product.id for product in shop.exportable_product_ids])
61
63
            if none_exportable_product:
62
64
                products = ', '.join([x['name'] for x in product_obj.read(cr, uid, list(none_exportable_product), fields = ['name'], context=context)])
63
 
                raise osv.except_osv(_("User Error"),
 
65
                raise except_osv(_("User Error"),
64
66
                        _(("The product '%s' can not be exported to the shop '%s'. \n"
65
67
                        "Please check : \n"
66
68
                        "    - if they are in the root category \n"
86
88
 
87
89
    def export_all(self, cr, uid, id, context=None):
88
90
        return self.export(cr, uid, id, self._get_all_options(cr, uid, context=context), context)
89
 
 
90
 
 
91
 
 
92
 
product_export_wizard()