sale_order_cancel.py 511 B

123456789101112131415161718
  1. from odoo import api, fields, models
  2. class SaleOrderCancel(models.TransientModel):
  3. _inherit = "sale.order.cancel"
  4. display_purchase_orders_alert = fields.Boolean(
  5. string="Purchase Order Alert",
  6. compute='_compute_display_purchase_orders_alert'
  7. )
  8. @api.depends('order_id')
  9. def _compute_display_purchase_orders_alert(self):
  10. for wizard in self:
  11. wizard.display_purchase_orders_alert = bool(
  12. wizard.order_id.purchase_order_count
  13. )