Minor fix

This commit is contained in:
Oscar 2021-08-12 15:32:37 -05:00
parent ebd11385e5
commit cd142a7c27
2 changed files with 8 additions and 5 deletions

View File

@ -13,7 +13,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="text">Product not available but another service</field>
</record>
<record model="ir.message" id="msg_product_not_stock">
<field name="text">Product "%s" without stock.</field>
<field name="text">Product "%(product)s" without stock.</field>
</record>
</data>
</tryton>

View File

@ -1,11 +1,14 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from datetime import timedelta, time
from datetime import time
from trytond.i18n import gettext
from trytond.model import fields, ModelView, ModelSQL, Workflow
from trytond.pool import Pool, PoolMeta
from trytond.wizard import Wizard, StateView, StateTransition, Button
from trytond.transaction import Transaction
from trytond.pyson import Eval
from trytond.exceptions import UserWarning
from sql import Table
@ -149,10 +152,10 @@ class ShipmentOutReturn(metaclass=PoolMeta):
for shipment in shipments:
for move in shipment.incoming_moves:
quantity = shipment.validate_product_quantity(move)
print(quantity, move.quantity)
if quantity < move.quantity:
warning_name = '%s.shipment_out_return.product_not_stock' % move.id
cls.raise_user_warning(warning_name, 'product_not_stock', move.product.name)
raise UserWarning(gettext(
'rental.msg_product_not_stock', product=move.product.name
))
super(ShipmentOutReturn, cls).receive(shipments)
def validate_product_quantity(self, move):