[MIG] account_payment_sale to 14.0

This commit is contained in:
Alexis de Lattre
2020-12-24 10:33:49 +01:00
committed by David Ramia
parent 6f96f10519
commit 74a758c9bd
15 changed files with 120 additions and 74 deletions

View File

@@ -14,13 +14,13 @@ Account Payment Sale
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github
:target: https://github.com/OCA/bank-payment/tree/13.0/account_payment_sale
:target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_sale
:alt: OCA/bank-payment
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/bank-payment-13-0/bank-payment-13-0-account_payment_sale
:target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/173/13.0
:target: https://runbot.odoo-community.org/runbot/173/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -29,11 +29,6 @@ This modules adds one field on sale orders: *Payment Mode*.
This field is copied from customer to sale order and then from sale order to
customer invoice.
This module is similar to the *sale_payment* module; the main difference is
that it doesn't depend on the *account_payment_extension* module (it's not the
only module to conflict with *account_payment_extension*; all the SEPA
modules in the banking addons conflict with *account_payment_extension*.
**Table of contents**
.. contents::
@@ -43,8 +38,8 @@ Usage
=====
You are able to add a payment mode directly on a partner.
This payment mode is automatically associated to the sale order, then on related invoice.
This default value can be changed in a draft sale order or draft invoice.
This payment mode is automatically associated to the sale order, then copied to the related invoice.
This default value can be changed sale orders or on draft invoices.
Bug Tracker
===========
@@ -52,7 +47,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/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/bank-payment/issues/new?body=module:%20account_payment_sale%0Aversion:%2013.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_sale%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.
@@ -88,6 +83,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/bank-payment <https://github.com/OCA/bank-payment/tree/13.0/account_payment_sale>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/14.0/account_payment_sale>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -4,7 +4,7 @@
{
"name": "Account Payment Sale",
"version": "13.0.1.1.1",
"version": "14.0.1.0.0",
"category": "Banking addons",
"license": "AGPL-3",
"summary": "Adds payment mode on sale orders",

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"
@@ -19,8 +19,21 @@ msgid "<strong>Payment Mode:</strong>"
msgstr ""
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_account_move
msgid "Journal Entries"
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name
msgid "Display Name"
msgstr ""
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id
msgid "ID"
msgstr ""
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""
#. module: account_payment_sale

View File

@@ -25,8 +25,21 @@ msgid "<strong>Payment Mode:</strong>"
msgstr "<strong>Mode de pagament:</strong>"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_account_move
msgid "Journal Entries"
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name
msgid "Display Name"
msgstr ""
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id
msgid "ID"
msgstr ""
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update
msgid "Last Modified on"
msgstr ""
#. module: account_payment_sale

View File

@@ -0,0 +1,55 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_payment_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-10 14:50+0000\n"
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n"
"Language-Team: none\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: account_payment_sale
#: model_terms:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode
msgid "<strong>Payment Mode:</strong>"
msgstr "<strong>Mode de paiement:</strong>"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__display_name
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv__id
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__id
msgid "ID"
msgstr ""
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_advance_payment_inv____last_update
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order____last_update
msgid "Last Modified on"
msgstr "Dernière modification"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__payment_mode_id
msgid "Payment Mode"
msgstr "Mode de paiement"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_advance_payment_inv
msgid "Sales Advance Payment Invoice"
msgstr "Facture d'acompte"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_sale_order
msgid "Sales Order"
msgstr "Commande"

View File

@@ -9,14 +9,15 @@ msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-02 03:43+0000\n"
"PO-Revision-Date: 2018-02-02 03:43+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2018\n"
"PO-Revision-Date: 2021-04-22 18:47+0000\n"
"Last-Translator: Bosd <c5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>\n"
"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: account_payment_sale
#: model_terms:ir.ui.view,arch_db:account_payment_sale.report_sale_payment_mode
@@ -26,7 +27,7 @@ msgstr "<strong>Betaalmode:</strong>"
#. module: account_payment_sale
#: model:ir.model,name:account_payment_sale.model_account_move
msgid "Journal Entries"
msgstr ""
msgstr "Boekingen"
#. module: account_payment_sale
#: model:ir.model.fields,field_description:account_payment_sale.field_sale_order__payment_mode_id

View File

@@ -1,2 +1 @@
from . import account_move
from . import sale_order

View File

@@ -1,19 +0,0 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class AccountMove(models.Model):
_inherit = "account.move"
@api.model
def create(self, vals_list):
if vals_list.get("payment_mode_id"):
payment_mode = self.env["account.payment.mode"].browse(
vals_list["payment_mode_id"]
)
if payment_mode.bank_account_link == "fixed":
vals_list[
"invoice_partner_bank_id"
] = payment_mode.fixed_journal_id.bank_account_id.id
return super().create(vals_list)

View File

@@ -1,4 +1,4 @@
# Copyright 2014-2016 Akretion - Alexis de Lattre
# Copyright 2014-2020 Akretion - Alexis de Lattre
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
@@ -12,7 +12,8 @@ class SaleOrder(models.Model):
compute="_compute_payment_mode",
store=True,
readonly=False,
domain=[("payment_type", "=", "inbound")],
check_company=True,
domain="[('payment_type', '=', 'inbound'), ('company_id', '=', company_id)]",
)
@api.depends("partner_id")
@@ -31,11 +32,11 @@ class SaleOrder(models.Model):
and self.payment_mode_id.payment_method_id.code == "manual"
):
vals[
"invoice_partner_bank_id"
"partner_bank_id"
] = self.payment_mode_id.fixed_journal_id.bank_account_id.id
return vals
def _prepare_invoice(self):
"""Copy bank partner from sale order to invoice"""
vals = super()._prepare_invoice()
return self._get_payment_mode_vals(vals)
self._get_payment_mode_vals(vals)
return vals

View File

@@ -1,8 +1,3 @@
This modules adds one field on sale orders: *Payment Mode*.
This field is copied from customer to sale order and then from sale order to
customer invoice.
This module is similar to the *sale_payment* module; the main difference is
that it doesn't depend on the *account_payment_extension* module (it's not the
only module to conflict with *account_payment_extension*; all the SEPA
modules in the banking addons conflict with *account_payment_extension*.

View File

@@ -1,3 +1,3 @@
You are able to add a payment mode directly on a partner.
This payment mode is automatically associated to the sale order, then on related invoice.
This default value can be changed in a draft sale order or draft invoice.
This payment mode is automatically associated to the sale order, then copied to the related invoice.
This default value can be changed sale orders or on draft invoices.

View File

@@ -367,14 +367,10 @@ 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/bank-payment/tree/13.0/account_payment_sale"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-13-0/bank-payment-13-0-account_payment_sale"><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/173/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/bank-payment/tree/14.0/account_payment_sale"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_sale"><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/173/14.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This modules adds one field on sale orders: <em>Payment Mode</em>.
This field is copied from customer to sale order and then from sale order to
customer invoice.</p>
<p>This module is similar to the <em>sale_payment</em> module; the main difference is
that it doesnt depend on the <em>account_payment_extension</em> module (its not the
only module to conflict with <em>account_payment_extension</em>; all the SEPA
modules in the banking addons conflict with <em>account_payment_extension</em>.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -391,15 +387,15 @@ modules in the banking addons conflict with <em>account_payment_extension</em>.<
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>You are able to add a payment mode directly on a partner.
This payment mode is automatically associated to the sale order, then on related invoice.
This default value can be changed in a draft sale order or draft invoice.</p>
This payment mode is automatically associated to the sale order, then copied to the related invoice.
This default value can be changed sale orders or on draft invoices.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/bank-payment/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/bank-payment/issues/new?body=module:%20account_payment_sale%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/bank-payment/issues/new?body=module:%20account_payment_sale%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">
@@ -429,7 +425,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/bank-payment/tree/13.0/account_payment_sale">OCA/bank-payment</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/bank-payment/tree/14.0/account_payment_sale">OCA/bank-payment</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

@@ -39,7 +39,7 @@ class TestSaleOrder(CommonTestCase):
invoice = order.invoice_ids
self.assertEqual(len(invoice), 1)
self.assertEqual(invoice.payment_mode_id, expected_payment_mode)
self.assertEqual(invoice.invoice_partner_bank_id, expected_partner_bank)
self.assertEqual(invoice.partner_bank_id, expected_partner_bank)
def test_sale_to_invoice_payment_mode(self):
"""
@@ -95,4 +95,4 @@ class TestSaleOrder(CommonTestCase):
invoice = order.invoice_ids
self.assertEqual(len(invoice), 1)
self.assertEqual(invoice.payment_mode_id, self.payment_mode_2)
self.assertEqual(invoice.invoice_partner_bank_id, self.bank)
self.assertEqual(invoice.partner_bank_id, self.bank)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
© 2014-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
Copyright 2014-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
@@ -12,7 +12,6 @@
<field name="payment_term_id" position="after">
<field
name="payment_mode_id"
domain="[('payment_type', '=', 'inbound')]"
options="{'no_open': True, 'no_create': True}"
/>
</field>

View File

@@ -1,4 +1,4 @@
# Copyright 2016 Akretion - Alexis de Lattre
# Copyright 2016-2020 Akretion - Alexis de Lattre
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
@@ -7,10 +7,8 @@ from odoo import models
class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"
def _create_invoice(self, order, so_line, amount):
def _prepare_invoice_values(self, order, name, amount, so_line):
"""Copy payment mode from sale order to invoice"""
inv = super()._create_invoice(order, so_line, amount)
vals = order._get_payment_mode_vals({})
if vals:
inv.write(vals)
return inv
vals = super()._prepare_invoice_values(order, name, amount, so_line)
order._get_payment_mode_vals(vals)
return vals