def setUp(self):
     super(test_export_invoice, self).setUp()
     cr, uid = self.cr, self.uid
     backend_model = self.registry('magento.backend')
     self.mag_sale_model = self.registry('magento.sale.order')
     self.session = ConnectorSession(cr, uid)
     data_model = self.registry('ir.model.data')
     self.get_ref = partial(data_model.get_object_reference,
                            cr, uid)
     __, warehouse_id = self.get_ref('stock', 'warehouse0')
     backend_id = backend_model.create(
         cr,
         uid,
         {'name': 'Test Magento',
             'version': '1.7',
             'location': 'http://anyurl',
             'username': '******',
             'warehouse_id': warehouse_id,
             'password': '******'})
     self.backend = backend_model.browse(cr, uid, backend_id)
     # payment method needed to import a sale order
     __, workflow_id = self.get_ref('sale_automatic_workflow',
                                    'manual_validation')
     __, journal_id = self.get_ref('account',
                                   'check_journal')
     self.payment_method_id = self.registry('payment.method').create(
         cr, uid,
         {'name': 'checkmo',
          'create_invoice_on': False,
          'workflow_process_id': workflow_id,
          'import_rule': 'always',
          'journal_id': journal_id})
     __, self.journal_id = self.get_ref('account', 'bank_journal')
     __, self.pay_account_id = self.get_ref('account', 'cash')
     __, self.period_id = self.get_ref('account', 'period_10')
     # import the base informations
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', backend_id)
         import_batch(self.session, 'magento.store', backend_id)
         import_batch(self.session, 'magento.storeview', backend_id)
         with mock_urlopen_image():
             import_record(self.session,
                           'magento.sale.order',
                           backend_id, 900000691)
     sale_ids = self.mag_sale_model.search(
         cr, uid,
         [('backend_id', '=', backend_id),
          ('magento_id', '=', '900000691')])
     self.assertEqual(len(sale_ids), 1)
     self.mag_sale = self.mag_sale_model.browse(cr, uid, sale_ids[0])
     # ignore exceptions on the sale order
     self.mag_sale.write({'ignore_exceptions': True})
     self.mag_sale.openerp_id.action_button_confirm()
     self.mag_sale.refresh()  # update to manual state
     self.sale_id = self.mag_sale.openerp_id.id
     sale_obj = self.registry('sale.order')
     invoice_id = sale_obj.action_invoice_create(cr, uid, [self.sale_id])
     assert invoice_id
     self.invoice_model = self.registry('account.invoice')
     self.invoice = self.invoice_model.browse(cr, uid, invoice_id)
 def test_00_setup(self):
     """ Import the informations required for the customers """
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', self.backend_id)
         import_batch(self.session, 'magento.store', self.backend_id)
         import_batch(self.session, 'magento.storeview', self.backend_id)
         import_record(self.session, 'magento.res.partner.category',
                       self.backend_id, 1)
Ejemplo n.º 3
0
 def setUp(self):
     super(test_export_invoice, self).setUp()
     cr, uid = self.cr, self.uid
     backend_model = self.registry('magento.backend')
     self.mag_sale_model = self.registry('magento.sale.order')
     self.session = ConnectorSession(cr, uid)
     self.session.context['__test_no_commit'] = True
     data_model = self.registry('ir.model.data')
     self.get_ref = partial(data_model.get_object_reference, cr, uid)
     __, warehouse_id = self.get_ref('stock', 'warehouse0')
     backend_id = backend_model.create(
         cr, uid, {
             'name': 'Test Magento',
             'version': '1.7',
             'location': 'http://anyurl',
             'username': '******',
             'warehouse_id': warehouse_id,
             'password': '******'
         })
     self.backend = backend_model.browse(cr, uid, backend_id)
     # payment method needed to import a sale order
     __, workflow_id = self.get_ref('sale_automatic_workflow',
                                    'manual_validation')
     __, journal_id = self.get_ref('account', 'check_journal')
     self.payment_method_id = self.registry('payment.method').create(
         cr, uid, {
             'name': 'checkmo',
             'create_invoice_on': False,
             'workflow_process_id': workflow_id,
             'import_rule': 'always',
             'journal_id': journal_id
         })
     __, self.journal_id = self.get_ref('account', 'bank_journal')
     __, self.pay_account_id = self.get_ref('account', 'cash')
     __, self.period_id = self.get_ref('account', 'period_10')
     # import the base informations
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', backend_id)
         import_batch(self.session, 'magento.store', backend_id)
         import_batch(self.session, 'magento.storeview', backend_id)
         with mock_urlopen_image():
             import_record(self.session, 'magento.sale.order', backend_id,
                           900000691)
     sale_ids = self.mag_sale_model.search(
         cr, uid, [('backend_id', '=', backend_id),
                   ('magento_id', '=', '900000691')])
     self.assertEqual(len(sale_ids), 1)
     self.mag_sale = self.mag_sale_model.browse(cr, uid, sale_ids[0])
     # ignore exceptions on the sale order
     self.mag_sale.write({'ignore_exceptions': True})
     self.mag_sale.openerp_id.action_button_confirm()
     self.mag_sale.refresh()  # update to manual state
     self.sale_id = self.mag_sale.openerp_id.id
     sale_obj = self.registry('sale.order')
     invoice_id = sale_obj.action_invoice_create(cr, uid, [self.sale_id])
     assert invoice_id
     self.invoice_model = self.registry('account.invoice')
     self.invoice = self.invoice_model.browse(cr, uid, invoice_id)
 def setUp(self):
     super(TestExportInvoice, self).setUp()
     backend_model = self.env['magento.backend']
     self.mag_sale_model = self.env['magento.sale.order']
     self.session = ConnectorSession(self.env.cr, self.env.uid,
                                     context=self.env.context)
     warehouse = self.env.ref('stock.warehouse0')
     self.backend = backend = backend_model.create(
         {'name': 'Test Magento',
          'version': '1.7',
          'location': 'http://anyurl',
          'username': '******',
          'warehouse_id': warehouse.id,
          'password': '******'})
     # payment method needed to import a sale order
     workflow = self.env.ref('sale_automatic_workflow.manual_validation')
     journal = self.env.ref('account.check_journal')
     self.payment_method = self.env['payment.method'].create(
         {'name': 'checkmo',
          'create_invoice_on': False,
          'workflow_process_id': workflow.id,
          'import_rule': 'always',
          'journal_id': journal.id})
     self.journal = self.env.ref('account.bank_journal')
     self.pay_account = self.env.ref('account.cash')
     self.period = self.env.ref('account.period_10')
     # import the base informations
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', backend.id)
         import_batch(self.session, 'magento.store', backend.id)
         import_batch(self.session, 'magento.storeview', backend.id)
         with mock_urlopen_image():
             import_record(self.session,
                           'magento.sale.order',
                           backend.id, 900000691)
     self.stores = self.backend.mapped('website_ids.store_ids')
     sales = self.mag_sale_model.search(
         [('backend_id', '=', backend.id),
          ('magento_id', '=', '900000691')])
     self.assertEqual(len(sales), 1)
     self.mag_sale = sales
     # ignore exceptions on the sale order
     self.mag_sale.ignore_exceptions = True
     self.mag_sale.openerp_id.action_button_confirm()
     sale = self.mag_sale.openerp_id
     invoice_id = sale.action_invoice_create()
     assert invoice_id
     self.invoice_model = self.env['account.invoice']
     self.invoice = self.invoice_model.browse(invoice_id)
Ejemplo n.º 5
0
    def test_import_backend(self):
        """ Synchronize initial metadata """
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)

        website_model = self.env['magento.website']
        websites = website_model.search([('backend_id', '=', self.backend_id)])
        self.assertEqual(len(websites), 2)

        store_model = self.env['magento.store']
        stores = store_model.search([('backend_id', '=', self.backend_id)])
        self.assertEqual(len(stores), 2)

        storeview_model = self.env['magento.storeview']
        storeviews = storeview_model.search([('backend_id', '=',
                                              self.backend_id)])
        self.assertEqual(len(storeviews), 4)
    def test_import_backend(self):
        """ Synchronize initial metadata """
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)

        website_model = self.env['magento.website']
        websites = website_model.search([('backend_id', '=', self.backend_id)])
        self.assertEqual(len(websites), 2)

        store_model = self.env['magento.store']
        stores = store_model.search([('backend_id', '=', self.backend_id)])
        self.assertEqual(len(stores), 2)

        storeview_model = self.env['magento.storeview']
        storeviews = storeview_model.search(
            [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(storeviews), 4)
Ejemplo n.º 7
0
 def setUp(self):
     super(TestImportAddressBook, self).setUp()
     self.backend_model = self.env['magento.backend']
     self.session = ConnectorSession(self.env.cr, self.env.uid,
                                     context=self.env.context)
     self.model = self.env['magento.res.partner']
     self.address_model = self.env['magento.address']
     warehouse_id = self.env.ref('stock.warehouse0').id
     self.backend_id = self.backend_model.create({
         'name': 'Test Magento Address book',
         'version': '1.7',
         'location': 'http://anyurl',
         'username': '******',
         'warehouse_id': warehouse_id,
         'password': '******'}).id
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', self.backend_id)
         import_batch(self.session, 'magento.store', self.backend_id)
         import_batch(self.session, 'magento.storeview', self.backend_id)
         import_record(self.session, 'magento.res.partner.category',
                       self.backend_id, 1)
Ejemplo n.º 8
0
    def test_00_import_backend(self):
        """ Synchronize initial metadata """
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)

        website_model = self.registry('magento.website')
        website_ids = website_model.search(
            self.cr, self.uid, [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(website_ids), 2)

        store_model = self.registry('magento.store')
        store_ids = store_model.search(self.cr, self.uid,
                                       [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(store_ids), 2)

        storeview_model = self.registry('magento.storeview')
        storeview_ids = storeview_model.search(
            self.cr, self.uid, [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(storeview_ids), 4)
    def setUp(self):
        super(TestImportProductImage, self).setUp()
        backend_model = self.env['magento.backend']
        warehouse = self.env.ref('stock.warehouse0')
        self.backend_id = backend_model.create(
            {'name': 'Test Magento',
             'version': '1.7',
             'location': 'http://anyurl',
             'username': '******',
             'warehouse_id': warehouse.id,
             'password': '******'}).id

        self.session = ConnectorSession(self.env.cr, self.env.uid,
                                        context=self.env.context)
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)
            import_record(self.session, 'magento.product.category',
                          self.backend_id, 1)

        self.product_model = self.env['magento.product.product']
    def setUp(self):
        super(test_import_product_image, self).setUp()
        backend_model = self.registry('magento.backend')
        warehouse_id = self.ref('stock.warehouse0')
        self.backend_id = backend_model.create(
            self.cr, self.uid, {
                'name': 'Test Magento',
                'version': '1.7',
                'location': 'http://anyurl',
                'username': '******',
                'warehouse_id': warehouse_id,
                'password': '******'
            })

        self.session = ConnectorSession(self.cr, self.uid)
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)
            import_record(self.session, 'magento.product.category',
                          self.backend_id, 1)
        self.session = ConnectorSession(self.cr, self.uid)
        self.product_model = self.registry('magento.product.product')
    def setUp(self):
        super(test_import_product_image, self).setUp()
        backend_model = self.registry('magento.backend')
        warehouse_id = self.ref('stock.warehouse0')
        self.backend_id = backend_model.create(
            self.cr,
            self.uid,
            {'name': 'Test Magento',
             'version': '1.7',
             'location': 'http://anyurl',
             'username': '******',
             'warehouse_id': warehouse_id,
             'password': '******'})

        self.session = ConnectorSession(self.cr, self.uid)
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)
            import_record(self.session, 'magento.product.category',
                          self.backend_id, 1)
        self.session = ConnectorSession(self.cr, self.uid)
        self.product_model = self.registry('magento.product.product')
    def test_00_import_backend(self):
        """ Synchronize initial metadata """
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)

        website_model = self.registry('magento.website')
        website_ids = website_model.search(self.cr,
                                           self.uid,
                                           [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(website_ids), 2)

        store_model = self.registry('magento.store')
        store_ids = store_model.search(self.cr,
                                       self.uid,
                                       [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(store_ids), 2)

        storeview_model = self.registry('magento.storeview')
        storeview_ids = storeview_model.search(self.cr,
                                               self.uid,
                                               [('backend_id', '=', self.backend_id)])
        self.assertEqual(len(storeview_ids), 4)
Ejemplo n.º 13
0
    def setUp(self):
        super(TestImportProductImage, self).setUp()
        backend_model = self.env['magento.backend']
        warehouse = self.env.ref('stock.warehouse0')
        self.backend_id = backend_model.create({
            'name': 'Test Magento',
            'version': '1.7',
            'location': 'http://anyurl',
            'username': '******',
            'warehouse_id': warehouse.id,
            'password': '******'
        }).id

        self.session = ConnectorSession(self.env.cr,
                                        self.env.uid,
                                        context=self.env.context)
        with mock_api(magento_base_responses):
            import_batch(self.session, 'magento.website', self.backend_id)
            import_batch(self.session, 'magento.store', self.backend_id)
            import_batch(self.session, 'magento.storeview', self.backend_id)
            import_record(self.session, 'magento.product.category',
                          self.backend_id, 1)

        self.product_model = self.env['magento.product.product']
 def setUp(self):
     super(test_export_invoice, self).setUp()
     cr, uid = self.cr, self.uid
     backend_model = self.registry("magento.backend")
     self.mag_sale_model = self.registry("magento.sale.order")
     self.session = ConnectorSession(cr, uid)
     self.session.context["__test_no_commit"] = True
     data_model = self.registry("ir.model.data")
     self.get_ref = partial(data_model.get_object_reference, cr, uid)
     __, warehouse_id = self.get_ref("stock", "warehouse0")
     backend_id = backend_model.create(
         cr,
         uid,
         {
             "name": "Test Magento",
             "version": "1.7",
             "location": "http://anyurl",
             "username": "******",
             "warehouse_id": warehouse_id,
             "password": "******",
         },
     )
     self.backend = backend_model.browse(cr, uid, backend_id)
     # payment method needed to import a sale order
     __, workflow_id = self.get_ref("sale_automatic_workflow", "manual_validation")
     __, journal_id = self.get_ref("account", "check_journal")
     self.payment_method_id = self.registry("payment.method").create(
         cr,
         uid,
         {
             "name": "checkmo",
             "create_invoice_on": False,
             "workflow_process_id": workflow_id,
             "import_rule": "always",
             "journal_id": journal_id,
         },
     )
     __, self.journal_id = self.get_ref("account", "bank_journal")
     __, self.pay_account_id = self.get_ref("account", "cash")
     __, self.period_id = self.get_ref("account", "period_10")
     # import the base informations
     with mock_api(magento_base_responses):
         import_batch(self.session, "magento.website", backend_id)
         import_batch(self.session, "magento.store", backend_id)
         import_batch(self.session, "magento.storeview", backend_id)
         with mock_urlopen_image():
             import_record(self.session, "magento.sale.order", backend_id, 900000691)
     sale_ids = self.mag_sale_model.search(
         cr, uid, [("backend_id", "=", backend_id), ("magento_id", "=", "900000691")]
     )
     self.assertEqual(len(sale_ids), 1)
     self.mag_sale = self.mag_sale_model.browse(cr, uid, sale_ids[0])
     # ignore exceptions on the sale order
     self.mag_sale.write({"ignore_exceptions": True})
     self.mag_sale.openerp_id.action_button_confirm()
     self.mag_sale.refresh()  # update to manual state
     self.sale_id = self.mag_sale.openerp_id.id
     sale_obj = self.registry("sale.order")
     invoice_id = sale_obj.action_invoice_create(cr, uid, [self.sale_id])
     assert invoice_id
     self.invoice_model = self.registry("account.invoice")
     self.invoice = self.invoice_model.browse(cr, uid, invoice_id)
 def setUp(self):
     super(SetUpMagentoSynchronized, self).setUp()
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', self.backend_id)
         import_batch(self.session, 'magento.store', self.backend_id)
         import_batch(self.session, 'magento.storeview', self.backend_id)
Ejemplo n.º 16
0
 def setUp(self):
     super(SetUpMagentoSynchronized, self).setUp()
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', self.backend_id)
         import_batch(self.session, 'magento.store', self.backend_id)
         import_batch(self.session, 'magento.storeview', self.backend_id)
Ejemplo n.º 17
0
 def setUp(self):
     super(TestExportInvoice, self).setUp()
     backend_model = self.env['magento.backend']
     self.mag_sale_model = self.env['magento.sale.order']
     self.session = ConnectorSession(self.env.cr,
                                     self.env.uid,
                                     context=self.env.context)
     warehouse = self.env.ref('stock.warehouse0')
     self.backend = backend = backend_model.create({
         'name':
         'Test Magento',
         'version':
         '1.7',
         'location':
         'http://anyurl',
         'username':
         '******',
         'warehouse_id':
         warehouse.id,
         'password':
         '******'
     })
     # payment method needed to import a sale order
     workflow = self.env.ref('sale_automatic_workflow.manual_validation')
     journal = self.env.ref('account.check_journal')
     self.payment_method = self.env['payment.method'].create({
         'name':
         'checkmo',
         'create_invoice_on':
         False,
         'workflow_process_id':
         workflow.id,
         'import_rule':
         'always',
         'journal_id':
         journal.id
     })
     self.journal = self.env.ref('account.bank_journal')
     self.pay_account = self.env.ref('account.cash')
     self.period = self.env.ref('account.period_10')
     # import the base informations
     with mock_api(magento_base_responses):
         import_batch(self.session, 'magento.website', backend.id)
         import_batch(self.session, 'magento.store', backend.id)
         import_batch(self.session, 'magento.storeview', backend.id)
         with mock_urlopen_image():
             import_record(self.session, 'magento.sale.order', backend.id,
                           900000691)
     self.stores = self.backend.mapped('website_ids.store_ids')
     sales = self.mag_sale_model.search([('backend_id', '=', backend.id),
                                         ('magento_id', '=', '900000691')])
     self.assertEqual(len(sales), 1)
     self.mag_sale = sales
     # ignore exceptions on the sale order
     self.mag_sale.ignore_exceptions = True
     self.mag_sale.openerp_id.action_button_confirm()
     sale = self.mag_sale.openerp_id
     invoice_id = sale.action_invoice_create()
     assert invoice_id
     self.invoice_model = self.env['account.invoice']
     self.invoice = self.invoice_model.browse(invoice_id)