Skip to content

Commit

Permalink
[MIG] account_invoice_bank_details: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Duy (Đỗ Anh) committed Jun 11, 2024
1 parent 9329d41 commit 32d43ea
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 88 deletions.
23 changes: 10 additions & 13 deletions account_invoice_bank_details/README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
============================
Invoice bank account details
Invoice Bank Account Details
============================

..
Expand Down Expand Up @@ -37,16 +37,6 @@ invoice
.. contents::
:local:

Usage
=====



Known issues / Roadmap
======================



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

Expand All @@ -68,9 +58,16 @@ Authors
Contributors
------------

- `Camptocamp <https://www.camptocamp.com>`__:
- `camptocamp <https://camptocamp.com>`__:
- Vincent Renaville <https://www.camptocamp.com>
- `Trobz <https://trobz.com>`__:
- Do Anh Duy <[email protected]>

Other credits
-------------

- Vincent Renaville
The migration of this module from 13.0 to 17.0 was financially supported
by Camptocamp

Maintainers
-----------
Expand Down
8 changes: 4 additions & 4 deletions account_invoice_bank_details/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"name": "Invoice bank account details",
"name": "Invoice Bank Account Details",
"summary": "Select bank account base on currency + print bank details on report"
"reports and customer portal",
"version": "13.0.1.0.0",
"category": "Sales Management",
"version": "17.0.1.0.0",
"category": "Account",
"website": "https://github.com/OCA/account-invoice-reporting",
"author": "Camptocamp, " "Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["account"],
"data": [
"views/invoice_report_templates.xml",
"report/invoice_report_templates.xml",
],
"application": False,
"installable": True,
Expand Down
38 changes: 22 additions & 16 deletions account_invoice_bank_details/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,26 @@
class AccountMove(models.Model):
_inherit = "account.move"

@api.onchange("currency_id")
def _onchange_currency_id(self):
# try to find bank account by currency
bank = self.env["res.partner.bank"].search(
[
("currency_id", "=", self.currency_id.id),
("partner_id", "=", self.company_id.partner_id.id),
],
limit=1,
)
# if not found take first bank account of the company
if not bank:
bank = self.env["res.partner.bank"].search(
[("partner_id", "=", self.company_id.partner_id.id)], limit=1
)
@api.depends("currency_id", "company_id.partner_id")
def _compute_partner_bank_id(self):
for record in self:
if record.currency_id:
# try to find bank account by currency
partner_bank = self.env["res.partner.bank"].search(
[
("currency_id", "=", self.currency_id.id),
("partner_id", "=", self.company_id.partner_id.id),
],
limit=1,
)

self.invoice_partner_bank_id = bank.id
# if not found take first bank account of the company
if not partner_bank:
partner_bank = self.env["res.partner.bank"].search(
[("partner_id", "=", self.company_id.partner_id.id)], limit=1
)

record.partner_bank_id = partner_bank.id

else:
return super()._compute_partner_bank_id

Check warning on line 32 in account_invoice_bank_details/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_invoice_bank_details/models/account_move.py#L32

Added line #L32 was not covered by tests
6 changes: 4 additions & 2 deletions account_invoice_bank_details/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
- [Camptocamp](https://www.camptocamp.com):
- Vincent Renaville
- [camptocamp](https://camptocamp.com):
- Vincent Renaville \<<https://www.camptocamp.com>\>
- [Trobz](https://trobz.com):
- Do Anh Duy \<<[email protected]>\>
2 changes: 2 additions & 0 deletions account_invoice_bank_details/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The migration of this module from 13.0 to 17.0 was financially supported
by Camptocamp
1 change: 0 additions & 1 deletion account_invoice_bank_details/readme/ROADMAP.md

This file was deleted.

1 change: 0 additions & 1 deletion account_invoice_bank_details/readme/USAGE.md

This file was deleted.

28 changes: 28 additions & 0 deletions account_invoice_bank_details/report/invoice_report_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<template
id="report_invoice_document_bank_details"
inherit_id="account.report_invoice_document"
>

<xpath expr="//span[@id='payment_terms_note_id']" position="after">
<p class="mb-auto text-left">
<strong>Payment information:</strong>
</p>
<p class="mb-auto justify-text">
<strong>Bank:</strong> <span t-field="o.partner_bank_id.bank_name" />
</p>
<p class="mb-auto justify-text">
<strong>BIC / SWIFT:</strong> <span
t-field="o.partner_bank_id.bank_bic"
/>
</p>
<p>
<strong>IBAN:</strong> <span t-field="o.partner_bank_id.acc_number" />
</p>
</xpath>

</template>

</odoo>
46 changes: 22 additions & 24 deletions account_invoice_bank_details/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Invoice bank account details</title>
<title>Invoice Bank Account Details</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -361,7 +361,7 @@
</head>
<body>
<div class="document" id="invoice-bank-account-details">
<h1 class="title">Invoice bank account details</h1>
<h1 class="title">Invoice Bank Account Details</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
Expand All @@ -376,50 +376,48 @@ <h1 class="title">Invoice bank account details</h1>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="toc-entry-1">Usage</a></li>
<li><a class="reference internal" href="#known-issues-roadmap" id="toc-entry-2">Known issues / Roadmap</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
</div>
<div class="section" id="known-issues-roadmap">
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-invoice-reporting/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/account-invoice-reporting/issues/new?body=module:%20account_invoice_bank_details%0Aversion:%2017.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">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.camptocamp.com">Camptocamp</a>:<ul>
<li>Vincent Renaville</li>
</ul>
</li>
<li><a class="reference external" href="https://camptocamp.com">camptocamp</a>:</li>
<li>Vincent Renaville &lt;<a class="reference external" href="https://www.camptocamp.com">https://www.camptocamp.com</a>&gt;</li>
<li><a class="reference external" href="https://trobz.com">Trobz</a>:</li>
<li>Do Anh Duy &lt;<a class="reference external" href="mailto:duyda&#64;trobz.com">duyda&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The migration of this module from 13.0 to 17.0 was financially supported
by Camptocamp</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand Down
27 changes: 0 additions & 27 deletions account_invoice_bank_details/views/invoice_report_templates.xml

This file was deleted.

0 comments on commit 32d43ea

Please sign in to comment.