예제 #1
0
파일: common.py 프로젝트: erromu/flectra
 def _create_basic_config(cls):
     new_config = Form(cls.env['pos.config'])
     new_config.name = 'PoS Shop Test'
     new_config.module_account = True
     new_config.invoice_journal_id = cls.invoice_journal
     new_config.journal_id = cls.pos_sale_journal
     new_config.available_pricelist_ids.clear()
     new_config.available_pricelist_ids.add(cls.currency_pricelist)
     new_config.pricelist_id = cls.currency_pricelist
     config = new_config.save()
     cash_payment_method = cls.env['pos.payment.method'].create({
         'name':
         'Cash',
         'receivable_account_id':
         cls.pos_receivable_account.id,
         'is_cash_count':
         True,
         'cash_journal_id':
         cls.company_data['default_journal_cash'].id,
         'company_id':
         cls.env.company.id,
     })
     bank_payment_method = cls.env['pos.payment.method'].create({
         'name':
         'Bank',
         'receivable_account_id':
         cls.pos_receivable_account.id,
         'is_cash_count':
         False,
         'company_id':
         cls.env.company.id,
     })
     cash_split_pm = cls.env['pos.payment.method'].create({
         'name':
         'Split (Cash) PM',
         'receivable_account_id':
         cls.pos_receivable_account.id,
         'split_transactions':
         True,
         'is_cash_count':
         True,
         'cash_journal_id':
         cls.company_data['default_journal_cash'].id,
     })
     bank_split_pm = cls.env['pos.payment.method'].create({
         'name':
         'Split (Bank) PM',
         'receivable_account_id':
         cls.pos_receivable_account.id,
         'split_transactions':
         True,
     })
     config.write({
         'payment_method_ids': [(4, cash_split_pm.id),
                                (4, bank_split_pm.id),
                                (4, cash_payment_method.id),
                                (4, bank_payment_method.id)]
     })
     return config
예제 #2
0
    def _create_other_currency_config(cls):
        (cls.other_currency.rate_ids | cls.company_currency.rate_ids).unlink()
        cls.env['res.currency.rate'].create({
            'rate': 0.5,
            'currency_id': cls.other_currency.id,
            'name': datetime.today().date(),
        })
        other_cash_journal = cls.env['account.journal'].create({
            'name': 'Cash Other',
            'type': 'cash',
            'company_id': cls.company.id,
            'code': 'CSHO',
            'sequence': 10,
            'currency_id': cls.other_currency.id
        })
        other_invoice_journal = cls.env['account.journal'].create({
            'name': 'Customer Invoice Other',
            'type': 'sale',
            'company_id': cls.company.id,
            'code': 'INVO',
            'sequence': 11,
            'currency_id': cls.other_currency.id
        })
        other_sales_journal = cls.env['account.journal'].create({
            'name':'PoS Sale Other',
            'type': 'sale',
            'code': 'POSO',
            'company_id': cls.company.id,
            'sequence': 12,
            'currency_id': cls.other_currency.id
        })
        other_pricelist = cls.env['product.pricelist'].create({
            'name': 'Public Pricelist Other',
            'currency_id': cls.other_currency.id,
        })
        other_cash_payment_method = cls.env['pos.payment.method'].create({
            'name': 'Cash Other',
            'receivable_account_id': cls.pos_receivable_account.id,
            'is_cash_count': True,
            'cash_journal_id': other_cash_journal.id,
        })
        other_bank_payment_method = cls.env['pos.payment.method'].create({
            'name': 'Bank Other',
            'receivable_account_id': cls.pos_receivable_account.id,
        })

        new_config = Form(cls.env['pos.config'])
        new_config.name = 'Shop Other'
        new_config.invoice_journal_id = other_invoice_journal
        new_config.journal_id = other_sales_journal
        new_config.use_pricelist = True
        new_config.available_pricelist_ids.clear()
        new_config.available_pricelist_ids.add(other_pricelist)
        new_config.pricelist_id = other_pricelist
        new_config.payment_method_ids.clear()
        new_config.payment_method_ids.add(other_cash_payment_method)
        new_config.payment_method_ids.add(other_bank_payment_method)
        config = new_config.save()
        return config