46 |
</and> |
</and> |
47 |
</condition> |
</condition> |
48 |
</datasource> |
</datasource> |
49 |
<datasource name="itemDataSource" database="papo" table="own_product_item, own_item, _price_data"> |
<datasource name="itemDataSource" database="papo" |
50 |
|
table="_price_data, _product_store_data, own_document, own_item, own_product_item"> |
51 |
<condition> |
<condition> |
52 |
<and> |
<and> |
53 |
<eq> |
<eq> |
|
<cfield name="own_item.id"/> |
|
54 |
<cfield name="own_product_item.own_item"/> |
<cfield name="own_product_item.own_item"/> |
55 |
|
<cfield name="own_item.id"/> |
56 |
</eq> |
</eq> |
57 |
<eq> |
<eq> |
58 |
<cfield name="own_product_item.price"/> |
<cfield name="own_product_item.price"/> |
59 |
<cfield name="_price_data.id"/> |
<cfield name="_price_data.id"/> |
60 |
</eq> |
</eq> |
61 |
|
<eq> |
62 |
|
<cfield name="_price_data.product"/> |
63 |
|
<cfield name="_product_store_data.product"/> |
64 |
|
</eq> |
65 |
|
<eq> |
66 |
|
<cfield name="own_item.own_document"/> |
67 |
|
<cfield name="own_document.id"/> |
68 |
|
</eq> |
69 |
|
<null> |
70 |
|
<cfield name="_product_store_data._end_t"/> |
71 |
|
</null> |
72 |
</and> |
</and> |
73 |
</condition> |
</condition> |
74 |
</datasource> |
</datasource> |
75 |
|
<datasource name="levelDataSource" database="papo" |
76 |
|
table="_product_store_data, product_store" |
77 |
<!-- |
historytable="_product_store_data"> |
|
|
|
|
::PROBLEMA GRANDOTE Y PELUDO:: |
|
|
si le damos de baja a un producto y después anulamos una |
|
|
factura que contenía ese producto, esto se cae. Por ahora hacemos la |
|
|
de la avestruz... |
|
|
|
|
|
--> |
|
|
|
|
|
<datasource name="product_storeDataSource" database="papo" table="product_store, _product_store_data" historytable="_product_store_data"> |
|
78 |
<condition> |
<condition> |
79 |
<and> |
<and> |
80 |
<eq> |
<eq> |
86 |
</null> |
</null> |
87 |
</and> |
</and> |
88 |
</condition> |
</condition> |
89 |
</datasource> |
</datasource> |
90 |
|
|
91 |
<trigger name="searchTrigger" type="NAMED"> |
<trigger name="searchTrigger" type="NAMED"> |
92 |
resultBlock.processRollback() |
resultBlock.processRollback() |
97 |
|
|
98 |
<trigger name="commitTrigger" type="NAMED"> |
<trigger name="commitTrigger" type="NAMED"> |
99 |
from __future__ import nested_scopes |
from __future__ import nested_scopes |
100 |
|
global hack |
101 |
import hack |
import hack |
102 |
|
|
103 |
for document in filter(lambda x: (not x._fields['is_void']) != (not x._initialData['is_void']), |
for document in filter(lambda x: (not hack.is_true(x._fields['own_document.is_void'])) != (not hack.is_true(x._initialData['own_document.is_void'])), |
104 |
resultDataSource.getRecords()): |
resultDataSource.getRecords()): |
105 |
|
|
106 |
if document.getField('own_document_type') == 4: |
if document.getField('own_document.own_document_type') == 4: |
107 |
# got to fix the stock |
# got to fix the stock |
108 |
if hack.a2f(document.getField('is_void')): |
if hack.a2f(document.getField('own_document.is_void')): |
109 |
# return the stock |
# return the stock |
110 |
f = lambda x: lambda y: x+y |
f = lambda y: lambda x: x+y |
111 |
else: |
else: |
112 |
# remove the stock |
# remove the stock |
113 |
f = lambda x: lambda y: x-y |
f = lambda y: lambda x: x-y |
114 |
|
|
|
|
|
115 |
itemBlock.processRollback() |
itemBlock.processRollback() |
116 |
itemBlock.initQuery() |
itemBlock.initQuery() |
117 |
itemBlock.documentEntry = str(document.getField('id')) |
itemBlock.documentEntry = str(document.getField('own_document.id')) |
118 |
itemBlock.processQuery() |
itemBlock.processQuery() |
119 |
|
|
120 |
for item in itemDataSource.getRecords(): |
for item in itemDataSource.getRecords(): |
121 |
product_storeBlock.processRollback() |
levelBlock.processRollback() |
122 |
product_storeBlock.initQuery() |
levelBlock.initQuery() |
123 |
product_storeBlock.productEntry = str(item.getField('_price_data.product')) |
levelBlock.productEntry = str( item.getField('_product_store_data.product') ) |
124 |
product_storeBlock.processQuery() |
levelBlock.processQuery() |
125 |
print product_storeBlock.levelEntry |
levelBlock.levelEntry.atomicModify(f(hack.a2f(item.getField('own_product_item.qty')))) |
126 |
product_storeBlock.levelEntry.atomicModify(f) |
levelBlock.processRollback() |
127 |
print product_storeBlock.levelEntry |
|
128 |
|
searchBlock.processRollback() |
129 |
|
itemBlock.processRollback() |
130 |
|
levelBlock.processRollback() |
131 |
|
resultBlock.commit() |
132 |
|
|
133 |
</trigger> |
</trigger> |
134 |
|
|
150 |
<button x="37" y="2" width="9" height="1" name="searchBtn" label="Buscar" trigger="searchTrigger"/> |
<button x="37" y="2" width="9" height="1" name="searchBtn" label="Buscar" trigger="searchTrigger"/> |
151 |
</block> |
</block> |
152 |
<block name="resultBlock" datasource="resultDataSource" transparentBlock="" restrictInsert=""> |
<block name="resultBlock" datasource="resultDataSource" transparentBlock="" restrictInsert=""> |
153 |
<entry x="0" y="0" name="idREntry" field="id" hidden="y"/> |
<entry x="0" y="0" name="idREntry" field="own_document.id" hidden="y"/> |
154 |
<entry x="0" y="0" name="own_document_typeEntry" field="own_document_type" hidden="y"/> |
<entry x="0" y="0" name="own_document_typeEntry" field="own_document.own_document_type" hidden="y"/> |
155 |
<label x="1" y="5" text="Número"/> |
<label x="1" y="5" text="Número"/> |
156 |
<label x="10" y="5" text="Cliente"/> |
<label x="10" y="5" text="Cliente"/> |
157 |
<label x="45" y="5" text="Fecha"/> |
<label x="45" y="5" text="Fecha"/> |
158 |
<label x="68" y="4" text="Anulada"/> |
<label x="68" y="4" text="Anulada"/> |
159 |
<label x="69" y="5" text="(1=si)"/> |
<label x="69" y="5" text="(1=si)"/> |
160 |
<entry x="1" y="6" width="9" rows="10" name="numberEntry" field="number" style="label" readonly="y"/> |
<entry x="1" y="6" width="9" rows="10" name="numberEntry" field="own_document.number" style="label" readonly="y"/> |
161 |
<entry x="10" y="6" width="35" rows="10" name="clientEntry" field="recipient" style="textlookup" readonly="y" |
<entry x="10" y="6" width="35" rows="10" name="clientEntry" field="own_document.recipient" style="textlookup" readonly="y" |
162 |
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_entity_data.name"/> |
foreign_key="clientDataSource._entity_data._table" foreign_key_description="_entity_data.name"/> |
163 |
<entry x="45" y="6" width="25" rows="10" name="dateEntry" field="date" style="label" readonly="y"/> |
<entry x="45" y="6" width="25" rows="10" name="dateEntry" field="own_document.date" style="label" readonly="y"/> |
164 |
<entry x="70" y="6" width="2" rows="10" name="is_voidEntry" field="is_void"/> |
<entry x="70" y="6" width="2" rows="10" name="is_voidEntry" field="own_document.is_void" /> |
165 |
<scrollbar page="10" x="72" y="6" width="3" height="10"/> |
<scrollbar page="10" x="72" y="6" width="3" height="10"/> |
166 |
<button x="45" y="17" width="9" height="1" name="commitBtn" label="Aceptar" trigger="commitTrigger"/> |
<button x="45" y="17" width="9" height="1" name="commitBtn" label="Aceptar" trigger="commitTrigger"/> |
167 |
<button x="55" y="17" width="9" height="1" name="rollbackBtn" label="Deshacer" trigger="rollbackTrigger"/> |
<button x="55" y="17" width="9" height="1" name="rollbackBtn" label="Deshacer" trigger="rollbackTrigger"/> |
168 |
<button x="65" y="17" width="9" height="1" name="abortBtn" label="Cancelar" trigger="abortTrigger"/> |
<button x="65" y="17" width="9" height="1" name="abortBtn" label="Cancelar" trigger="abortTrigger"/> |
169 |
</block> |
</block> |
170 |
<block name="itemBlock" datasource="itemDataSource"> |
<block name="itemBlock" datasource="itemDataSource"> |
171 |
<entry x="0" y="0" name="qtyEntry" field="own_product_item.qty" hidden="y"/> |
<entry x="0" y="0" field="own_document.id" name="documentEntry" hidden="y"/> |
172 |
<entry x="0" y="0" name="productEntry" field="_price_data.product" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.product" name="productEntry" hidden="y"/> |
173 |
<entry x="0" y="0" name="documentEntry" field="own_item.own_document" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.level" name="levelEntry" hidden="y"/> |
174 |
|
<entry x="0" y="0" field="own_product_item.qty" name="qtyEntry" hidden="y"/> |
175 |
</block> |
</block> |
176 |
<block name="product_storeBlock" datasource="product_storeDataSource"> |
<block name="levelBlock" datasource="levelDataSource"> |
177 |
<entry x="0" y="0" name="idEntry" field="product_store.id" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.level" name="levelEntry" hidden="y"/> |
178 |
<entry x="0" y="0" name="productEntry" field="_product_store_data.product" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.product" name="productEntry" hidden="y"/> |
179 |
<entry x="0" y="0" name="levelEntry" field="_product_store_data.level" hidden="y"/> |
<entry x="0" y="0" field="_product_store_data.lowater" name="lowaterEntry" hidden="y"/> |
180 |
|
<entry x="0" y="0" field="_product_store_data.hiwater" name="hiwaterEntry" hidden="y"/> |
181 |
|
<entry x="0" y="0" field="_product_store_data.storehouse" name="storehouseEntry" hidden="y"/> |
182 |
</block> |
</block> |
183 |
</page> |
</page> |
184 |
</form> |
</form> |