Skip to content

Commit

Permalink
[MIG] l10n_fr_account_vat_return and l10n_fr_account_vat_return_teled…
Browse files Browse the repository at this point in the history
…ec to v16
  • Loading branch information
alexis-via committed Apr 18, 2023
1 parent 6ff1339 commit 5c2d9b0
Show file tree
Hide file tree
Showing 22 changed files with 810 additions and 804 deletions.
4 changes: 2 additions & 2 deletions l10n_fr_account_vat_return/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

{
"name": "France VAT Return",
"version": "14.0.3.1.0",
"version": "16.0.1.0.0",
"category": "Accounting",
"license": "AGPL-3",
"summary": "VAT return for France: CA3, CA12, 3519",
"author": "Akretion,Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/l10n-france",
"depends": ["l10n_fr", "l10n_fr_oca", "intrastat_base", "onchange_helper"],
"depends": ["l10n_fr", "l10n_fr_oca", "intrastat_base"],
"data": [
"security/ir.model.access.csv",
"security/ir_rule.xml",
Expand Down
69 changes: 0 additions & 69 deletions l10n_fr_account_vat_return/migrations/14.0.2.0.0/post-migrate.py

This file was deleted.

27 changes: 0 additions & 27 deletions l10n_fr_account_vat_return/migrations/14.0.2.0.0/pre-migrate.py

This file was deleted.

74 changes: 37 additions & 37 deletions l10n_fr_account_vat_return/models/l10n_fr_account_vat_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ class L10nFrAccountVatBox(models.Model):
("section", "Section"),
("sub_section", "Sub-Section"),
],
string="Display Type",
)
code = fields.Char()
name = fields.Char(string="Label", required=True)
full_label = fields.Char(string="Full Label")
full_label = fields.Char()
box_type = fields.Selection(
[
("taxed_op_france", "Taxed Operations - France"),
Expand Down Expand Up @@ -65,7 +64,6 @@ class L10nFrAccountVatBox(models.Model):
)
negative_switch_box_id = fields.Many2one(
"l10n.fr.account.vat.box",
string="Negative Switch Box",
help="If the amount of this box is negative, its lines will be transfered "
"to another box with a sign inversion.",
)
Expand All @@ -74,7 +72,6 @@ class L10nFrAccountVatBox(models.Model):
("debit", "Debit"),
("credit", "Credit"),
],
string="Accounting Method",
)
due_vat_rate = fields.Integer(string="VAT Rate x100")
due_vat_base_box_id = fields.Many2one(
Expand Down Expand Up @@ -117,19 +114,19 @@ class L10nFrAccountVatBox(models.Model):
account_code = fields.Char(string="Generic Account Code")
account_id = fields.Many2one(
"account.account",
string="Account",
company_dependent=True,
domain="[('deprecated', '=', False), ('company_id', '=', current_company_id)]",
help="If not set, Odoo will use the first account that starts with the "
"Generic Account Code. If set, Odoo will ignore the Generic Account Code "
"and use this account.",
)
analytic_account_id = fields.Many2one(
"account.analytic.account",
string="Analytic Account",
company_dependent=True,
domain="[('company_id', 'in', (False, current_company_id))]",
)
# analytic_account_id = fields.Many2one( # TODO replace by distribution
# but pb company_dependent=True,
# "account.analytic.account",
# string="Analytic Account",
# company_dependent=True,
# domain="[('company_id', 'in', (False, current_company_id))]",
# )
push_sequence = fields.Integer()
# 10: appendix lines
# 20: totals cols appendix
Expand All @@ -138,10 +135,9 @@ class L10nFrAccountVatBox(models.Model):
# 100 : CA3 end : total à payer + crédit à reporter
push_box_id = fields.Many2one(
"l10n.fr.account.vat.box",
string="Push Box",
domain=[("box_type", "=", "manual")],
)
push_rate = fields.Float(digits=(16, PUSH_RATE_PRECISION), string="Push Rate")
push_rate = fields.Float(digits=(16, PUSH_RATE_PRECISION))

_sql_constraints = [
("sequence_unique", "unique(sequence)", "This sequence already exists."),
Expand Down Expand Up @@ -189,7 +185,6 @@ def display_type_change(self):
self.print_y = False
self.account_code = False
self.account_id = False
self.analytic_account_id = False

@api.constrains(
"edi_type",
Expand All @@ -199,7 +194,6 @@ def display_type_change(self):
"accounting_method",
"account_code",
"account_id",
"analytic_account_id",
"push_box_id",
"push_rate",
"push_sequence",
Expand Down Expand Up @@ -249,10 +243,11 @@ def _check_box(self): # noqa: C901
):
raise ValidationError(
_(
"The box '%s' is the negative switch box of '%s' but it's "
"EDI Type is not 'MOA'."
"The box '%(negative_box)s' is the negative switch box of "
"'%(box)s' but it's EDI Type is not 'MOA'.",
negative_box=box.negative_switch_box_id.display_name,
box=box.display_name,
)
% (box.negative_switch_box_id.display_name, box.display_name)
)
if not box.code and box.form_code == "3310CA3":
# on 3310-A, total boxes don't have a code
Expand All @@ -277,10 +272,12 @@ def _check_box(self): # noqa: C901
elif box.due_vat_base_box_id.box_type != "due_vat_base":
raise ValidationError(
_(
"The Due VAT box '%s' has '%s' configured as "
"Due VAT Base box, but it has a different type."
"The Due VAT box '%(due_vat_box)s' has "
"'%(due_vat_base_box)s' configured as "
"Due VAT Base box, but it has a different type.",
due_vat_box=box.display_name,
due_vat_base_box=box.due_vat_base_box_id.display_name,
)
% (box.display_name, box.due_vat_base_box_id.display_name)
)
if box.accounting_method != "debit":
raise ValidationError(
Expand All @@ -293,15 +290,15 @@ def _check_box(self): # noqa: C901
if box.print_y != box.due_vat_base_box_id.print_y:
raise ValidationError(
_(
"Due VAT box '%s' has print Y %d whereas "
"Base Due VAT box '%s' has print Y %d. "
"They should be on the same line."
)
% (
box.display_name,
box.print_y,
box.due_vat_base_box_id.display_name,
box.due_vat_base_box_id.print_y,
"Due VAT box '%(due_vat_box)s' has print Y "
"%(due_vat_box_print_y)d "
"whereas Due VAT Base box '%(due_vat_base_box)s' "
"has print Y %(due_vat_base_box_print_y)d. "
"They should be on the same line.",
due_vat_box=box.display_name,
due_vat_box_print_y=box.print_y,
due_vat_base_box=box.due_vat_base_box_id.display_name,
due_vat_base_box_print_y=box.due_vat_base_box_id.print_y,
)
)
elif box.due_vat_base_box_id:
Expand All @@ -325,7 +322,7 @@ def _check_box(self): # noqa: C901
% box.display_name
)
if not box.accounting_method:
if box.account_code or box.account_id or box.analytic_account_id:
if box.account_code or box.account_id:
raise ValidationError(
_(
"Box '%s' doesn't have an accounting method, "
Expand All @@ -337,10 +334,11 @@ def _check_box(self): # noqa: C901
if box.push_box_id.box_type in ("manual", "no_push_total"):
raise ValidationError(
_(
"Box '%s' has a push box '%s' that is configured "
"as manual or not pushed total."
"Box '%(box)s' has a push box '%(push_box)s' "
"that is configured as manual or not pushed total.",
box=box.display_name,
push_box=box.push_box_id.display_name,
)
% (box.display_name, box.push_box_id.display_name)
)
if not box.push_sequence:
raise ValidationError(
Expand Down Expand Up @@ -407,9 +405,11 @@ def _box_from_single_box_type(self, box_type):
)
raise UserError(
_(
"A single box with type '%s' should exists, "
"but there are %d box(es) of that type. This should never happen."
"A single box with type '%(box_type)s' should exists, "
"but there are %(count)d box(es) of that type. "
"This should never happen.",
box_type=boxtype2label[box_type],
count=len(box),
)
% (boxtype2label[box_type], len(box))
)
return box
Loading

0 comments on commit 5c2d9b0

Please sign in to comment.