Skip to content
Snippets Groups Projects
Commit f539f0ee authored by niyasraphy's avatar niyasraphy
Browse files

[FIX] repair: hide cancel button in done state

before this commit, the cancel button is visible in the done state and on clicking showing the validation that it cannot be cancelled.

by the commit: https://github.com/odoo/odoo/commit/8d37cf462badc25d911d3fa6d3382c6f7418904f one of the cancel button in the form is made hidden in the done state, similarly applying for the other cancel button also.

also currently on trying to delete a done repair order, it says to cancel first and then delete the order, from the commit:  https://github.com/odoo/odoo/commit/8d37cf462badc25d911d3fa6d3382c6f7418904f

 cancelling a done record is prevented, thus modifying the warning message and its related pot file

after this commit, the cancel button will not be visible in the done state.

closes odoo/odoo#113076

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 74893cf2
No related branches found
No related tags found
No related merge requests found
......@@ -1277,6 +1277,12 @@ msgstr ""
msgid "You cannot cancel a completed repair order."
msgstr ""
#. module: repair
#: code:addons/repair/models/repair.py:0
#, python-format
msgid "You cannot delete a completed repair order."
msgstr ""
#. module: repair
#: code:addons/repair/models/repair.py:0 code:addons/repair/models/repair.py:0
#, python-format
......
......@@ -202,6 +202,8 @@ class Repair(models.Model):
def unlink(self):
for order in self:
if order.state == 'done':
raise UserError(_('You cannot delete a completed repair order.'))
if order.state not in ('draft', 'cancel'):
raise UserError(_('You can not delete a repair order once it has been confirmed. You must first cancel it.'))
if order.state == 'cancel' and order.invoice_id and order.invoice_id.posted_before:
......
......@@ -37,7 +37,7 @@
<button name="action_send_mail" states="draft" string="Send Quotation" type="object"/>
<button name="print_repair_order" states="draft" string="Print Quotation" type="object"/>
<button name="action_repair_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_repair_cancel" string="Cancel Repair" type="object" confirm="Draft invoices for this order will be cancelled. Do you confirm the action?" attrs="{'invisible':['|', ('state', '=', 'cancel'), ('invoice_state', '!=', 'draft')]}"/>
<button name="action_repair_cancel" string="Cancel Repair" type="object" confirm="Draft invoices for this order will be cancelled. Do you confirm the action?" attrs="{'invisible':['|', ('state','in', ('cancel','done')), ('invoice_state', '!=', 'draft')]}"/>
<button name="action_repair_cancel" string="Cancel Repair" type="object" attrs="{'invisible': ['|', ('state','in', ('cancel','done')), ('invoice_state', '=', 'draft')]}"/>
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,done"/>
</header>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment