Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] reference_type usability improvements #1332

Open
wants to merge 3 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion account_payment_order/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ class AccountMove(models.Model):
# payment mode or company level
reference_type = fields.Selection(
selection=[("none", "Free Reference"), ("structured", "Structured Reference")],
readonly=True,
Copy link
Contributor

@sbejaoui sbejaoui Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding reference_type to the _compute_payment_reference dependencies. We didn't need it before because the field was readonly after the invoice was posted. Now, since it can change for posted invoices, we need to trigger the payment reference recompute.

states={"draft": [("readonly", False)]},
default="none",
string="Payment Reference Type",
)
payment_line_count = fields.Integer(compute="_compute_payment_line_count")

Expand Down
3 changes: 1 addition & 2 deletions account_payment_order/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@
<field name="payment_reference" position="before">
<field
name="reference_type"
attrs="{'readonly':[('state','!=','draft')],
'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund'))],
attrs="{'invisible': [('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))],
'required': [('move_type', 'in', ('out_invoice', 'out_refund'))]}"
/>
</field>
Expand Down
Loading