2
0

[MIG] account_netting to v14

[UPD] README.rst
This commit is contained in:
Alexis de Lattre 2020-11-26 15:23:56 +01:00
parent 17b9c08afc
commit 39a011db15
8 changed files with 79 additions and 37 deletions

View File

@ -14,13 +14,13 @@ Account netting
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github
:target: https://github.com/OCA/account-financial-tools/tree/13.0/account_netting
:target: https://github.com/OCA/account-financial-tools/tree/14.0/account_netting
:alt: OCA/account-financial-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_netting
:target: https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_netting
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/92/13.0
:target: https://runbot.odoo-community.org/runbot/92/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -61,7 +61,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_netting%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_netting%0Aversion:%2014.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.
@ -92,6 +92,6 @@ 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/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/13.0/account_netting>`_ project on GitHub.
This module is part of the `OCA/account-financial-tools <https://github.com/OCA/account-financial-tools/tree/14.0/account_netting>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -4,13 +4,16 @@
{
"name": "Account netting",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"summary": "Compensate AR/AP accounts from the same partner",
"category": "Accounting & Finance",
"author": "Tecnativa, " "Odoo Community Association (OCA)",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/account-financial-tools/",
"website": "https://github.com/OCA/account-financial-tools",
"depends": ["account"],
"data": ["wizards/account_move_make_netting_view.xml"],
"data": [
"security/ir.model.access.csv",
"wizards/account_move_make_netting_view.xml",
],
"installable": True,
}

View File

@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@ -121,7 +121,7 @@ msgstr ""
#. module: account_netting
#: model_terms:ir.ui.view,arch_db:account_netting.view_account_move_make_netting_form
msgid ""
"This operation will generate account entries that are counterpart of the "
"This operation will generate journal entries that are counterpart of the "
"receivable/payable accounts selected, and reconcile each other, letting this"
" balance in the partner."
msgstr ""

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_account_move_make_netting,Full access on account.move.make.netting to accountant grp,model_account_move_make_netting,account.group_account_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_account_move_make_netting Full access on account.move.make.netting to accountant grp model_account_move_make_netting account.group_account_user 1 1 1 1

View File

@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_netting"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-13-0/account-financial-tools-13-0-account_netting"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/13.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_netting"><img alt="OCA/account-financial-tools" src="https://img.shields.io/badge/github-OCA%2Faccount--financial--tools-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/account-financial-tools-14-0/account-financial-tools-14-0-account_netting"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/92/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module allows to compensate the balance of a receivable account with the
balance of a payable account for the same partner, creating a journal item
that reflects this operation.</p>
@ -407,7 +407,7 @@ counterparts of the AR/AP operations.</p>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-financial-tools/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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_netting%0Aversion:%2013.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/account-financial-tools/issues/new?body=module:%20account_netting%0Aversion:%2014.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">
@ -432,7 +432,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/13.0/account_netting">OCA/account-financial-tools</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-financial-tools/tree/14.0/account_netting">OCA/account-financial-tools</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>

View File

@ -2,6 +2,8 @@
# Copyright 2017 Tecnativa - Vicent Cubells
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from datetime import datetime
import odoo.tests.common as common
@ -14,6 +16,7 @@ class TestAccountNetting(common.SavepointCase):
cls.env.user.write(
{"groups_id": [(6, 0, [res_users_account_manager.id, partner_manager.id])]}
)
company = cls.env.ref("base.main_company")
# only adviser can create an account
cls.account_receivable = cls.env["account.account"].create(
{
@ -21,6 +24,7 @@ class TestAccountNetting(common.SavepointCase):
"name": "customer account",
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
"reconcile": True,
"company_id": company.id,
}
)
cls.account_payable = cls.env["account.account"].create(
@ -29,6 +33,7 @@ class TestAccountNetting(common.SavepointCase):
"name": "supplier account",
"user_type_id": cls.env.ref("account.data_account_type_payable").id,
"reconcile": True,
"company_id": company.id,
}
)
cls.account_revenue = cls.env["account.account"].search(
@ -37,7 +42,8 @@ class TestAccountNetting(common.SavepointCase):
"user_type_id",
"=",
cls.env.ref("account.data_account_type_revenue").id,
)
),
("company_id", "=", company.id),
],
limit=1,
)
@ -47,7 +53,8 @@ class TestAccountNetting(common.SavepointCase):
"user_type_id",
"=",
cls.env.ref("account.data_account_type_expenses").id,
)
),
("company_id", "=", company.id),
],
limit=1,
)
@ -66,19 +73,35 @@ class TestAccountNetting(common.SavepointCase):
}
)
cls.journal = cls.env["account.journal"].create(
{"name": "Test sale journal", "type": "sale", "code": "TEST"}
{
"name": "Test sale journal",
"type": "sale",
"code": "TEST",
"company_id": company.id,
}
)
cls.expenses_journal = cls.env["account.journal"].create(
{"name": "Test expense journal", "type": "purchase", "code": "EXP"}
{
"name": "Test expense journal",
"type": "purchase",
"code": "EXP",
"company_id": company.id,
}
)
cls.miscellaneous_journal = cls.env["account.journal"].create(
{"name": "Miscellaneus journal", "type": "general", "code": "OTHER"}
{
"name": "Miscellaneus journal",
"type": "general",
"code": "OTHER",
"company_id": company.id,
}
)
cls.customer_invoice = cls.env["account.move"].create(
{
"journal_id": cls.journal.id,
"type": "out_invoice",
"move_type": "out_invoice",
"partner_id": cls.partner.id,
"company_id": company.id,
"invoice_line_ids": [
(
0,
@ -100,8 +123,10 @@ class TestAccountNetting(common.SavepointCase):
cls.supplier_invoice = cls.env["account.move"].create(
{
"journal_id": cls.expenses_journal.id,
"type": "in_invoice",
"move_type": "in_invoice",
"partner_id": cls.partner.id,
"company_id": company.id,
"invoice_date": datetime.now(),
"invoice_line_ids": [
(
0,
@ -126,8 +151,10 @@ class TestAccountNetting(common.SavepointCase):
cls.supplier_invoice = cls.env["account.move"].create(
{
"journal_id": cls.expenses_journal.id,
"type": "in_invoice",
"move_type": "in_invoice",
"partner_id": cls.partner1.id,
"company_id": company.id,
"invoice_date": datetime.now(),
"invoice_line_ids": [
(
0,
@ -149,8 +176,10 @@ class TestAccountNetting(common.SavepointCase):
cls.supplier_invoice = cls.env["account.move"].create(
{
"journal_id": cls.expenses_journal.id,
"type": "in_refund",
"move_type": "in_refund",
"partner_id": cls.partner1.id,
"company_id": company.id,
"invoice_date": datetime.now(),
"invoice_line_ids": [
(
0,
@ -172,8 +201,10 @@ class TestAccountNetting(common.SavepointCase):
cls.supplier_invoice = cls.env["account.move"].create(
{
"journal_id": cls.expenses_journal.id,
"type": "in_refund",
"move_type": "in_refund",
"partner_id": cls.partner1.id,
"company_id": company.id,
"invoice_date": datetime.now(),
"invoice_line_ids": [
(
0,

View File

@ -14,10 +14,11 @@ class AccountMoveMakeNetting(models.TransientModel):
required=True,
domain="[('type', '=', 'general')]",
)
move_line_ids = fields.Many2many(comodel_name="account.move.line",)
balance = fields.Float(readonly=True,)
move_line_ids = fields.Many2many(comodel_name="account.move.line")
balance = fields.Float(readonly=True)
balance_type = fields.Selection(
selection=[("pay", "To pay"), ("receive", "To receive")], readonly=True,
selection=[("pay", "To pay"), ("receive", "To receive")],
readonly=True,
)
@api.model
@ -116,6 +117,7 @@ class AccountMoveMakeNetting(models.TransientModel):
break
if move_lines:
move.write({"line_ids": move_lines})
move.action_post()
# Make reconciliation
for move_line in move.line_ids:
to_reconcile = move_line + self.move_line_ids.filtered(

View File

@ -1,23 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<act_window
name="Compensate"
res_model="account.move.make.netting"
binding_model="account.move.line"
view_mode="form"
target="new"
id="act_account_move_make_netting"
/>
<record id="act_account_move_make_netting" model="ir.actions.act_window">
<field name="name">Compensate</field>
<field name="res_model">account.move.make.netting</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_account_move_line" />
<field name="binding_view_types">list</field>
</record>
<record id="view_account_move_make_netting_form" model="ir.ui.view">
<field name="name">Compensate entries</field>
<field name="model">account.move.make.netting</field>
<field name="arch" type="xml">
<form string="Compensate entries">
<p
>This operation will generate account entries that are counterpart of the receivable/payable accounts selected, and reconcile each other, letting this balance in the partner.</p>
>This operation will generate journal entries that are counterpart of the receivable/payable accounts selected, and reconcile each other, letting this balance in the partner.</p>
<group>
<field name="balance" />
<field name="balance_type" />
<field
name="balance_type"
attrs="{'invisible': [('balance', '=', 0)]}"
/>
<field name="journal_id" />
</group>
<footer>