mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] account_check_deposit to v16
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# Copyright 2012-2021 Akretion France (http://www.akretion.com/)
|
||||
# Copyright 2012-2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
# @author: Chafique DELLI <chafique.delli@akretion.com>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# Copyright 2018-2021 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2018-2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
"name": "Account Check Deposit",
|
||||
"version": "15.0.1.0.0",
|
||||
"version": "16.0.1.0.0",
|
||||
"category": "Accounting",
|
||||
"license": "AGPL-3",
|
||||
"summary": "Manage deposit of checks to the bank",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2012-2020 Akretion France (http://www.akretion.com/)
|
||||
Copyright 2012-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Copyright 2012-2021 Akretion (http://www.akretion.com/)
|
||||
# Copyright 2012-2022 Akretion (http://www.akretion.com/)
|
||||
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
# @author: Chafique DELLI <chafique.delli@akretion.com>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author: Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
|
||||
# Copyright 2018-2021 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2018-2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
@@ -118,7 +118,7 @@ class AccountCheckDeposit(models.Model):
|
||||
def _compute_check_deposit(self):
|
||||
rg_res = self.env["account.move.line"].read_group(
|
||||
[("check_deposit_id", "in", self.ids)],
|
||||
["check_deposit_id", "debit", "amount_currency"],
|
||||
["check_deposit_id", "amount_currency:sum", "debit:sum"],
|
||||
["check_deposit_id"],
|
||||
)
|
||||
mapped_data = {
|
||||
@@ -138,7 +138,7 @@ class AccountCheckDeposit(models.Model):
|
||||
else:
|
||||
total = mapped_data.get(deposit.id, {"debit": 0.0})["debit"]
|
||||
count = mapped_data.get(deposit.id, {"count": 0})["count"]
|
||||
deposit.total_amount = total
|
||||
deposit.total_amount = deposit.currency_id.round(total)
|
||||
deposit.check_count = count
|
||||
|
||||
@api.depends("journal_id")
|
||||
@@ -164,7 +164,7 @@ class AccountCheckDeposit(models.Model):
|
||||
res["bank_journal_id"] = bank_journals.id
|
||||
return res
|
||||
|
||||
@api.constrains("currency_id", "check_payment_ids", "company_id")
|
||||
@api.constrains("currency_id", "check_payment_ids")
|
||||
def _check_deposit(self):
|
||||
for deposit in self:
|
||||
deposit_currency = deposit.currency_id
|
||||
@@ -190,7 +190,7 @@ class AccountCheckDeposit(models.Model):
|
||||
"The deposit '%s' is in valid state, so you must "
|
||||
"cancel it before deleting it."
|
||||
)
|
||||
% deposit.name
|
||||
% deposit.display_name
|
||||
)
|
||||
return super().unlink()
|
||||
|
||||
@@ -206,17 +206,17 @@ class AccountCheckDeposit(models.Model):
|
||||
line.remove_move_reconcile()
|
||||
move.unlink()
|
||||
deposit.write({"state": "draft"})
|
||||
return True
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if "company_id" in vals:
|
||||
self = self.with_company(vals["company_id"])
|
||||
if vals.get("name", "/") == "/":
|
||||
vals["name"] = self.env["ir.sequence"].next_by_code(
|
||||
"account.check.deposit", vals.get("deposit_date")
|
||||
)
|
||||
return super().create(vals)
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for vals in vals_list:
|
||||
if "company_id" in vals:
|
||||
self = self.with_company(vals["company_id"])
|
||||
if vals.get("name", "/") == "/":
|
||||
vals["name"] = self.env["ir.sequence"].next_by_code(
|
||||
"account.check.deposit", vals.get("deposit_date")
|
||||
)
|
||||
return super().create(vals_list)
|
||||
|
||||
def _prepare_account_move_vals(self):
|
||||
self.ensure_one()
|
||||
@@ -293,7 +293,6 @@ class AccountCheckDeposit(models.Model):
|
||||
deposit.write({"state": "done", "move_id": move.id})
|
||||
for reconcile_lines in to_reconcile_lines:
|
||||
reconcile_lines.reconcile()
|
||||
return True
|
||||
|
||||
@api.onchange("company_id")
|
||||
def onchange_company_id(self):
|
||||
@@ -317,7 +316,7 @@ class AccountCheckDeposit(models.Model):
|
||||
|
||||
def get_report(self):
|
||||
report = self.env.ref("account_check_deposit.report_account_check_deposit")
|
||||
action = report.report_action(self)
|
||||
action = report.with_context(discard_logo_check=True).report_action(self)
|
||||
return action
|
||||
|
||||
def get_all_checks(self):
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# Copyright 2012-2021 Akretion France (http://www.akretion.com/)
|
||||
# Copyright 2012-2022 Akretion France (http://www.akretion.com/)
|
||||
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
# @author: Chafique DELLI <chafique.delli@akretion.com>
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# @author: Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
|
||||
# Copyright 2018-2021 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2018-2022 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (C) 2014-2020 Akretion France (http://www.akretion.com/)
|
||||
Copyright 2014-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __manifest__.py
|
||||
-->
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (C) 2014-2019 Akretion (www.akretion.com)
|
||||
Copyright 2014-2022 Akretion France (www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __manifest__.py
|
||||
-->
|
||||
@@ -31,7 +31,7 @@
|
||||
<h3>Beneficiary:</h3>
|
||||
<div
|
||||
t-field="o.company_id.partner_id"
|
||||
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone", "email"], "no_marker": true, "phone_icons": True}'
|
||||
/>
|
||||
<p>
|
||||
<b>Bank Account Number to Credit:</b>
|
||||
@@ -56,15 +56,15 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Reference</th>
|
||||
<th>Debtor</th>
|
||||
<th class="text-start">Reference</th>
|
||||
<th class="text-start">Debtor</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="o.check_payment_ids" t-as="move_line">
|
||||
<tr>
|
||||
<td>
|
||||
<td class="text-center">
|
||||
<span t-field="move_line.date" />
|
||||
</td>
|
||||
<td>
|
||||
@@ -73,21 +73,17 @@
|
||||
<td>
|
||||
<span t-field="move_line.partner_id.name" />
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-end">
|
||||
<t
|
||||
t-if="o.currency_id == o.company_id.currency_id"
|
||||
>
|
||||
<span
|
||||
t-field="move_line.debit"
|
||||
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'
|
||||
/>
|
||||
<span t-field="move_line.debit" />
|
||||
</t>
|
||||
<t
|
||||
t-if="o.currency_id != o.company_id.currency_id"
|
||||
>
|
||||
<span
|
||||
t-field="move_line.amount_currency"
|
||||
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'
|
||||
/>
|
||||
</t>
|
||||
</td>
|
||||
@@ -96,15 +92,12 @@
|
||||
<tr>
|
||||
<td />
|
||||
<td />
|
||||
<td>
|
||||
<td class="text-end">
|
||||
<b>Total:</b>
|
||||
</td>
|
||||
<td>
|
||||
<td class="text-end">
|
||||
<b>
|
||||
<span
|
||||
t-field="o.total_amount"
|
||||
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'
|
||||
/>
|
||||
<span t-field="o.total_amount" />
|
||||
</b>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright (C) 2012-2021 Akretion France (http://www.akretion.com/)
|
||||
Copyright (C) 2012-2022 Akretion France (http://www.akretion.com/)
|
||||
@author: Benoît GUILLOT <benoit.guillot@akretion.com>
|
||||
@author: Chafique DELLI <chafique.delli@akretion.com>
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
Copyright 2018-2021 Tecnativa - Pedro M. Baeza
|
||||
Copyright 2018-2022 Tecnativa - Pedro M. Baeza
|
||||
-->
|
||||
<odoo>
|
||||
<record id="account_check_deposit_view_form" model="ir.ui.view">
|
||||
@@ -52,12 +52,17 @@
|
||||
name="deposit_date"
|
||||
options="{'datepicker': {'warn_future': true}}"
|
||||
/>
|
||||
<field name="journal_id" />
|
||||
<field name="journal_id" options="{'no_create': True}" />
|
||||
<field
|
||||
name="currency_id"
|
||||
groups="base.group_multi_currency"
|
||||
options="{'no_open': True, 'no_create': True}"
|
||||
/>
|
||||
<field name="bank_journal_id" widget="selection" />
|
||||
<field
|
||||
name="bank_journal_id"
|
||||
options="{'no_create': True}"
|
||||
/>
|
||||
<field name="currency_id" invisible="1" />
|
||||
</group>
|
||||
<group name="right">
|
||||
<field name="check_count" />
|
||||
@@ -66,14 +71,17 @@
|
||||
<field
|
||||
name="company_id"
|
||||
groups="base.group_multi_company"
|
||||
options="{'no_open': True, 'no_create': True}"
|
||||
/>
|
||||
<field name="move_id" />
|
||||
<field name="company_id" invisible="1" />
|
||||
</group>
|
||||
</group>
|
||||
<group string="Check Payments" name="check_payments">
|
||||
<field
|
||||
name="check_payment_ids"
|
||||
nolabel="1"
|
||||
colspan="2"
|
||||
widget="many2many"
|
||||
domain="[('reconciled', '=', False),
|
||||
('debit', '>', 0),
|
||||
@@ -132,7 +140,11 @@
|
||||
groups="base.group_multi_currency"
|
||||
optional="show"
|
||||
/>
|
||||
<field name="company_id" groups="base.group_multi_company" />
|
||||
<field
|
||||
name="company_id"
|
||||
groups="base.group_multi_company"
|
||||
optional="show"
|
||||
/>
|
||||
<field
|
||||
name="state"
|
||||
widget="badge"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!--
|
||||
Copyright 2015-2020 Akretion France - Alexis de Lattre
|
||||
Copyright 2018-2020 Tecnativa - Pedro M. Baeza
|
||||
Copyright 2015-2022 Akretion France - Alexis de Lattre
|
||||
Copyright 2018-2022 Tecnativa - Pedro M. Baeza
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
@@ -9,7 +9,7 @@
|
||||
<field name="model">account.move.line</field>
|
||||
<field name="inherit_id" ref="account.view_move_line_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="statement_id" position="after">
|
||||
<field name="statement_line_id" position="after">
|
||||
<field
|
||||
name="check_deposit_id"
|
||||
readonly="True"
|
||||
|
||||
Reference in New Issue
Block a user