Ejemplo n.º 1
0
 def _make_resource(cls, folder, name, ctime=None, *args, **kw):
     from shop.cross_selling import CrossSellingTable
     if ctime is None:
         ctime = datetime.now()
     DynamicFolder._make_resource(cls,
                                  folder,
                                  name,
                                  ctime=ctime,
                                  *args,
                                  **kw)
     # Images folder
     ImagesFolder._make_resource(ImagesFolder,
                                 folder,
                                 '%s/images' % name,
                                 body='',
                                 title={'en': u'Images'})
     # Order images table
     PhotoOrderedTable._make_resource(PhotoOrderedTable,
                                      folder,
                                      '%s/order-photos' % name,
                                      title={'en': u'Order photos'})
     # Cross Selling table
     CrossSellingTable._make_resource(CrossSellingTable,
                                      folder,
                                      '%s/cross-selling' % name,
                                      title={'en': u'Cross selling'})
Ejemplo n.º 2
0
 def _make_resource(cls, folder, name, ctime=None, *args, **kw):
     from shop.cross_selling import CrossSellingTable
     if ctime is None:
         ctime = datetime.now()
     DynamicFolder._make_resource(cls, folder, name, ctime=ctime, *args,
                                  **kw)
     # Images folder
     ImagesFolder._make_resource(ImagesFolder, folder,
                                 '%s/images' % name, body='',
                                 title={'en': u'Images'})
     # Order images table
     PhotoOrderedTable._make_resource(PhotoOrderedTable, folder,
                                      '%s/order-photos' % name,
                                      title={'en': u'Order photos'})
     # Cross Selling table
     CrossSellingTable._make_resource(CrossSellingTable, folder,
                                      '%s/cross-selling' % name,
                                      title={'en': u'Cross selling'})
Ejemplo n.º 3
0
 def _get_catalog_values(self):
     return merge_dicts(
         DynamicFolder._get_catalog_values(self),
         self._get_dynamic_catalog_values(),
         reference=self.get_property('reference'),
         declination_title=self.get_declination_title(),
         manufacturer=str(self.parent.get_property('manufacturer')),
         supplier=str(self.parent.get_property('supplier')),
         ht_price=self.parent.get_price_without_tax(id_declination=self.name, pretty=False),
         ttc_price=self.parent.get_price_with_tax(id_declination=self.name, pretty=False),
         # XXX Declination must be workflowaware
         is_default=self.get_property('is_default'),
         workflow_state=self.parent.get_workflow_state(),
         stock_quantity=self.get_property('stock-quantity'))
Ejemplo n.º 4
0
 def _get_catalog_values(self):
     return merge_dicts(
         DynamicFolder._get_catalog_values(self),
         self._get_dynamic_catalog_values(),
         reference=self.get_property('reference'),
         declination_title=self.get_declination_title(),
         manufacturer=str(self.parent.get_property('manufacturer')),
         supplier=str(self.parent.get_property('supplier')),
         ht_price=self.parent.get_price_without_tax(
             id_declination=self.name, pretty=False),
         ttc_price=self.parent.get_price_with_tax(id_declination=self.name,
                                                  pretty=False),
         # XXX Declination must be workflowaware
         is_default=self.get_property('is_default'),
         workflow_state=self.parent.get_workflow_state(),
         stock_quantity=self.get_property('stock-quantity'))
Ejemplo n.º 5
0
 def _get_catalog_values(self):
     values = merge_dicts(DynamicFolder._get_catalog_values(self),
                          TagsAware._get_catalog_values(self),
                          self._get_dynamic_catalog_values())
     # Data
     data = self.get_property('data')
     if data is not None:
         data = xml_to_text(data)
     values['data'] = data
     # Reference
     values['reference'] = self.get_property('reference')
     # Manufacturer
     values['manufacturer'] = str(self.get_property('manufacturer'))
     # Supplier
     values['supplier'] = str(self.get_property('supplier'))
     # Stock quantity
     values['stock_quantity'] = self.get_property('stock-quantity')
     # Product models
     values['product_model'] = str(self.get_property('product_model'))
     # Images
     order = self.get_resource('order-photos', soft=True)
     if order:
         ordered_names = list(order.get_ordered_names())
         values['has_images'] = (len(ordered_names) != 0)
     else:
         values['has_images'] = False
     # Price # XXX We can't sort decimal, so transform to int
     values['stored_price'] = int(self.get_price_with_tax() * 100)
     values['stored_weight'] = int(self.get_weight() * 100)
     # Price
     values['ht_price'] = self.get_price_without_tax()
     values['ttc_price'] = self.get_price_with_tax()
     # Creation time
     values['ctime'] = self.get_property('ctime')
     # Publication date
     values['pub_datetime'] = self.get_property('pub_datetime')
     # Promotion
     values['has_reduction'] = self.get_property('has_reduction')
     # not_buyable_by_groups
     values['not_buyable_by_groups'] = self.get_property(
         'not_buyable_by_groups')
     return values
Ejemplo n.º 6
0
 def _get_catalog_values(self):
     values = merge_dicts(DynamicFolder._get_catalog_values(self),
                          TagsAware._get_catalog_values(self),
                          self._get_dynamic_catalog_values())
     # Data
     data = self.get_property('data')
     if data is not None:
         data = xml_to_text(data)
     values['data'] = data
     # Reference
     values['reference'] = self.get_property('reference')
     # Manufacturer
     values['manufacturer'] = str(self.get_property('manufacturer'))
     # Supplier
     values['supplier'] = str(self.get_property('supplier'))
     # Stock quantity
     values['stock_quantity'] = self.get_property('stock-quantity')
     # Product models
     values['product_model'] = str(self.get_property('product_model'))
     # Images
     order = self.get_resource('order-photos', soft=True)
     if order:
         ordered_names = list(order.get_ordered_names())
         values['has_images'] = (len(ordered_names) != 0)
     else:
         values['has_images'] = False
     # Price # XXX We can't sort decimal, so transform to int
     values['stored_price'] = int(self.get_price_with_tax() * 100)
     values['stored_weight'] = int(self.get_weight() * 100)
     # Price
     values['ht_price'] = self.get_price_without_tax()
     values['ttc_price'] = self.get_price_with_tax()
     # Creation time
     values['ctime'] = self.get_property('ctime')
     # Publication date
     values['pub_datetime'] = self.get_property('pub_datetime')
     # Promotion
     values['has_reduction'] = self.get_property('has_reduction')
     # not_buyable_by_groups
     values['not_buyable_by_groups'] = self.get_property('not_buyable_by_groups')
     return values
Ejemplo n.º 7
0
 def get_metadata_schema(cls):
     return merge_dicts(DynamicFolder.get_metadata_schema(),
                        declination_schema)
Ejemplo n.º 8
0
 def get_metadata_schema(cls):
     return merge_dicts(DynamicFolder.get_metadata_schema(),
                        declination_schema)
Ejemplo n.º 9
0
 def update_relative_links(self, source):
     return DynamicFolder.update_relative_links(self, source)
Ejemplo n.º 10
0
 def update_links(self, source, target):
     return DynamicFolder.update_links(self, source, target)
Ejemplo n.º 11
0
 def get_links(self):
     return DynamicFolder.get_links(self)
Ejemplo n.º 12
0
 def get_metadata_schema(cls):
     return merge_dicts(DynamicFolder.get_metadata_schema(),
                        WorkflowAware.get_metadata_schema(),
                        product_schema,
                        data=XHTMLBody(multilingual=True))
Ejemplo n.º 13
0
 def update_relative_links(self, source):
     return DynamicFolder.update_relative_links(self, source)
Ejemplo n.º 14
0
 def update_links(self, source, target):
     return DynamicFolder.update_links(self, source, target)
Ejemplo n.º 15
0
 def get_links(self):
     return DynamicFolder.get_links(self)
Ejemplo n.º 16
0
 def get_metadata_schema(cls):
     return merge_dicts(DynamicFolder.get_metadata_schema(),
                        WorkflowAware.get_metadata_schema(),
                        product_schema,
                        data=XHTMLBody(multilingual=True))