mirror of
https://github.com/NaN-tic/trytond-systemlogics_modula.git
synced 2023-12-14 04:32:53 +01:00
IMP ORDINI completed / incompleted
This commit is contained in:
parent
08ec7e7082
commit
6bed295841
31
stock.py
31
stock.py
|
@ -12,6 +12,8 @@ __metaclass__ = PoolMeta
|
|||
class ShipmentOut:
|
||||
__name__ = 'stock.shipment.out'
|
||||
systemlogics_modula = fields.Boolean('SystemLogics Modula')
|
||||
systemlogics_modula_completed = fields.Boolean(
|
||||
'SystemLogics Modula Completed')
|
||||
|
||||
@staticmethod
|
||||
def default_systemlogics_modula():
|
||||
|
@ -22,29 +24,44 @@ class ShipmentOut:
|
|||
'''Active System Logics process when a move from location is systemlogics marked'''
|
||||
SystemLogicsModula = Pool().get('systemlogics.modula')
|
||||
|
||||
systemlogics_shipments = []
|
||||
s_completed = [] # shipments completed
|
||||
s_incompleted = [] # shipments incompleted
|
||||
for s in shipments:
|
||||
if hasattr(s, 'review'):
|
||||
if s.review:
|
||||
continue
|
||||
systemLogics = False
|
||||
completed = True
|
||||
for move in s.inventory_moves:
|
||||
if move.from_location.systemlogics_modula:
|
||||
systemLogics = True
|
||||
break
|
||||
else:
|
||||
completed = False
|
||||
if systemLogics:
|
||||
systemlogics_shipments.append(s)
|
||||
if completed:
|
||||
s_completed.append(s)
|
||||
else:
|
||||
s_incompleted.append(s)
|
||||
|
||||
if systemlogics_shipments:
|
||||
cls.write(systemlogics_shipments, {'systemlogics_modula': True})
|
||||
if s_completed or s_incompleted:
|
||||
if s_completed:
|
||||
cls.write(s_completed, {
|
||||
'systemlogics_modula': True,
|
||||
'systemlogics_modula_completed': True,
|
||||
})
|
||||
if s_incompleted:
|
||||
cls.write(s_incompleted, {
|
||||
'systemlogics_modula': True,
|
||||
'systemlogics_modula_completed': False,
|
||||
})
|
||||
|
||||
# Force not get a rollback to generate XML file
|
||||
shipment_ids = [s.id for s in systemlogics_shipments]
|
||||
shipment_ids = [s.id for s in (s_completed + s_incompleted)]
|
||||
Transaction().cursor.commit()
|
||||
# Search shipment ID to sure not have a rollback
|
||||
shipments = cls.search([
|
||||
('id', 'in', shipment_ids),
|
||||
])
|
||||
], order=[('systemlogics_modula_completed', 'DESC')])
|
||||
SystemLogicsModula.imp_ordini(
|
||||
shipments, template='IMP_ORDINI_OUT', type_='P')
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ class SystemLogicsModula(ModelSQL, ModelView):
|
|||
},
|
||||
depends=['state'])
|
||||
active = fields.Boolean('Active', select=True)
|
||||
not_completed = fields.Char('Not completed',
|
||||
help='Not completed message')
|
||||
|
||||
@staticmethod
|
||||
def default_dbhost():
|
||||
|
@ -123,8 +125,8 @@ class SystemLogicsModula(ModelSQL, ModelView):
|
|||
|
||||
dbname = Transaction().cursor.dbname
|
||||
|
||||
xml = tmpl.generate(
|
||||
shipments=shipments, type_=type_, datetime=datetime).render()
|
||||
xml = tmpl.generate(systemlogic=systemlogic, shipments=shipments,
|
||||
type_=type_, datetime=datetime).render()
|
||||
|
||||
with tempfile.NamedTemporaryFile(
|
||||
dir=systemlogic.path,
|
||||
|
|
|
@ -20,5 +20,17 @@
|
|||
<RIG_PRIO>0</RIG_PRIO>
|
||||
<RIG_REQ_NOTE/>
|
||||
</IMP_ORDINI_RIGHE>
|
||||
<IMP_ORDINI_RIGHE py:if="not shipment.systemlogics_modula_completed">
|
||||
<RIG_ORDINE>${shipment.code}</RIG_ORDINE>
|
||||
<RIG_ARTICOLO>${systemlogic.not_completed or'Not completed'}</RIG_ARTICOLO>
|
||||
<RIG_SUB1/>
|
||||
<RIG_SUB2/>
|
||||
<RIG_STAMATE/>
|
||||
<RIG_TIPOCONF/>
|
||||
<RIG_HOSTINF>999999</RIG_HOSTINF>
|
||||
<RIG_QTAR>1</RIG_QTAR>
|
||||
<RIG_PRIO>0</RIG_PRIO>
|
||||
<RIG_REQ_NOTE/>
|
||||
</IMP_ORDINI_RIGHE>
|
||||
</IMP_ORDINI>
|
||||
</SYSTORE_ORDINI>
|
||||
|
|
|
@ -12,4 +12,6 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
|
|||
<field name="dbhost"/>
|
||||
<label name="path"/>
|
||||
<field name="path"/>
|
||||
<label name="not_completed"/>
|
||||
<field name="not_completed"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue