Skip to content

Commit

Permalink
[14.0][ADD]order_validation_move_line : change name and default_get o…
Browse files Browse the repository at this point in the history
…n create line
  • Loading branch information
syera94 committed Dec 4, 2023
1 parent db77dc0 commit bf4dff7
Show file tree
Hide file tree
Showing 17 changed files with 56 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Account Payment Order Validation on move line
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1e4b6c3b957e58bf49d866a0a3f554c458287d0ca96b04ff3e83db04f6a7d5cc
!! source digest: sha256:8f769ba74e23dd412d6a3714153bf66d3306f8a18f60d21863a90104ddb0497f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
Expand All @@ -17,18 +17,18 @@ Account Payment Order Validation on move line
: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/14.0/account_payment_order_validation_move_line
:target: https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_select_for_payment
: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-14-0/bank-payment-14-0-account_payment_order_validation_move_line
:target: https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_order_select_for_payment
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&target_branch=14.0
:alt: Try me on Runboat

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

This module adds the possibility to choose only validated invoice for the account.payment.line.create and it can be set from theaccount.payment.mode model and account.payment.line.create
On invoices, when you have selected some invoices which can be paid, the module adds the possibility to filter in the payment order, those invoices that have been marked as "To pay".

.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Expand All @@ -46,7 +46,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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_validation_move_line%0Aversion:%2014.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_order_select_for_payment%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 Down Expand Up @@ -77,6 +77,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/14.0/account_payment_order_validation_move_line>`_ project on GitHub.
This module is part of the `OCA/bank-payment <https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_select_for_payment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ class AccountPaymentMode(models.Model):

_inherit = "account.payment.mode"

default_selected_for_payment_id = fields.Boolean(string="To Pay Filter")
default_selected_for_payment = fields.Boolean(string="To Pay Filter")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
On invoices, when you have selected some invoices which can be paid, the module adds the possibility to filter in the payment order, those invoices that have been marked as "To pay".
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@ <h1 class="title">Account Payment Order Validation on move line</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1e4b6c3b957e58bf49d866a0a3f554c458287d0ca96b04ff3e83db04f6a7d5cc
!! source digest: sha256:8f769ba74e23dd412d6a3714153bf66d3306f8a18f60d21863a90104ddb0497f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_validation_move_line"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_order_validation_move_line"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&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 adds the possibility to choose only validated invoice for the account.payment.line.create and it can be set from theaccount.payment.mode model and account.payment.line.create</p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" 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 image-reference" href="https://github.com/OCA/bank-payment/tree/14.0/account_payment_order_select_for_payment"><img alt="OCA/bank-payment" src="https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/bank-payment-14-0/bank-payment-14-0-account_payment_order_select_for_payment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/bank-payment&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>On invoices, when you have selected some invoices which can be paid, the module adds the possibility to filter in the payment order, those invoices that have been marked as “To pay”.</p>
<div class="admonition important">
<p class="first admonition-title">Important</p>
<p class="last">This is an alpha version, the data model and design can change at any time without warning.
Expand All @@ -394,7 +394,7 @@ <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/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/bank-payment/issues/new?body=module:%20account_payment_order_validation_move_line%0Aversion:%2014.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_order_select_for_payment%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">
Expand All @@ -419,7 +419,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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/14.0/account_payment_order_validation_move_line">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_order_select_for_payment">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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<field name="inherit_id" ref="account_payment_mode.account_payment_mode_form" />
<field name="arch" type="xml">
<field name="default_date_type" position="after">
<field name="default_selected_for_payment_id" />
<field name="default_selected_for_payment" />
</field>
</field>
</record>
Expand All @@ -17,7 +17,7 @@
<field name="arch" type="xml">
<field name="payment_type" position="after">
<field
name="default_selected_for_payment_id"
name="default_selected_for_payment"
optional="hide"
widget="toggle_button"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# © 2009 EduSense BV (<http://www.edusense.nl>)
# © 2011-2013 Therp BV (<https://therp.nl>)
# © 2014-2015 ACSONE SA/NV (<https://acsone.eu>)
# © 2023 Akretion (<https://www.akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class AccountPaymentLineCreate(models.TransientModel):
_inherit = "account.payment.line.create"

select_for_payment_filter = fields.Boolean(
string="Take only to pay",
store=True,
readonly=False,
)

@api.model
def default_get(self, field_list):
res = super().default_get(field_list)
context = self.env.context
order = self.env["account.payment.order"].browse(context["active_id"])
mode = order.payment_mode_id
res.update(
{
"select_for_payment_filter": mode.default_selected_for_payment,
}
)
return res

def _prepare_move_line_domain(self):

res = super()._prepare_move_line_domain()

if self.select_for_payment_filter:
res += [("move_id.selected_for_payment", "=", True)]

Check warning on line 37 in account_payment_order_select_for_payment/wizard/account_payment_line_create.py

View check run for this annotation

Codecov / codecov/patch

account_payment_order_select_for_payment/wizard/account_payment_line_create.py#L37

Added line #L37 was not covered by tests

return res
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/>
<field name="arch" type="xml">
<field name="payment_mode" position="after">
<field name="select_for_payment_move_line" />
<field name="select_for_payment_filter" />
</field>
</field>
</record>
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit bf4dff7

Please sign in to comment.