Skip to content

Commit

Permalink
TA#70510 [14.0][IMP] sale_whole_order_invoiced : unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
lanto-razafindrabe committed Nov 11, 2024
1 parent 930db94 commit 712e5b4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions sale_whole_order_invoiced/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ Release notes:
--------------

Since the version 1.1.0, the option `Invoice whole order (deduct down payments)` is selected by default when using this module.
Even when creating invoice(s) from list view, using the `Create Invoice`.

.. image:: static/description/sale_order_list_view.png

.. image:: static/description/create_invoice_wizard.png

Contributors
------------
Expand Down
2 changes: 1 addition & 1 deletion sale_whole_order_invoiced/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

{
"name": "Sale Whole Order Invoiced",
"version": "1.1.0",
"version": "1.1.1",
"author": "Numigi",
"maintainer": "Numigi",
"website": "https://bit.ly/numigi-com",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions sale_whole_order_invoiced/tests/test_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,18 @@ def test_on_copy__whole_order_invoiced_not_propagated(self):
self.sale_order.whole_order_invoiced = True
new_order = self.sale_order.copy()
assert not new_order.whole_order_invoiced

def test_wizard_default_whole_order_invoiced(self):
def check_advance_payment_method(order_ids):
wizard_obj = self.env["sale.advance.payment.inv"].with_context(
active_ids=order_ids
)
wizard = wizard_obj.create(wizard_obj.default_get(list(wizard_obj._fields)))
assert wizard.advance_payment_method == "whole_order"

# Check on one record
check_advance_payment_method([self.sale_order.id])

# Check on more than one record
new_order = self.sale_order.copy()
check_advance_payment_method([self.sale_order.id, new_order.id])
6 changes: 4 additions & 2 deletions sale_whole_order_invoiced/wizard/sale_make_invoice_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ class SaleAdvancePaymentInv(models.TransientModel):
_inherit = "sale.advance.payment.inv"

advance_payment_method = fields.Selection(
selection_add=[("whole_order",
_("Invoice whole order (deduct down payments)"))],
selection_add=[
("whole_order", _("Invoice whole order (deduct down payments)"))
],
ondelete={"whole_order": "cascade"},
default="whole_order",
)

def create_invoices(self):
Expand Down

0 comments on commit 712e5b4

Please sign in to comment.