Minor fix
This commit is contained in:
parent
ebd11385e5
commit
cd142a7c27
|
@ -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>
|
||||
|
|
11
stock.py
11
stock.py
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue