add validation stock

This commit is contained in:
mohammed-alkhazrji 2025-08-19 20:06:25 +03:00
parent ce852ed785
commit 564710ac20
2 changed files with 13 additions and 2 deletions

View File

@ -613,4 +613,12 @@ msgstr "إذا اخترت هذا الخيار، فلن يتم شراء المن
#. module: purchase_custom_stock
#: model_terms:ir.ui.view,arch_db:purchase_custom_stock.purchase_request_picking_wizard_view_form
msgid "Delivery and Close"
msgstr "صرف المتوفر وإغلاق الطلب"
msgstr "صرف المتوفر وإغلاق الطلب"
#. module: purchase_custom_stock
#: code:addons/purchase_custom_stock/wizards/picking_purchase_request.py:0
#, python-format
msgid "Please select the warehouse or location."
msgstr "يرجى اختيار المستودع أو الموقع.

View File

@ -2,7 +2,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import Warning
from odoo.exceptions import Warning,UserError
class PurcahseRefues(models.TransientModel):
@ -101,6 +101,9 @@ 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."))
if self.request_line_ids.filtered(
lambda line: line.product_id.type in ('product', 'consu') and (
line.product_id.type != 'consu' or not line.product_id.asset_ok