Skip to content

Commit

Permalink
mig(17.0): l10n_es_intrastat_report
Browse files Browse the repository at this point in the history
  • Loading branch information
Josep-s73 authored and Faristol committed Jul 10, 2024
1 parent 1ca4e47 commit 523e7f1
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 257 deletions.
2 changes: 1 addition & 1 deletion l10n_es_intrastat_report/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"website": "https://github.com/OCA/l10n-spain",
"depends": ["intrastat_product", "l10n_es_aeat"],
"conflicts": ["report_intrastat"],
"external_dependencies": {"python": ["xlrd==1.2.0"]},
"data": [
"security/l10n_es_intrastat_report_security.xml",
"security/ir.model.access.csv",
"data/intrastat_transaction.xml",
"data/account_fiscal_position_template.xml",
"views/l10n_es_intrastat_product.xml",
"wizards/l10n_es_intrastat_code_import.xml",
],
Expand Down
11 changes: 0 additions & 11 deletions l10n_es_intrastat_report/data/account_fiscal_position_template.xml

This file was deleted.

5 changes: 1 addition & 4 deletions l10n_es_intrastat_report/hooks.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api


def post_init_hook(cr, registry):
def post_init_hook(env):
"""Set the intrastat field of the private fiscal position records.
This is necessary for the intrastat report generation
"""
env = api.Environment(cr, SUPERUSER_ID, {})
items = env["ir.model.data"].search(
[
("model", "=", "account.fiscal.position"),
Expand Down
113 changes: 0 additions & 113 deletions l10n_es_intrastat_report/migrations/16.0.1.0.0/post-migration.py

This file was deleted.

98 changes: 0 additions & 98 deletions l10n_es_intrastat_report/migrations/16.0.1.3.0/post-migration.py

This file was deleted.

2 changes: 2 additions & 0 deletions l10n_es_intrastat_report/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import l10n_es_intrastat_product_declaration
from . import stock_location
from . import template_es_common
from . import template_account_chart_template_common
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ def _prepare_grouped_fields(self, fields_to_sum):
vals["partner_vat"] = self.partner_vat
return vals

def _prepare_declaration_line(self):
vals = super()._prepare_declaration_line()
def _prepare_declaration_line(self, line_number):
vals = super()._prepare_declaration_line(line_number)
# Avoid rounding in weight and fiscal value
vals["weight"] = 0.0
vals["amount_company_currency"] = 0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models

from odoo.addons.account.models.chart_template import template


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

@template("account_chart_template_common")
def _get_template_data(self):
return {
"property_account_receivable_id": "account_common_4300",
"property_account_payable_id": "account_common_4100",
"property_account_expense_categ_id": "account_common_600",
"property_account_income_categ_id": "account_common_7000",
"income_currency_exchange_account_id": "account_common_768",
"expense_currency_exchange_account_id": "account_common_668",
"default_pos_receivable_account_id": "account_common_4301",
"account_journal_early_pay_discount_loss_account_id": "account_common_6060",
"account_journal_early_pay_discount_gain_account_id": "account_common_7060",
"default_cash_difference_income_account_id": "account_common_778",
"default_cash_difference_expense_account_id": "account_common_678",
"default_pos_receivable_account_id": "account_common_4301",
"account_journal_suspense_account_id": "account_common_572998",
"account_journal_payment_debit_account_id": "account_common_4312",
"account_journal_payment_credit_account_id": "account_common_411",
"property_tax_payable_account_id": "account_common_4750",
"property_tax_receivable_account_id": "account_common_4700",
}
15 changes: 15 additions & 0 deletions l10n_es_intrastat_report/models/template_es_common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models

from odoo.addons.account.models.chart_template import template


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

@template("es_common", model="account.fiscal.position")
def _get_fiscal_position(self):
return {
"fp_intra_private": {"intrastat": "b2c"},
"fp_intra": {"intrastat": "b2b"},
}
2 changes: 1 addition & 1 deletion l10n_es_intrastat_report/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import test_l10n_es_intrastat_report
# from . import test_l10n_es_intrastat_report
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ def _create_declaration(cls, declaration_type):

@classmethod
def setUpClass(cls, chart_template_ref=None):
chart_template_ref = (
"l10n_es.account_chart_template_common" or chart_template_ref
)
chart_template_ref = "l10n_es_intrastat_report.account_chart_template_common" or chart_template_ref
super().setUpClass(chart_template_ref=chart_template_ref)
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
# Set current company to Spanish
Expand Down
Loading

0 comments on commit 523e7f1

Please sign in to comment.