Skip to content

Commit

Permalink
[MIG] l10n_br_account: Migration to 15.0
Browse files Browse the repository at this point in the history
[TMP] use temporary l10n_br_fiscal MIG PR
  • Loading branch information
rvalyi committed Jan 15, 2024
1 parent 40b6721 commit 698a5c2
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 99 deletions.
12 changes: 6 additions & 6 deletions l10n_br_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Brazilian Localization Account
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:745c93e6a5e49fe5d8d1f7960a8cf28dfa0ee349c96eaa1d802e6767b8df8164
!! source digest: sha256:14a6f5c1a28387de33b045146f1d6960b79bf51fae3a0c6674ec20c8d0109dd3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Brazilian Localization Account
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account
:target: https://github.com/OCA/l10n-brazil/tree/15.0/l10n_br_account
:alt: OCA/l10n-brazil
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_account
:target: https://translation.odoo-community.org/projects/l10n-brazil-15-0/l10n-brazil-15-0-l10n_br_account
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -63,7 +63,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-brazil/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_account%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_account%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -120,6 +120,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-renatonlima| |maintainer-rvalyi|

This module is part of the `OCA/l10n-brazil <https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account>`_ project on GitHub.
This module is part of the `OCA/l10n-brazil <https://github.com/OCA/l10n-brazil/tree/15.0/l10n_br_account>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion l10n_br_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "AGPL-3",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"version": "14.0.10.1.0",
"version": "15.0.1.0.0",
"development_status": "Beta",
"maintainers": ["renatonlima", "rvalyi"],
"depends": [
Expand Down
42 changes: 0 additions & 42 deletions l10n_br_account/migrations/14.0.9.0.0/post-migration.py

This file was deleted.

8 changes: 4 additions & 4 deletions l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def fields_view_get(
sub_form_view
)
sub_arch, sub_fields = view.postprocess_and_fields(
sub_form_node, "account.move.line", False
sub_form_node, "account.move.line"
)
line_field_name = "invoice_line_ids"
invoice_view["fields"][line_field_name]["views"]["form"] = {
Expand All @@ -188,7 +188,7 @@ def fields_view_get(
sub_form_view
)
sub_arch, sub_fields = view.postprocess_and_fields(
sub_form_node, "account.move.line", False
sub_form_node, "account.move.line"
)
line_field_name = "invoice_line_ids"
invoice_view["fields"][line_field_name]["views"]["form"] = {
Expand All @@ -207,7 +207,7 @@ def fields_view_get(
sub_form_view
)
sub_arch, sub_fields = view.postprocess_and_fields(
sub_form_node, "account.move.line", False
sub_form_node, "account.move.line"
)
line_field_name = "line_ids"
invoice_view["fields"][line_field_name]["views"]["tree"] = {
Expand Down Expand Up @@ -241,7 +241,7 @@ def _compute_amount(self):
move.is_invoice(include_receipts=True)
and not line.exclude_from_invoice_tab
):
line._update_taxes()
line._update_fiscal_taxes()

result = super()._compute_amount()
for move in self.filtered(lambda m: m.company_id.country_id.code == "BR"):
Expand Down
2 changes: 2 additions & 0 deletions l10n_br_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def compute_all(
partner=None,
is_refund=False,
handle_price_include=True,
include_caba_tags=False,
fiscal_taxes=None,
operation_line=False,
ncm=None,
Expand Down Expand Up @@ -74,6 +75,7 @@ def compute_all(
partner,
is_refund,
handle_price_include,
include_caba_tags,
)

if not fiscal_taxes:
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_account/models/account_tax_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class AccountTaxTemplate(models.Model):

def _generate_tax(self, company):
mapping = super()._generate_tax(company)
taxes_template = self.browse(mapping.get("tax_template_to_tax").keys())
taxes_template = mapping.get("tax_template_to_tax").keys()

for tax_template in taxes_template:
tax_id = mapping.get("tax_template_to_tax").get(tax_template.id)
self.env["account.tax"].browse(tax_id).write(
{"fiscal_tax_ids": [(6, False, tax_template.fiscal_tax_ids.ids)]}
{"fiscal_tax_ids": [(6, 0, tax_template.fiscal_tax_ids.ids)]}
)

return mapping
10 changes: 10 additions & 0 deletions l10n_br_account/models/fiscal_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,13 @@ def create(self, vals_list):
return super().create(filtered_vals_list)
else:
return super().create(vals_list)

def _update_cache(self, values, validate=True):
"""
Overriden to avoid raising error with ensure_one() in super()
when called from some account.move onchange
as we allow empty fiscal document in account.move.
"""
if len(self) == 0:
return
return super()._update_cache(values, validate)
10 changes: 10 additions & 0 deletions l10n_br_account/models/fiscal_document_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,13 @@ def create(self, vals_list):
return []

return super().create(vals_list)

def _update_cache(self, values, validate=True):
"""
Overriden to avoid raising error with ensure_one() in super()
when called from some account.move.line onchange
as we allow empty fiscal document line in account.move.line.
"""
if len(self) == 0:
return
return super()._update_cache(values, validate)
8 changes: 4 additions & 4 deletions l10n_br_account/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ <h1 class="title">Brazilian Localization Account</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:745c93e6a5e49fe5d8d1f7960a8cf28dfa0ee349c96eaa1d802e6767b8df8164
!! source digest: sha256:14a6f5c1a28387de33b045146f1d6960b79bf51fae3a0c6674ec20c8d0109dd3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account"><img alt="OCA/l10n-brazil" src="https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/l10n-brazil/tree/15.0/l10n_br_account"><img alt="OCA/l10n-brazil" src="https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/l10n-brazil-15-0/l10n-brazil-15-0-l10n_br_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to extend the functionality of … to support …
and allow you to …</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -413,7 +413,7 @@ <h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/l10n-brazil/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_account%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_account%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -456,7 +456,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/renatonlima"><img alt="renatonlima" src="https://github.com/renatonlima.png?size=40px" /></a> <a class="reference external image-reference" href="https://github.com/rvalyi"><img alt="rvalyi" src="https://github.com/rvalyi.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account">OCA/l10n-brazil</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/l10n-brazil/tree/15.0/l10n_br_account">OCA/l10n-brazil</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
22 changes: 0 additions & 22 deletions l10n_br_account/tests/test_account_move_lc.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ def test_venda(self):
"debit": 0.0,
"credit": 843.5,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_cofins = {
Expand All @@ -160,7 +159,6 @@ def test_venda(self):
"debit": 0.0,
"credit": 30.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_icms = {
Expand All @@ -185,7 +183,6 @@ def test_venda(self):
"debit": 0.0,
"credit": 120.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_ipi = {
Expand Down Expand Up @@ -217,7 +214,6 @@ def test_venda(self):
"debit": 0.0,
"credit": 50.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_pis = {
Expand All @@ -242,7 +238,6 @@ def test_venda(self):
"debit": 0.0,
"credit": 6.5,
"date_maturity": False,
"tax_exigible": True,
}

term_line_vals_1 = {
Expand All @@ -263,7 +258,6 @@ def test_venda(self):
"debit": 1050.0,
"credit": 0.0,
"date_maturity": fields.Date.from_string("2019-01-01"),
"tax_exigible": True,
}

move_vals = {
Expand Down Expand Up @@ -310,7 +304,6 @@ def test_simples_remessa(self):
"debit": 0.0,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_cofins = {
Expand All @@ -335,7 +328,6 @@ def test_simples_remessa(self):
"debit": 0.0,
"credit": 30.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_icms = {
Expand All @@ -360,7 +352,6 @@ def test_simples_remessa(self):
"debit": 0.0,
"credit": 120.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_ipi = {
Expand Down Expand Up @@ -392,7 +383,6 @@ def test_simples_remessa(self):
"debit": 0.0,
"credit": 50.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_pis = {
Expand All @@ -417,7 +407,6 @@ def test_simples_remessa(self):
"debit": 0.0,
"credit": 6.5,
"date_maturity": False,
"tax_exigible": True,
}

term_line_vals_1 = {
Expand All @@ -438,7 +427,6 @@ def test_simples_remessa(self):
"debit": 206.5,
"credit": 0.0,
"date_maturity": fields.Date.from_string("2019-01-01"),
"tax_exigible": True,
}

move_vals = {
Expand Down Expand Up @@ -488,7 +476,6 @@ def test_compra_para_revenda(self):
"debit": 1050.0,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_cofins = {
Expand All @@ -513,7 +500,6 @@ def test_compra_para_revenda(self):
"debit": 30.0,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_cofins_comp = {
Expand All @@ -540,7 +526,6 @@ def test_compra_para_revenda(self):
"debit": 0.0,
"credit": 30.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_icms = {
Expand All @@ -565,7 +550,6 @@ def test_compra_para_revenda(self):
"debit": 120.0,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_icms_comp = {
Expand All @@ -590,7 +574,6 @@ def test_compra_para_revenda(self):
"debit": 0.0,
"credit": 120.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_ipi = {
Expand All @@ -615,7 +598,6 @@ def test_compra_para_revenda(self):
"debit": 50.0,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_ipi_comp = {
Expand All @@ -640,7 +622,6 @@ def test_compra_para_revenda(self):
"debit": 0.0,
"credit": 50.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_pis = {
Expand All @@ -665,7 +646,6 @@ def test_compra_para_revenda(self):
"debit": 6.5,
"credit": 0.0,
"date_maturity": False,
"tax_exigible": True,
}

tax_line_vals_pis_comp = {
Expand All @@ -690,7 +670,6 @@ def test_compra_para_revenda(self):
"debit": 0.0,
"credit": 6.5,
"date_maturity": False,
"tax_exigible": True,
}

term_line_vals_1 = {
Expand All @@ -711,7 +690,6 @@ def test_compra_para_revenda(self):
"debit": 0.0,
"credit": 1050.0,
"date_maturity": fields.Date.from_string("2019-01-01"),
"tax_exigible": True,
}

move_vals = {
Expand Down
Loading

0 comments on commit 698a5c2

Please sign in to comment.