コード例 #1
0
    def post_init(self):
        # self.wizard.model will return something if it is coming back from
        self.slave = ProductEditor(self.store,
                                   wizard=self.wizard,
                                   product_type=self.wizard.product_type)
        self.slave.get_toplevel().reparent(self.place_holder)
        self.wizard.model = self.slave.model

        self.slave.register_validate_function(self.wizard.refresh_next)
        self.slave.force_validation()
コード例 #2
0
    def post_init(self):
        self.slave = ProductEditor(self.wizard.store,
                                   product_type=self.wizard.product_type)
        self.slave.get_toplevel().reparent(self.place_holder)
        self.wizard.model = self.slave.model

        self.slave.register_validate_function(self.wizard.refresh_next)
        self.slave.force_validation()
コード例 #3
0
    def test_show(self):
        product = self.create_product(storable=True)
        image = self.create_image()
        image.image = _image
        image.sellable = product.sellable

        editor = ProductEditor(self.store, product)
        editor.code.update("12345")
        self.check_editor(editor, 'editor-product-show')
コード例 #4
0
ファイル: productwizard.py プロジェクト: Guillon88/stoq
    def post_init(self):
        # self.wizard.model will return something if it is coming back from
        self.slave = ProductEditor(self.store, wizard=self.wizard,
                                   product_type=self.wizard.product_type)
        self.slave.get_toplevel().reparent(self.place_holder)
        self.wizard.model = self.slave.model

        self.slave.register_validate_function(self.wizard.refresh_next)
        self.slave.force_validation()
コード例 #5
0
    def test_cost_precision_digits(self):
        # Set a number of digts greated than 2
        sysparam.set_int(self.store, 'COST_PRECISION_DIGITS', 5)

        product = self.create_product(storable=True)
        product.sellable.cost = Decimal('1.23456')
        editor = ProductEditor(self.store, product)
        editor.code.update("12345")
        # We expect the editor to show the correct value
        self.check_editor(editor, 'editor-product-cost-precision-digits')
コード例 #6
0
    def test_create_without_category(self):
        # Removing data from SellableCategory, so we can test the validation of
        # category_combo update when there is no category.
        self.store.execute(Update({Sellable.category_id: None},
                                  table=Sellable))
        self.clean_domain([CommissionSource, SellableCategory])

        editor = ProductEditor(self.store)
        editor.code.update("12345")
        self.assertNotSensitive(editor, ['category_combo'])
        self.check_editor(editor, 'editor-product-create-no-category')
コード例 #7
0
    def testCostPrecisionDigits(self):
        # Set a number of digts greated than 2
        sysparam(self.store).update_parameter(
            u'COST_PRECISION_DIGITS', u'5')

        product = self.create_product()
        product.sellable.cost = Decimal('1.23456')
        editor = ProductEditor(self.store, product)
        editor.code.update("12345")
        # We expect the editor to show the correct value
        self.check_editor(editor, 'editor-product-cost-precision-digits')
コード例 #8
0
class ProductEditorStep(BaseWizardStep):
    gladefile = 'HolderTemplate'

    #
    #  BaseWizardStep
    #

    def post_init(self):
        # self.wizard.model will return something if it is coming back from
        self.slave = ProductEditor(self.store,
                                   wizard=self.wizard,
                                   product_type=self.wizard.product_type)
        self.slave.get_toplevel().reparent(self.place_holder)
        self.wizard.model = self.slave.model

        self.slave.register_validate_function(self.wizard.refresh_next)
        self.slave.force_validation()

    def previous_step(self):
        # Avoid creating duplicated products when going back
        self.store.rollback(close=False)

        return super(ProductEditorStep, self).previous_step()

    def has_next_step(self):
        return False
コード例 #9
0
ファイル: productwizard.py プロジェクト: Guillon88/stoq
class ProductEditorStep(BaseWizardStep):
    gladefile = 'HolderTemplate'

    #
    #  BaseWizardStep
    #

    def post_init(self):
        # self.wizard.model will return something if it is coming back from
        self.slave = ProductEditor(self.store, wizard=self.wizard,
                                   product_type=self.wizard.product_type)
        self.slave.get_toplevel().reparent(self.place_holder)
        self.wizard.model = self.slave.model

        self.slave.register_validate_function(self.wizard.refresh_next)
        self.slave.force_validation()

    def previous_step(self):
        # Avoid creating duplicated products when going back
        self.store.rollback(close=False)

        return super(ProductEditorStep, self).previous_step()

    def has_next_step(self):
        return False
コード例 #10
0
 def test_create_with_template(self):
     attribute_group = self.create_attribute_group()
     grid_attribute = self.create_grid_attribute(
         attribute_group=attribute_group, description=u'attr 1')
     grid_attribute2 = self.create_grid_attribute(
         attribute_group=attribute_group, description=u'attr 2')
     grid_product = self.create_product(storable=True, is_grid=True)
     self.create_product_attribute(product=grid_product,
                                   attribute=grid_attribute)
     self.create_product_attribute(product=grid_product,
                                   attribute=grid_attribute2)
     editor = ProductEditor(self.store,
                            product_type=Product.TYPE_GRID,
                            template=grid_product)
     # Be sure that its not the same product
     self.assertNotEqual(grid_product, editor.model)
     # But they have the same list of |grid_attribute|
     grid_product_attributes = set(attr.attribute
                                   for attr in grid_product.attributes)
     model_attributes = set(attr.attribute
                            for attr in editor.model.attributes)
     self.assertEquals(grid_product_attributes, model_attributes)
     # and they are not empty
     self.assertNotEquals(len(model_attributes), 0)
コード例 #11
0
 def test_create_grid_product(self):
     grid_product = self.create_product(is_grid=True)
     editor = ProductEditor(self.store, grid_product)
     self.assertEquals(grid_product.product_type, Product.TYPE_GRID)
     self.check_editor(editor, 'editor-product-create-grid-product')
コード例 #12
0
 def test_create(self):
     editor = ProductEditor(self.store)
     editor.code.update("12345")
     self.check_editor(editor, 'editor-product-create')
コード例 #13
0
 def test_visual_mode(self):
     product = self.create_product(storable=True)
     editor = ProductEditor(self.store, product, visual_mode=True)
     editor.code.update("12412")
     self.assertNotSensitive(editor, ['add_category', 'sale_price_button'])
     self.check_editor(editor, 'editor-product-visual-mode')
コード例 #14
0
 def testShow(self):
     product = self.create_product()
     editor = ProductEditor(self.store, product)
     editor.code.update("12345")
     self.check_editor(editor, 'editor-product-show')
コード例 #15
0
 def test_product_editor(self):
     product = self.create_product(stock=10)
     editor = ProductEditor(store=self.store, model=product)
     self.check_editor(editor, u'editor-product-optical-plugin')