File: account_demo.py

package info (click to toggle)
odoo 18.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 878,716 kB
  • sloc: javascript: 927,937; python: 685,670; xml: 388,524; sh: 1,033; sql: 415; makefile: 26
file content (32 lines) | stat: -rw-r--r-- 1,661 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
import logging

from odoo import api, models

_logger = logging.getLogger(__name__)


class AccountChartTemplate(models.AbstractModel):
    _inherit = "account.chart.template"

    @api.model
    def _get_demo_data_move(self, company=False):
        ref = self.env.ref
        move_data = super()._get_demo_data_move(company)
        if company.account_fiscal_country_id.code == "CL":
            foreign_invoice = ref('l10n_cl.dc_fe_dte').id
            foreign_credit_note = ref('l10n_cl.dc_ncex_dte').id
            self.env['account.journal'].search([
                *self.env['account.journal']._check_company_domain(company),
                ('type', '=', 'purchase'),
            ]).l10n_latam_use_documents = False
            move_data['demo_invoice_1']['l10n_latam_document_type_id'] = foreign_invoice
            move_data['demo_invoice_2']['l10n_latam_document_type_id'] = foreign_invoice
            move_data['demo_invoice_3']['l10n_latam_document_type_id'] = foreign_invoice
            move_data['demo_invoice_followup']['l10n_latam_document_type_id'] = foreign_invoice
            move_data['demo_move_auto_reconcile_1']['l10n_latam_document_type_id'] = foreign_credit_note
            move_data['demo_move_auto_reconcile_2']['l10n_latam_document_type_id'] = foreign_credit_note
            move_data['demo_move_auto_reconcile_5']['l10n_latam_document_type_id'] = foreign_credit_note
            move_data['demo_move_auto_reconcile_6']['l10n_latam_document_type_id'] = foreign_credit_note
            move_data['demo_move_auto_reconcile_7']['l10n_latam_document_type_id'] = foreign_credit_note
        return move_data