mirror of
https://bitbucket.org/presik/trytonpsk-stock_co.git
synced 2023-12-14 05:43:05 +01:00
minor fix
This commit is contained in:
parent
10dd939617
commit
2a58d4b449
3 changed files with 23 additions and 4 deletions
|
@ -83,13 +83,19 @@ class InternalShipment(metaclass=PoolMeta):
|
|||
|
||||
def _get_lots(product_id):
|
||||
locations_ids = {'locations': [shipment.from_location.id]}
|
||||
order = []
|
||||
fields = Lot.fields_get(fields_names=['expiration_date'])
|
||||
if 'expiration_date' in fields.keys():
|
||||
order.append(('expiration_date', 'ASC NULLS LAST'))
|
||||
order.append(('create_date', 'ASC'))
|
||||
|
||||
with Transaction().set_context(locations_ids):
|
||||
dom = [
|
||||
('product', '=', product_id),
|
||||
('active', '=', True),
|
||||
('quantity', '>', 0),
|
||||
]
|
||||
lots = Lot.search(dom, order=[('expiration_date', 'ASC NULLS LAST'), ('create_date', 'ASC')])
|
||||
lots = Lot.search(dom, order=order)
|
||||
return lots
|
||||
|
||||
for move in shipment.moves:
|
||||
|
|
10
stock.py
10
stock.py
|
@ -29,7 +29,7 @@ class Lot(metaclass=PoolMeta):
|
|||
|
||||
class Move(metaclass=PoolMeta):
|
||||
__name__ = 'stock.move'
|
||||
description = fields.Char('Description', select=True, states=STATES_MOVE)
|
||||
description = fields.Function(fields.Char('Description'), 'on_change_with_description')
|
||||
current_stock = fields.Function(fields.Float('Current Stock',
|
||||
depends=['product']), 'on_change_with_current_stock')
|
||||
reference = fields.Function(fields.Char('Reference',
|
||||
|
@ -71,6 +71,14 @@ class Move(metaclass=PoolMeta):
|
|||
res += res_dict[self.product.id]
|
||||
return res
|
||||
|
||||
@fields.depends('product')
|
||||
def on_change_with_description(self, name=None):
|
||||
res = ''
|
||||
if self.product and self.product.description:
|
||||
description = self.product.description
|
||||
res = description.rstrip('\n')
|
||||
return res
|
||||
|
||||
|
||||
class MoveByProductStart(ModelView):
|
||||
'Move By Product Start'
|
||||
|
|
|
@ -2,14 +2,19 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath
|
||||
expr="/form/label[@name='origin']" position="before">
|
||||
|
||||
<newline/>
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="/form/field[@name='origin']" position="after">
|
||||
<newline/>
|
||||
<label name="description"/>
|
||||
<field name="description" colspan="3"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference"/>
|
||||
<label name="current_stock"/>
|
||||
<field name="current_stock"/>
|
||||
<label name="reference"/>
|
||||
<field name="reference"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in a new issue