consu & asset_ok

This commit is contained in:
mohammed-alkhazrji 2025-09-08 12:23:34 +03:00
parent 93aefd1913
commit 693a677a90
1 changed files with 7 additions and 2 deletions

View File

@ -101,8 +101,13 @@ class PurcahseRefues(models.TransientModel):
self.request_id.write({'state': 'wait_for_send' if init_budget else 'waiting'})
def convert_purchase(self):
if not self.request_id.location_id:
raise UserError(_("Please select the warehouse or location."))
all_consu_assets = all(
line.product_id.type == 'consu' and line.product_id.asset_ok
for line in self.request_line_ids
)
if not all_consu_assets:
if not self.request_id.location_id:
raise UserError(_("Please select the warehouse or location."))
if self.request_line_ids.filtered(
lambda line: line.product_id.type in ('product', 'consu') and (