[IMP] account: Splitting Amount to settle menu

Currently, the "Amounts to settle" button in the "Vendors" drop-down menu
opens a view showing all the account.move.line that are to be reconciled.
Also, they should only be shown when their residual is less than zero.

This commit makes it now so that when clicking on that button, only the amls
linked to a purchase journal are shown and another "Amounts to Settle" button
has been added in the "Customers" drop-down menu to show the amls linked to
a sale journal

task-3572482

closes odoo/odoo#140040

Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
Thomas Becquevort (thbe)
2023-10-30 12:05:22 +00:00
parent e179fce25c
commit 14879c2623
3 changed files with 24 additions and 4 deletions
@@ -565,8 +565,9 @@ class account_journal(models.Model):
('journal_id', 'in', self.ids),
('move_id.payment_state', 'in', ('not_paid', 'partial')),
('date_maturity', '!=', False),
('amount_residual', '!=', False),
('amount_residual', '<', 0),
('parent_state', '=', 'posted'),
('journal_id.type', '=', 'purchase'),
])
def _get_late_payment_query(self):
@@ -575,8 +576,9 @@ class account_journal(models.Model):
('journal_id', 'in', self.ids),
('move_id.payment_state', 'in', ('not_paid', 'partial')),
('date_maturity', '<', fields.Date.context_today(self)),
('amount_residual', '!=', False),
('amount_residual', '<', 0),
('parent_state', '=', 'posted'),
('journal_id.type', '=', 'purchase'),
])
def _count_results_and_sum_amounts(self, results_dict, target_currency):
@@ -11,6 +11,7 @@
<menuitem id="menu_action_move_out_invoice_type" action="action_move_out_invoice_type" sequence="1"/>
<menuitem id="menu_action_move_out_refund_type" action="action_move_out_refund_type" sequence="2"/>
<menuitem id="menu_action_move_out_receipt_type" action="action_move_out_receipt_type" groups="account.group_sale_receipts" sequence="3"/>
<menuitem id="menu_action_open_sale_payment_items" name="Amounts to Settle" action="action_open_sale_payment_items" sequence="10"/>
<menuitem id="menu_action_account_payments_receivable" name="Payments" action="action_account_payments" sequence="15"/>
<menuitem id="product_product_menu_sellable" name="Products" action="product_product_action_sellable" sequence="100"/>
<menuitem id="menu_account_customer" name="Customers" action="res_partner_action_customer" sequence="110"/>
+19 -2
View File
@@ -1690,6 +1690,23 @@
</field>
</record>
<record id="action_open_sale_payment_items" model="ir.actions.act_window">
<field name="name">Customer Amounts to Settle</field>
<field name="res_model">account.move.line</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_move_line_payment_tree"/>
<field name="search_view_id" ref="view_account_move_line_payment_filter"/>
<field name="context">{'search_default_group_by_partner':1, 'expand':1}</field>
<field name="domain">[('parent_state', '=', 'posted'), ('amount_residual', '&lt;', 0), ('account_id.reconcile', '=', True), ('journal_id.type', '=', 'sale')]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Amounts to settle
</p><p>
Cool, it looks like you don't have any customer credit notes to pay.
</p>
</field>
</record>
<record id="action_open_payment_items" model="ir.actions.act_window">
<field name="name">Amounts to Settle</field>
<field name="res_model">account.move.line</field>
@@ -1697,12 +1714,12 @@
<field name="view_id" ref="view_move_line_payment_tree"/>
<field name="search_view_id" ref="view_account_move_line_payment_filter"/>
<field name="context">{'search_default_group_by_partner':1, 'expand':1}</field>
<field name="domain">[('parent_state', '=', 'posted'), ('amount_residual', '!=', 0), ('account_id.reconcile', '=', True)]</field>
<field name="domain">[('parent_state', '=', 'posted'), ('amount_residual', '&lt;', 0), ('account_id.reconcile', '=', True), ('journal_id.type', '=', 'purchase')]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Amounts to settle
</p><p>
Cool, it looks like you don't have anything to pay either for vendor bills or for customer credit notes.
Cool, it looks like you don't have any vendor bills to pay.
</p>
</field>
</record>