Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][ADD] l10n_ro_balance_confirmation #225

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions l10n_ro_balance_confirmation/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Romania - balance confirmation
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:980ec25c659bc3a7926089b5c0586497c4df2ec066bd240e290de549b6ff9a4c
!! source digest: sha256:20cee33e951f097c27d52209f683570d733c019db9dd918a20f8233d5f4e0423
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -16,19 +16,13 @@ Romania - balance confirmation
.. |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%2Fl10n--romania-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-romania/tree/16.0/l10n_ro_balance_confirmation
:alt: OCA/l10n-romania
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-romania-16-0/l10n-romania-16-0-l10n_ro_balance_confirmation
: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-romania&target_branch=16.0
:alt: Try me on Runboat
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fl10n--romania-lightgray.png?logo=github
:target: https://github.com/dhongu/l10n-romania/tree/16.0/l10n_ro_balance_confirmation
:alt: dhongu/l10n-romania

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

Generare formular de confirmare de sold
Generare formular de confirmare de sold la data (Tipariti->Confirmare sold)

**Table of contents**

Expand All @@ -38,10 +32,10 @@ Generare formular de confirmare de sold
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-romania/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/dhongu/l10n-romania/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-romania/issues/new?body=module:%20l10n_ro_balance_confirmation%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/dhongu/l10n-romania/issues/new?body=module:%20l10n_ro_balance_confirmation%0Aversion:%2016.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 All @@ -68,24 +62,14 @@ Do not contact contributors directly about support or help with technical issues
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.

.. |maintainer-danila12| image:: https://github.com/danila12.png?size=40px
:target: https://github.com/danila12
:alt: danila12

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
Current maintainer:

|maintainer-danila12|

This module is part of the `OCA/l10n-romania <https://github.com/OCA/l10n-romania/tree/16.0/l10n_ro_balance_confirmation>`_ project on GitHub.
This module is part of the `dhongu/l10n-romania <https://github.com/dhongu/l10n-romania/tree/16.0/l10n_ro_balance_confirmation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
You are welcome to contribute.
4 changes: 4 additions & 0 deletions l10n_ro_balance_confirmation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# © 2008-2022 Terrabit
# See README.rst file on addons root folder for license details

from . import wizard
from . import report
from . import models
9 changes: 7 additions & 2 deletions l10n_ro_balance_confirmation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Romania - balance confirmation",
"version": "15.0.0.0.4",
"version": "16.0.0.0.5",
"category": "Localization",
"summary": "Generate balance confirmation for partners",
"author": "Dan Stoica," "Odoo Community Association (OCA)",
Expand All @@ -11,6 +11,11 @@
"l10n_ro_config",
],
"license": "AGPL-3",
"data": ["views/res_partner_balance.xml"],
"data": [
"views/res_partner_balance.xml",
"wizard/confirm_balance.xml",
"security/groups.xml",
"security/ir.model.access.csv",
],
"maintainers": ["danila12"],
}
91 changes: 88 additions & 3 deletions l10n_ro_balance_confirmation/i18n/ro.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-17 10:17+0000\n"
"PO-Revision-Date: 2022-08-17 10:17+0000\n"
"POT-Creation-Date: 2022-11-29 06:45+0000\n"
"PO-Revision-Date: 2022-11-29 06:45+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -92,6 +92,26 @@ msgid ""
"<span>b) Urmează să efectuăm plata în termen de ____________________</span>"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.view_ballance_confirmation_form
msgid "Balance Confirmation"
msgstr "Confirmare sold"

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__l10n_ro_balance_date
msgid "Balance confirmation at"
msgstr "Confirmare sold la data"

#. module: l10n_ro_balance_confirmation
#: model:res.groups,name:l10n_ro_balance_confirmation.group_print_balance
msgid "Can print partner balance confirmation"
msgstr "Poate tipari confirmare sold"

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.view_ballance_confirmation_form
msgid "Cancel"
msgstr "Anulează"

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid "Company address:"
Expand Down Expand Up @@ -136,26 +156,86 @@ msgid ""
" figurează cu următoarele credite:"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model,name:l10n_ro_balance_confirmation.model_res_partner
msgid "Contact"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__create_uid
msgid "Created by"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__create_date
msgid "Created on"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__display_name
msgid "Display Name"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid "EXTRAS DE CONT"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__id
msgid "ID"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid "Issuer:"
msgstr "Unitatea debitoare: "

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid "LA DATA:"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog____last_update
msgid "Last Modified on"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__write_uid
msgid "Last Updated by"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.model.fields,field_description:l10n_ro_balance_confirmation.field_l10n_ro_balance_confirm_dialog__write_date
msgid "Last Updated on"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model:ir.actions.report,name:l10n_ro_balance_confirmation.action_report_partner_balance
msgid "Partner balance"
msgstr "Confirmare sold"

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.view_ballance_confirmation_form
msgid "Print"
msgstr "Tipărire"

#. module: l10n_ro_balance_confirmation
#: model:ir.actions.act_window,name:l10n_ro_balance_confirmation.action_balance_confirmation
msgid "Print balance"
msgstr "Confirmare sold"

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid "Registration number at the Registry of Commerce:"
msgstr "Nr. de înmatriculare la Oficiul Registrului Comerțului: "

#. module: l10n_ro_balance_confirmation
#: model:ir.model,name:l10n_ro_balance_confirmation.model_report_l10n_ro_balance_confirmation_report_partner_balance
msgid "ReportPartnerBalance"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid ""
Expand All @@ -175,6 +255,11 @@ msgstr "Către: "
msgid "VAT:"
msgstr "CIF: "

#. module: l10n_ro_balance_confirmation
#: model:ir.model,name:l10n_ro_balance_confirmation.model_l10n_ro_balance_confirm_dialog
msgid "Wizard for date input for balance confirmation"
msgstr ""

#. module: l10n_ro_balance_confirmation
#: model_terms:ir.ui.view,arch_db:l10n_ro_balance_confirmation.report_partner_balance_document
msgid ""
Expand All @@ -183,4 +268,4 @@ msgid ""
" dumneavoastră.\n"
" <br/>\n"
" Prezentul extras de cont ține cont de conciliere conform procedurii arbitrale."
msgstr ""
msgstr ""
4 changes: 4 additions & 0 deletions l10n_ro_balance_confirmation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2008-2022 Terrabit
# See README.rst file on addons root folder for license details

from . import res_partner
59 changes: 59 additions & 0 deletions l10n_ro_balance_confirmation/models/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# © 2008-now Terrabit <office(@)terrabit(.)ro
# See README.rst file on addons root folder for license details


from odoo import models


class ResPartner(models.Model):
_inherit = "res.partner"

def _credit_debit_get(self):
date = self.env.context.get("date_to")
if not date:
return super()._credit_debit_get()
else:
# cautat prin codul sursa si am gasit versiunea asta
domain = [
("parent_state", "=", "posted"),
("company_id", "=", self.env.company.id),
("date", "<=", date),
]
query = self.env["account.move.line"]._where_calc(domain)
tables, where_clause, where_params = query.get_sql()
where_params = [tuple(self.ids)] + where_params

if where_clause:
where_clause = "AND " + where_clause

# am modificat dupa cum o zis dorin si ce am mai cautat eu prin cod
self._cr.execute(
f"""
SELECT account_move_line.partner_id, a.account_type,
SUM(account_move_line.debit - account_move_line.credit)
FROM {tables}
LEFT JOIN account_account a ON (account_move_line.account_id = a.id)
WHERE a.account_type IN ('asset_receivable', 'liability_payable')
AND account_move_line.partner_id IN %s
{where_clause}
GROUP BY account_move_line.partner_id, a.account_type
""",
where_params,
)

treated = self.browse()
for pid, account_type, val in self._cr.fetchall():
partner = self.browse(pid)
if account_type == "asset_receivable":
partner.credit = val
if partner not in treated:
partner.debit = False
treated |= partner
elif account_type == "liability_payable":
partner.debit = -val
if partner not in treated:
partner.credit = False
treated |= partner
remaining = self - treated
remaining.debit = False
remaining.credit = False
2 changes: 1 addition & 1 deletion l10n_ro_balance_confirmation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Generare formular de confirmare de sold
Generare formular de confirmare de sold la data (Tipariti->Confirmare sold)
4 changes: 4 additions & 0 deletions l10n_ro_balance_confirmation/report/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2008-2022 Terrabit
# See README.rst file on addons root folder for license details

from . import res_partner
23 changes: 23 additions & 0 deletions l10n_ro_balance_confirmation/report/res_partner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# © 2008-now Terrabit <office(@)terrabit(.)ro
# See README.rst file on addons root folder for license details


from odoo import api, models


class ReportPartnerBalance(models.AbstractModel):
_name = "report.l10n_ro_balance_confirmation.report_partner_balance"
_description = "ReportPartnerBalance"
_template = "l10n_ro_balance_confirmation.report_partner_balance"

@api.model
def _get_report_values(self, docids, data=None):
report = self.env["ir.actions.report"]._get_report_from_name(self._template)
if not docids:
docids = self.env.context.get("active_ids")
return {
"doc_ids": docids,
"doc_model": report.model,
"data": data,
"docs": self.env[report.model].browse(docids),
}
13 changes: 13 additions & 0 deletions l10n_ro_balance_confirmation/security/groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data>
<record id="group_print_balance" model="res.groups">
<field name="name">Can print partner balance confirmation</field>
<field name="category_id" ref="base.module_category_hidden" />
</record>

<record id="base.group_system" model="res.groups">
<field name="implied_ids" eval="[(4, ref('l10n_ro_balance_confirmation.group_print_balance'))]" />
</record>
</data>
</odoo>
2 changes: 2 additions & 0 deletions l10n_ro_balance_confirmation/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_balance_confirmation,access_balance_confirmation,model_l10n_ro_balance_confirm_dialog,l10n_ro_balance_confirmation.group_print_balance,1,1,1,1
Loading