-
-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] l10n_es_ticketbai_oss: Migration to 16.0
- Loading branch information
Showing
9 changed files
with
122 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
from . import ticketbai_invoice_tax | ||
from . import account_tax | ||
from . import tbai_tax | ||
from . import vat_regime_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Copyright 2022 Binovo IT Human Project SL | ||
# Copyright 2024 Avanzosc | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class AccountTax(models.Model): | ||
_inherit = "account.tax" | ||
|
||
tbai_tax_map_id = fields.Many2one( | ||
comodel_name="tbai.tax.map", string="Tbai Tax Map" | ||
) | ||
not_subject_to_cause = fields.Selection( | ||
selection=[ | ||
( | ||
"OT", | ||
"OT - No sujeto por el artículo 7 de la Norma Foral de IVA Otros" | ||
" supuestos de no sujeción.", | ||
), | ||
("RL", "RL - No sujeto por reglas de localización."), | ||
( | ||
"IE", | ||
"IE - No sujeto en el TAI por reglas de localización, pero repercute" | ||
" impuesto extranjero, IPS/IGIC o IVA de otro estado miembro UE.", | ||
), | ||
], | ||
string="Not Subject to Cause", | ||
) | ||
|
||
def tbai_is_subject_to_tax(self): | ||
if self.tbai_tax_map_id and self.tbai_tax_map_id.code in ("SNS", "BNS"): | ||
return False | ||
return super().tbai_is_subject_to_tax() | ||
|
||
def tbai_es_entrega(self): | ||
return super(AccountTax, self).tbai_es_entrega() or ( | ||
self | ||
in self.env["account.tax"].search( | ||
[ | ||
("oss_country_id", "!=", False), | ||
("company_id", "=", self.company_id.id), | ||
] | ||
) | ||
) | ||
|
||
def tbai_es_prestacion_servicios(self): | ||
if self.tbai_tax_map_id: | ||
return self.tbai_tax_map_id.code in ("SNS", "SIE", "S", "SER") | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Copyright 2022 Landoo Sistemas de Informacion SL | ||
from odoo import fields, models | ||
|
||
|
||
class TicketBAITax(models.Model): | ||
_inherit = "tbai.invoice.tax" | ||
|
||
not_subject_to_cause = fields.Selection(selection_add=[("IE", "IE")]) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright 2022 Landoo Sistemas de Informacion SL | ||
import logging | ||
from odoo.addons.l10n_es_ticketbai_api.models.ticketbai_invoice_tax import VATRegimeKey | ||
|
||
_logger = logging.getLogger(__name__) | ||
|
||
_logger.info("Loading ExtendedVATRegimeKey module...") | ||
|
||
# Get existing keys from the original class | ||
_keys = {name: member for name, member in VATRegimeKey.__members__.items()} | ||
|
||
# Add the new key K17 | ||
_keys["K17"] = "17" | ||
|
||
# Clear the original members (may not be needed depending on implementation) | ||
# VATRegimeKey.__members__.clear() # This line is typically not needed | ||
|
||
# Recreate the enum with the updated keys | ||
for name, value in _keys.items(): | ||
setattr(VATRegimeKey, name, value) | ||
|
||
# Optional: Update __members__ to reflect the new changes if necessary | ||
VATRegimeKey.__members__.update(_keys) | ||
|
||
# Example usage | ||
_logger.info("Updated VATRegimeKey: %s", VATRegimeKey.__members__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<odoo> | ||
<record model="ir.ui.view" id="account_tax_tbai_form"> | ||
<field name="name">account.tax.tbai.form</field> | ||
<field name="model">account.tax</field> | ||
<field name="inherit_id" ref="account.view_tax_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//field[@name='tax_group_id']" position="after"> | ||
<field | ||
name="tbai_tax_map_id" | ||
options="{'no_create': True, 'no_create_edit':True, 'no_open': True}" | ||
/> | ||
<field name="not_subject_to_cause" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |