XML templates and filename

This commit is contained in:
resteve 2015-09-22 19:18:04 +02:00
parent 2a2c059756
commit 1eacbe4867
5 changed files with 16 additions and 16 deletions

View file

@ -29,11 +29,11 @@ class Product:
SystemLogicsModula = Pool().get('systemlogics.modula')
super(Product, cls).write(*args)
print "product write"
systemlogics_products = []
actions = iter(args)
for products, values in zip(actions, actions):
if 'code' in values and not values.get('codes'):
if values.get('code') and not values.get('codes'):
systemlogics_products = products
if systemlogics_products:

View file

@ -194,7 +194,7 @@ class SystemLogicsModula(ModelSQL, ModelView):
with tempfile.NamedTemporaryFile(
dir=systemlogic.path,
prefix='%s-%s-' % (dbname, product.code_ean13),
prefix='%s-%s-' % (dbname, product.code or product.id),
suffix='.xml', delete=False) as temp:
temp.write(xml)
logging.getLogger('systemlogics-modula').info(

View file

@ -2,16 +2,16 @@
<SYSTORE_ARTICOLI xmlns:py="http://genshi.edgewall.org/">
<IMP_ARTICOLI>
<ART_ARTICOLO>${product.code}</ART_ARTICOLO>
<ART_DES>${product.rec_name[:100]}</ART_DES>
<ART_UMI>${product.default_uom.symbol}</ART_UMI>
<ART_PMU></ART_PMU>
<ART_AREEABI></ART_AREEABI>
<ART_TIPOGESTART></ART_TIPOGESTART>
<ART_FIFOP></ART_FIFOP>
<ART_FIFOV></ART_FIFOV>
<ART_NOTE>
${(code.number+'\n ' for code in product.codes)}
</ART_NOTE>
<ART_CLAMOV></ART_CLAMOV>
<ART_DES>${product.rec_name[:100]}</ART_DES>
<ART_UMI>${product.default_uom.symbol}</ART_UMI>
<ART_PMU></ART_PMU>
<ART_AREEABI></ART_AREEABI>
<ART_TIPOGESTART></ART_TIPOGESTART>
<ART_FIFOP></ART_FIFOP>
<ART_FIFOV></ART_FIFOV>
<ART_NOTE>
${(code.number+'\n ' for code in product.codes)}
</ART_NOTE>
<ART_CLAMOV></ART_CLAMOV>
</IMP_ARTICOLI>
</SYSTORE_ARTICOLI>

View file

@ -2,7 +2,7 @@
<SYSTORE_ORDINI xmlns:py="http://genshi.edgewall.org/">
<IMP_ORDINI>
<ORD_ORDINE>${shipment.code}</ORD_ORDINE>
<ORD_DES></ORD_DES>
<ORD_DES>${shipment.reference and shipment.reference[:50]}</ORD_DES>
<ORD_TIPOOP>${type_}</ORD_TIPOOP> <!-- P: Extracion / V: Deposito -->
<ORD_PRIOHOST>${datetime.datetime.now().strftime("%Y%m%d%H%M%s")[:16]}</ORD_PRIOHOST> <!-- fechaHora AAAAMMGGHHPPPPPP -->
<ORD_CLIENTE></ORD_CLIENTE>

View file

@ -2,7 +2,7 @@
<SYSTORE_ORDINI xmlns:py="http://genshi.edgewall.org/">
<IMP_ORDINI>
<ORD_ORDINE>${shipment.code}</ORD_ORDINE>
<ORD_DES>${shipment.reference[:50]}</ORD_DES>
<ORD_DES>${shipment.reference and shipment.reference[:50]}</ORD_DES>
<ORD_TIPOOP>${type_}</ORD_TIPOOP> <!-- P: Extracion / V: Deposito -->
<ORD_PRIOHOST>${datetime.datetime.now().strftime("%Y%m%d%H%M%s")[:16]}</ORD_PRIOHOST> <!-- fechaHora AAAAMMGGHHPPPPPP -->
<ORD_CLIENTE>${shipment.customer.name[:50]}</ORD_CLIENTE>