Ejemplo n.º 1
0
 def _create_basic_config(self):
     new_config = Form(self.env['pos.config'])
     new_config.name = 'PoS Shop Test'
     new_config.module_account = True
     new_config.invoice_journal_id = self.invoice_journal
     new_config.journal_id = self.pos_sale_journal
     new_config.available_pricelist_ids.clear()
     new_config.available_pricelist_ids.add(self.currency_pricelist)
     new_config.pricelist_id = self.currency_pricelist
     config = new_config.save()
     cash_journal = config.payment_method_ids.filtered(
         lambda pm: pm.is_cash_count)[:1].cash_journal_id
     cash_split_pm = self.env['pos.payment.method'].create({
         'name':
         'Split (Cash) PM',
         'receivable_account_id':
         self.pos_receivable_account.id,
         'split_transactions':
         True,
         'is_cash_count':
         True,
         'cash_journal_id':
         cash_journal.id,
     })
     config.write({'payment_method_ids': [(4, cash_split_pm.id, 0)]})
     return config
Ejemplo n.º 2
0
    def _create_other_currency_config(self):
        (self.other_currency.rate_ids
         | self.company_currency.rate_ids).unlink()
        self.env['res.currency.rate'].create({
            'rate':
            0.5,
            'currency_id':
            self.other_currency.id,
        })
        other_cash_journal = self.env['account.journal'].create({
            'name':
            'Cash Other',
            'type':
            'cash',
            'company_id':
            self.company.id,
            'code':
            'CSHO',
            'sequence':
            10,
            'currency_id':
            self.other_currency.id
        })
        other_invoice_journal = self.env['account.journal'].create({
            'name':
            'Customer Invoice Other',
            'type':
            'sale',
            'company_id':
            self.company.id,
            'code':
            'INVO',
            'sequence':
            11,
            'currency_id':
            self.other_currency.id
        })
        other_sales_journal = self.env['account.journal'].create({
            'name':
            'PoS Sale Other',
            'type':
            'sale',
            'code':
            'POSO',
            'company_id':
            self.company.id,
            'sequence':
            12,
            'currency_id':
            self.other_currency.id
        })
        other_pricelist = self.env['product.pricelist'].create({
            'name':
            'Public Pricelist Other',
            'currency_id':
            self.other_currency.id,
        })
        other_cash_payment_method = self.env['pos.payment.method'].create({
            'name':
            'Cash Other',
            'receivable_account_id':
            self.pos_receivable_account.id,
            'is_cash_count':
            True,
            'cash_journal_id':
            other_cash_journal.id,
        })
        other_bank_payment_method = self.env['pos.payment.method'].create({
            'name':
            'Bank Other',
            'receivable_account_id':
            self.pos_receivable_account.id,
        })

        new_config = Form(self.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