Skip to content

Commit

Permalink
[ADD] l10n_br_account_invoice_merge
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Nov 8, 2023
1 parent c080cff commit d66eaf2
Show file tree
Hide file tree
Showing 12 changed files with 593 additions and 0 deletions.
77 changes: 77 additions & 0 deletions l10n_br_account_invoice_merge/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
=============================
L10n Br Account Invoice Merge
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:880cd68b6230bbebd892e4fc0f3515a258c339313e38263d46314d0b7c2af063
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2F-lightgray.png?logo=github
:target: https://github.com/OCA//tree//l10n_br_account_invoice_merge
:alt: OCA/
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/-/--l10n_br_account_invoice_merge
: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/&target_branch=
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|


**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA//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//issues/new?body=module:%20l10n_br_account_invoice_merge%0Aversion:%20%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.

Credits
=======

Authors
~~~~~~~

* Escodoo

Contributors
~~~~~~~~~~~~

* `Escodoo <https://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/ <https://github.com/OCA//tree//l10n_br_account_invoice_merge>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions l10n_br_account_invoice_merge/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions l10n_br_account_invoice_merge/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2023 - TODAY, Escodoo
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "L10n Br Account Invoice Merge",
"summary": """
L10n BR Account Invoice Merge""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Escodoo,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"depends": [
"account_invoice_merge",
"l10n_br_account",
],
"data": [],
"demo": [],
}
1 change: 1 addition & 0 deletions l10n_br_account_invoice_merge/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move
63 changes: 63 additions & 0 deletions l10n_br_account_invoice_merge/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2023 - TODAY, Marcel Savegnago <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, models


class AccountMove(models.Model):

_inherit = "account.move"

@api.model
def _get_invoice_key_cols_out(self):
result = super()._get_invoice_key_cols_out()
result.append("document_type_id")
result.append("fiscal_operation_id")
return result

@api.model
def _get_invoice_key_cols_in(self):
result = super()._get_invoice_key_cols_in()
result.append("document_type_id")
result.append("fiscal_operation_id")
return result

@api.model
def _get_invoice_line_key_cols(self):
result = super()._get_invoice_line_key_cols()
result.append("document_type_id")
result.append("fiscal_operation_id")
result.append("fiscal_operation_line_id")
result.append("fiscal_operation_type")
result.append("fiscal_product_id")
result.append("fiscal_tax_ids")
result.append("fiscal_genre_id")
result.append("cfop_id")
result.append("ncm_id")
return result

@api.model
def _get_first_invoice_fields(self, invoice):
result = super()._get_first_invoice_fields(invoice)
result["document_type_id"] = (invoice.document_type_id.id,)
result["fiscal_operation_id"] = (invoice.fiscal_operation_id.id,)
return result

def do_merge(
self, keep_references=True, date_invoice=False, remove_empty_invoice_lines=True
):
result = super().do_merge(
keep_references=keep_references,
date_invoice=date_invoice,
remove_empty_invoice_lines=remove_empty_invoice_lines,
)

domain = [("id", "in", list(result.keys()))]
invoices = self.search(domain)

for invoice in invoices:
move = invoice.with_context({"check_move_validity": False})
move.line_ids.filtered("exclude_from_invoice_tab").unlink()
move._move_autocomplete_invoice_lines_values()

return result
3 changes: 3 additions & 0 deletions l10n_br_account_invoice_merge/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Escodoo <https://www.escodoo.com.br>`_:

* Marcel Savegnago <[email protected]>
Empty file.
Empty file.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d66eaf2

Please sign in to comment.