Skip to content

Commit

Permalink
[FIX] rma_sale: set payment_term from order
Browse files Browse the repository at this point in the history
  • Loading branch information
mt-software-de committed Aug 25, 2023
1 parent 0c10bdf commit cefc054
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
16 changes: 10 additions & 6 deletions rma_sale/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
Return Merchandise Authorization Management - Link with Sales
=============================================================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2a6959fc8bc5fac3e9535b55c4f5ef4d2781e1d60e95730c84b1cc802dfdde74
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
:target: https://odoo-community.org/page/development-status
Expand All @@ -19,11 +22,11 @@ Return Merchandise Authorization Management - Link with Sales
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/rma-14-0/rma-14-0-rma_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/145/14.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/rma&target_branch=14.0
:alt: Try me on Runboat

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

This module allows you to link a sales order to an RMA.
This can be done by creating an RMA from scratch and selecting the sales
Expand Down Expand Up @@ -78,7 +81,7 @@ Bug Tracker

Bugs are tracked on `GitHub Issues <https://github.com/OCA/rma/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
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/rma/issues/new?body=module:%20rma_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.
Expand All @@ -103,6 +106,7 @@ Contributors

* Chafique Delli <chafique.delli@akretion.com>
* Giovanni Serra - Ooops <giovanni@ooops404.com>
* Michael Tietz (MT Software) <mtietz@mt-software.de>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 2 additions & 0 deletions rma_sale/models/rma.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# Copyright 2023 Michael Tietz (MT Software) <mtietz@mt-software.de>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import api, fields, models
Expand Down Expand Up @@ -94,6 +95,7 @@ def _prepare_refund(self, invoice_form, origin):
res = super()._prepare_refund(invoice_form, origin)
if self.order_id:
invoice_form.invoice_user_id = self.order_id.user_id
invoice_form.invoice_payment_term_id = self.order_id.payment_term_id
return res

def _get_refund_line_price_unit(self):
Expand Down
1 change: 1 addition & 0 deletions rma_sale/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

* Chafique Delli <chafique.delli@akretion.com>
* Giovanni Serra - Ooops <giovanni@ooops404.com>
* Michael Tietz (MT Software) <mtietz@mt-software.de>
9 changes: 6 additions & 3 deletions rma_sale/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Return Merchandise Authorization Management - Link with Sales</title>
<style type="text/css">

Expand Down Expand Up @@ -366,8 +366,10 @@ <h1 class="title">Return Merchandise Authorization Management - Link with Sales<
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:2a6959fc8bc5fac3e9535b55c4f5ef4d2781e1d60e95730c84b1cc802dfdde74
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/rma/tree/14.0/rma_sale"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-14-0/rma-14-0-rma_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/145/14.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="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.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/rma/tree/14.0/rma_sale"><img alt="OCA/rma" src="https://img.shields.io/badge/github-OCA%2Frma-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/rma-14-0/rma-14-0-rma_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://runboat.odoo-community.org/builds?repo=OCA/rma&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows you to link a sales order to an RMA.
This can be done by creating an RMA from scratch and selecting the sales
order, creating one or more RMAs from a sales order form view or from a sales
Expand Down Expand Up @@ -429,7 +431,7 @@ <h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/rma/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
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/rma/issues/new?body=module:%20rma_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>
Expand All @@ -453,6 +455,7 @@ <h2><a class="toc-backref" href="#id6">Contributors</a></h2>
</li>
<li>Chafique Delli &lt;<a class="reference external" href="mailto:chafique.delli&#64;akretion.com">chafique.delli&#64;akretion.com</a>&gt;</li>
<li>Giovanni Serra - Ooops &lt;<a class="reference external" href="mailto:giovanni&#64;ooops404.com">giovanni&#64;ooops404.com</a>&gt;</li>
<li>Michael Tietz (MT Software) &lt;<a class="reference external" href="mailto:mtietz&#64;mt-software.de">mtietz&#64;mt-software.de</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
3 changes: 3 additions & 0 deletions rma_sale/tests/test_rma_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def setUpClass(cls):
cls._partner_portal_wizard(cls, cls.partner)
order_form = Form(cls.sale_order)
order_form.partner_id = cls.partner
cls.payment_term = cls.env.ref("account.account_payment_term_immediate")
order_form.payment_term_id = cls.payment_term
with order_form.order_line.new() as line_form:
line_form.product_id = cls.product_1
line_form.product_uom_qty = 5
Expand Down Expand Up @@ -96,6 +98,7 @@ def test_create_rma_from_so(self):
rma.reception_move_id.picking_id._action_done()
rma.action_refund()
self.assertEqual(rma.refund_id.user_id, user)
self.assertEqual(rma.refund_id.invoice_payment_term_id, self.payment_term)

@users("partner@rma")
def test_create_rma_from_so_portal_user(self):
Expand Down

0 comments on commit cefc054

Please sign in to comment.