Allow unlocking estimates linked to issues

An estimate attached to an issue was read-only, so changing it after a
customer asked for tweaks meant taking it off the work order first.

A new global permission, "Edit estimates linked to issues" (on top of
Write estimates), shows an "Unlock to edit" button on a linked
estimate. After a confirmation the estimate opens for editing, and the
issues stay linked when it's saved. EstimateWriter.save still refuses a
linked estimate unless it was unlocked by a user with the permission.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-20 16:08:52 -05:00
1 parent 22af08cee7
commit 48f92f241f
9 files changed
+118 -4

No files matched your search

+6
View File
@@ -93,6 +93,12 @@ module RedmineQboBilling
user.allowed_to?(:view_payments, nil, global: true) || payment_receiver?(user)
end
# True when the user may unlock and change an estimate linked to an issue (e.g. a customer asks for changes to
# an estimate already on the diagnostic work order): "Edit estimates linked to issues" on top of "Write estimates"
def self.linked_estimate_editor?(user = User.current)
writer?(user) && user.allowed_to?(:edit_linked_estimates, nil, global: true)
end
# True when the user may write invoices
def self.invoice_writer?(user = User.current)
user.allowed_to?(:write_invoices, nil, global: true)