mirror of
https://github.com/bringout/oca-ocb-l10n_europe.git
synced 2026-04-27 14:42:01 +02:00
Initial commit: L10N_Europe packages
This commit is contained in:
commit
9803722600
2377 changed files with 380711 additions and 0 deletions
|
|
@ -0,0 +1,5 @@
|
|||
from odoo.addons.account.models.chart_template import update_taxes_from_templates
|
||||
|
||||
def migrate(cr, version):
|
||||
# Add the new tax tags to the credit note repartition lines
|
||||
update_taxes_from_templates(cr, 'l10n_it.l10n_it_chart_template_generic')
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
from odoo.addons.account.models.chart_template import update_taxes_from_templates
|
||||
|
||||
def migrate(cr, version):
|
||||
# Change tax tag ve38 from tax repartition lines to base repartition lines
|
||||
update_taxes_from_templates(cr, 'l10n_it.l10n_it_chart_template_generic')
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
def migrate(cr, version):
|
||||
|
||||
cr.execute("""
|
||||
INSERT INTO account_account_account_tag
|
||||
SELECT DISTINCT account.id, template_tag.account_account_tag_id
|
||||
FROM account_account_template AS template
|
||||
JOIN account_account AS account
|
||||
ON account.code LIKE CONCAT(template.code, '%')
|
||||
JOIN account_account_template_account_tag AS template_tag
|
||||
ON template.id = template_tag.account_account_template_id
|
||||
JOIN res_company ON res_company.id = account.company_id
|
||||
JOIN res_country ON res_country.id = res_company.account_fiscal_country_id
|
||||
AND res_country.code = 'IT'
|
||||
ON CONFLICT DO NOTHING
|
||||
""")
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo.addons.account.models.chart_template import update_taxes_from_templates
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
import psycopg2
|
||||
import logging
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
account_templates = {account_code: env.ref(f'l10n_it.{account_code}') for account_code in ['2607', '2608']}
|
||||
companies = env['res.company'].search([('chart_template_id', '=', env.ref('l10n_it.l10n_it_chart_template_generic').id)])
|
||||
for company in companies:
|
||||
try:
|
||||
for account_code, account_template in account_templates.items():
|
||||
template_vals = [(account_template, company.chart_template_id._get_account_vals(company, account_template, account_code + '00', {}))]
|
||||
company.chart_template_id._create_records_with_xmlid('account.account', template_vals, company)
|
||||
_logger.info("Created split payment accounts for company: %s(%s).", company.name, company.id)
|
||||
except psycopg2.errors.UniqueViolation:
|
||||
_logger.error("Split payment accounts already exist for company: %s(%s).", company.name, company.id)
|
||||
|
||||
update_taxes_from_templates(cr, 'l10n_it.l10n_it_chart_template_generic')
|
||||
Loading…
Add table
Add a link
Reference in a new issue