Ejemplo n.º 1
0
    def setUp(self):
        super(TestFatturaPAXMLValidation, self).setUp()

        # XXX - a company named "YourCompany" alread exists
        # we move it out of the way but we should do better here
        self.env.company.sudo().search([("name", "=", "YourCompany")
                                        ]).write({"name": "YourCompany_"})

        self.env.company.name = "YourCompany"
        self.env.company.vat = "IT06363391001"
        self.env.company.fatturapa_art73 = True
        self.env.company.partner_id.street = "Via Milano, 1"
        self.env.company.partner_id.city = "Roma"
        self.env.company.partner_id.state_id = self.env.ref(
            "base.state_us_2").id
        self.env.company.partner_id.zip = "00100"
        self.env.company.partner_id.phone = "06543534343"
        self.env.company.email = "*****@*****.**"
        self.env.company.partner_id.country_id = self.env.ref("base.it").id
        self.env.company.fatturapa_fiscal_position_id = self.env.ref(
            "l10n_it_fatturapa.fatturapa_RF01").id

        self.env.ref("product.decimal_product_uom").digits = 3
        self.env.ref("uom.product_uom_unit").name = "Unit(s)"

        tax_form = Form(self.env["account.tax"])
        tax_form.name = "22%"
        tax_form.amount = 22
        self.tax22 = tax_form.save()

        tax_form = Form(self.env["account.tax"])
        tax_form.name = "FC INC"
        tax_form.amount = 0
        tax_form.price_include = True
        tax_form.kind_id = self.env.ref("l10n_it_account_tax_kind.n3_5")
        tax_form.law_reference = "Art. 8 co. 1 lett. c) e co. 2 del DPR 633/72"
        self.tax1 = tax_form.save()

        fp_form = Form(self.env["account.fiscal.position"])
        fp_form.name = "Test for declaration"
        fp_form.valid_for_declaration_of_intent = True
        with fp_form.tax_ids.new() as tax_ids:
            tax_ids.tax_src_id = self.tax22
            tax_ids.tax_dest_id = self.tax1
        self.fiscal_position = fp_form.save()

        self.payment_term = self.env.ref(
            "account.account_payment_term_end_following_month")
        with Form(self.payment_term) as pt_form:
            pt_form.fatturapa_pt_id = self.env.ref(
                "l10n_it_fiscal_payment_term.fatturapa_tp02")
            pt_form.fatturapa_pm_id = self.env.ref(
                "l10n_it_fiscal_payment_term.fatturapa_mp05")

        self.env.ref(
            "l10n_it_declaration_of_intent.declaration_of_intent_seq").copy({
                "company_id":
                self.env.company.id,
            })
 def create_internal_transfer(self, currency, journal, destination_journal, amount):
     transfer = Form(self.env['account.payment'])
     transfer.payment_type = 'transfer'
     transfer.journal_id = journal
     transfer.currency_id = currency
     transfer.destination_journal_id = destination_journal
     transfer.amount = amount
     return transfer.save()
 def create_internal_transfer(self, currency_id, journal_id,
                              destination_journal_id, amount):
     transfer = Form(self.payment_model,
                     view="account.view_account_payment_form")
     transfer.payment_date = fields.Date.from_string('2020-01-01')
     transfer.payment_type = 'transfer'
     transfer.journal_id = journal_id
     transfer.currency_id = currency_id
     transfer.destination_journal_id = destination_journal_id
     transfer.amount = amount
     return transfer.save()
 def create_payment(self, invoices, payment_type, currency, journal, amount=False, date=False, csv=False):
     """Creating payment using wizard"""
     ctx = {'active_model': 'account.invoice', 'active_ids': invoices.ids}
     date = date or (self.today + timedelta(days=1))
     register = Form(self.register_payments_model.with_context(ctx))
     register.payment_date = date
     register.currency_id = currency
     register.journal_id = journal
     register.payment_method_id = self.payment_method_manual_in
     if amount:
         register.amount = amount
     if csv:
         register.csv_file = csv
     payment = register.save()
     return payment
Ejemplo n.º 5
0
    def test_promissory_note_customer(self):

        promissory_note = Form(self.env["promissory.note"])
        promissory_note.name = "Test"
        promissory_note.date_due = "2020-03-18"
        promissory_note.type = "customer"
        promissory_note.issuer_id = self.partner_a
        promissory_note.amount = 1000
        promissory_note.currency_id = self.env.ref("base.EUR")
        promissory_note.acc_issuer = "XXX"
        promissory_note.acc_beneficiary = "XXX"
        promissory_note.bank_issuer = "XXX"
        promissory_note.bank_beneficiary = "XXX"
        promissory_note.is_last_bo = True
        promissory_note = promissory_note.save()
        promissory_note.action_cashed()
Ejemplo n.º 6
0
    def test_sale(self):
        so = Form(self.env["sale.order"])
        so.partner_id = self.partner_a

        with so.order_line.new() as so_line:
            so_line.product_id = self.product_a
            so_line.product_uom_qty = 100

        with so.order_line.new() as so_line:
            so_line.product_id = self.product_b
            so_line.product_uom_qty = 10

        self.so = so.save()
        self.so.action_confirm()

        wizard = Form(self.env["sale.advance.payment.inv"].with_context(active_ids=self.so.ids))
        wizard.advance_payment_method = "percentage"
        wizard.amount = "50"
        wizard = wizard.save()
        wizard.create_invoices()
Ejemplo n.º 7
0
    def test_sale_eur_percentage(self):
        so = Form(self.env["sale.order"])
        so.partner_id = self.partner_a
        # so.price_list_id.write({'currency_id': self.ref('base.EUR').id})
        with so.order_line.new() as so_line:
            so_line.product_id = self.product_a
            so_line.product_uom_qty = 100

        with so.order_line.new() as so_line:
            so_line.product_id = self.product_b
            so_line.product_uom_qty = 10

        self.so = so.save()
        self.so.action_confirm()

        wizard = Form(self.env["sale.advance.payment.inv"].with_context(
            active_ids=self.so.ids))
        wizard.advance_payment_method = "percentage"
        wizard.amount = "50"
        wizard = wizard.save()
        wizard.journal_id.write({"currency_id": self.env.ref("base.EUR").id})
        wizard.create_invoices()
Ejemplo n.º 8
0
    def test_sale(self):
        so = Form(self.env["sale.order"])
        so.partner_id = self.partner_a

        with so.order_line.new() as so_line:
            so_line.product_id = self.product_a
            so_line.product_uom_qty = 100

        with so.order_line.new() as so_line:
            so_line.product_id = self.product_b
            so_line.product_uom_qty = 10

        self.so = so.save()
        self.so.action_confirm()

        self.so.action_payment_link()

        wizard = Form(self.env["sale.confirm.payment"].with_context(
            active_id=self.so.id))
        wizard.amount = 100
        wizard.acquirer_id = self.env["payment.acquirer"].search([], limit=1)
        wizard = wizard.save()
        wizard.do_confirm()