FIX 4.2 Tag Not Defined - quickfix

20180216-17:21:04.640 : 8=FIX.4.2;9=115;35=V;34=3;49=SNDJ;52=20180216-17:21:04.640;56=BROKER;55=EUR/USD;146=1;262=676;263=1;264=1;265=1;266=Y;267=1;269=0;10=061;
20180216-17:21:04.641 : 8=FIX.4.2;9=119;35=3;34=3;49=BROKER;52=20180216-17:21:04.641;56=SNDJ;45=3;58=Tag not defined for this message type;371=55;372=V;373=2;10=237;
I receive 'tag not defined for this message type' rejects (35=3) when attempting to send 35=V messages. I have added and removed ValidateUserDefinedFields, ValidateFieldsOutOfOrder.
I have razed the group structure, re-added it, redefined both Symbol and NoRelatedSym types (to string, symbol, int, numingroup etc.), changed the symbol being sent to EURUSD, TEST, etc. and nothing works.
Have I missed something very simple here? It seems related to the fact that the request message puts the symbol tag ahead of the group, but I do not know why.
MarketDataRequest.h:
FIELD_SET(*this, FIX::NoRelatedSym);
class NoRelatedSym: public FIX::Group
{
public:
NoRelatedSym() :
FIX::Group(146,55,FIX::message_order(55,65,48,22,167,200,205,201,2
02,206,231,223,207,106,348,349,107,350,351,336,0)) {}
FIELD_SET(*this, FIX::Symbol);
....
};
My current FIX 4.2 .xml set up for MarketDataRequest messages looks like:
<message name='MarketDataRequest' msgtype='V' msgcat='app'>
<field name='MDReqID' required='Y' />
<field name='SubscriptionRequestType' required='Y' />
<field name='MarketDepth' required='Y' />
<field name='MDUpdateType' required='N' />
<field name='AggregatedBook' required='N' />
<group name='NoMDEntryTypes' required='Y'>
<field name='MDEntryType' required='Y' />
</group>
<group name='NoRelatedSym' required='Y'>
<field name='Symbol' required='Y' />
<field name='SymbolSfx' required='N' />
<field name='SecurityID' required='N' />
<field name='IDSource' required='N' />
<field name='SecurityType' required='N' />
<field name='MaturityMonthYear' required='N' />
<field name='MaturityDay' required='N' />
<field name='PutOrCall' required='N' />
<field name='StrikePrice' required='N' />
<field name='OptAttribute' required='N' />
<field name='ContractMultiplier' required='N' />
<field name='CouponRate' required='N' />
<field name='SecurityExchange' required='N' />
<field name='Issuer' required='N' />
<field name='EncodedIssuerLen' required='N' />
<field name='EncodedIssuer' required='N' />
<field name='SecurityDesc' required='N' />
<field name='EncodedSecurityDescLen' required='N' />
<field name='EncodedSecurityDesc' required='N' />
<field name='TradingSessionID' required='N' />
</group>
</message>
Configuration Settings:
[DEFAULT]
BeginString=FIX.4.2
ReconnectInterval=60
SocketAcceptPort=7091
SenderCompID=SNDJ
TargetCompID=BROKER
SocketNodelay=Y
PersistMessage=Y
FileStorePath=cache
FileLogPath=log
[SESSION]
ConnectionType=acceptor
StartTime=00:30:00
EndTime=23:30:00
ReconnectInterval=30
HeartBtInt=15
SocketAcceptPort=7091
SocketReuseAddress=Y
DataDictionary=spec/FIX42.xml
AppDataDictionary=spec/FIX42.xml
SenderCompID=BROKER
TargetCompID=SNDJ
FileStorePath=cache
FileLogPath=log
[SESSION]
BeginString=FIX.4.2
ConnectionType=initiator
StartTime=00:30:00
EndTime=23:30:00
ReconnectInterval=15
HeartBtInt=15
SocketConnectPort=7091
SocketConnectHost=127.0.0.1
DataDictionary=spec/FIX42.xml
AppDataDictionary=spec/FIX42.xml
SenderCompID=SNDJ
TargetCompID=BROKER
FileStorePath=cache
FileLogPath=log
Thanks

The message that you are sending is invalid per your own DD.
Look at the first body fields after the header ends:
55=EUR/USD;146=1;262=676;...
That 55 field is supposed to be inside the 146 repeating group, but its placement puts it prior to the group.
I suspect your config may be to blame. If you update your question to include the config, I will probably be able to see what's wrong and update this answer.
UPDATE:
You are missing UseDataDictionary=Y from your config, though that's not the cause of your problem. (You need it to receive messages correctly, though.)
Also, you don't need AppDataDictionary -- that's only for FIX 5+.

Related

Incorrect NumInGroup count for repeating group (Field=268)

When I recieve a Market Data Snapshot Full Refresh message, my app cannot consume it.
This is how the message looks like:
8=FIX.4.4|9=160|35=W|34=1625|49=DummyBroker|56=DummyID|52=20220201-15:17:17.201806|262=43_MarketDataChange|55=USD/CHF|268=6|269=0|270=0.92282|271=400000|269=1|270=0.92293|271=400000|10=227|
Human readable format (please ignore the Invalid lines):
Error message my app is sending back to the server: Rejected: Incorrect NumInGroup count for repeating group (Field=268)
268=6 seems ok to me, so I am guessing that something is wrong with the DataDictionary.
This is how the message appears in my DataDictionary:
<message name="MarketDataSnapshotFullRefresh" msgtype="W" msgcat="app">
<field name="MDReqID" required="N"/>
<field name="Symbol" required="Y"/>
<group name="NoMDEntries" required="Y">
<field name="MDEntryType" required="Y"/>
<field name="MDEntryPx" required="Y"/>
<field name="MDEntrySize" required="Y"/>
</group>
</message>
Relevant fields:
<field number="268" name="NoMDEntries" type="NUMINGROUP"/>
<field number="269" name="MDEntryType" type="CHAR">
<value enum="0" description="BID" />
<value enum="1" description="OFFER" />
</field>
<field number="270" name="MDEntryPx" type="PRICE"/>
<field number="271" name="MDEntrySize" type="QTY"/>
In my config file ValidateFieldsHaveValues=N, ValidateFieldsOutOfOrder=N.
Anyone knows where the issue is?
As #ChristophJohn mentioned NoMDEntries should be 2 not 6, so the error is on the broker side.
It was already explained here:
what is "NoMDEntries"?
The correct message should look like this:
8=FIX.4.4|9=160|35=W|34=1625|49=DummyBroker|56=DummyID|52=20220201-15:17:17.201806|262=43_MarketDataChange|55=USD/CHF|268=2|269=0|270=0.92282|271=400000|269=1|270=0.92293|271=400000|10=227|

how to add field to product.template in odoo 12

I would like to display a field in Form View of the product module, here is the python file (i use odoo 12.):
class ClassProductInherited:
_inherit = 'product.template'
file = fields.Char(string="Choose File")
Here is xml code (i use odoo 12.):
<record id="view_product_form_inherit" model="ir.ui.view">
<field name="name">product.template.common.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[#name='inventory']/group" position="before">
<group col="2" colspan="2">
<field name="file"/>
</group>
</xpath>
</field>
</record>
When I restart the server, problem is that I have the following error:
File "/home/odoo/models.py", line 1112, in _validate_fields
raise ValidationError("%s\n\n%s" % (_("Error while validating constraint"), tools.ustr(e)))
odoo.tools.convert.ParseError: "Error while validating constraint
Field `file` does not exist
Error context:
View `product.template.common.form.inherit`
[view_id: 2095, xml_id: module.view_product_form_inherit, model: product.template, parent_id: 402]
None" while parsing /home/omar/odoo/custom-addons/addons12/module/views/views.xml:403, near
<record id="view_product_form_inherit" model="ir.ui.view">
<field name="name">product.template.common.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view"/>
<field name="arch" type="xml">
<xpath expr="//page[#name='inventory']/group" position="before">
<group col="2" colspan="2">
<field name="file"/>
</group>
</xpath>
</field>
</record>
1- First, check if the manifest.py file contains:
"depends": [
'product'
],
2- check if the name of your file that contains the class ClassProductInherited: exists in the init.py file like this for example:
from . import my_file
<record id="view_product_form_inherit" model="ir.ui.view">
<field name="name">product.template.common.form.inherit</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[#name='weight']" position="before">
<group>
<field name="file"/>
</group>
</xpath>
</field>
</record>
Try this piece of code and let me know if it works.
check in your .py file that you have to inherit only single module in one ... if you declare more than one module in single record so remove it. and make another record for another module. then after check it you declare or note the field file in your .py file

Getting a JSONParseException when indexing fields from MongoDB collection in SOLR using DataImportHandler

I am seeing this exception while I am trying to index data from MongoDB collection :
Exception while processing: products document : SolrInputDocument(fields: []):org.apache.solr.handler.dataimport.DataImportHandlerException: com.mongodb.util.JSONParseException:
{idStr,name,code,description,price,brand,size,color}
^
at org.apache.solr.handler.dataimport.MongoEntityProcessor.initQuery(MongoEntityProcessor.java:46)
at org.apache.solr.handler.dataimport.MongoEntityProcessor.nextRow(MongoEntityProcessor.java:54)
at org.apache.solr.handler.dataimport.EntityProcessorWrapper.nextRow(EntityProcessorWrapper.java:244)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:476)
at org.apache.solr.handler.dataimport.DocBuilder.buildDocument(DocBuilder.java:415)
at org.apache.solr.handler.dataimport.DataImporter.runCmd(DataImporter.java:481)
at org.apache.solr.handler.dataimport.DataImporter$1.run(DataImporter.java:462)
Caused by: com.mongodb.util.JSONParseException:
{idStr,name,code,description,price,brand,size,color}
^
at com.mongodb.util.JSONParser.parseString(JSON.java:387)
Following is my data-source-config file in dataimport directory in conf folder of my core :
<dataConfig>
<dataSource name="mymongodb" type="MongoDataSource" database="mongodb://*.*.*.*/testdb" />
<document name="data">
<entity
name="products"
processor="MongoEntityProcessor"
query="{idStr,name,code,description,price,brand,size,color}"
collection="products"
datasource="mymongodb"
transformer="MongoMapperTransformer" >
<field column="idstr" name="idstr" mongoField="idStr"/>
<field column="name" name="name" mongoField="name"/>
<field column="code" name="code" mongoField="code"/>
<field column="description" name="description" mongoField="description"/>
<field column="price" name="price" mongoField="price"/>
<field column="brand" name="brand" mongoField="brand"/>
<field column="size" name="size" mongoField="size"/>
<field column="color" name="color" mongoField="color"/>
<entity
name="categories"
processor="MongoEntityProcessor"
query="{'idStr':'${categories.idstr}'}"
collection="categories"
datasource="mymongodb"
transformer="MongoMapperTransformer">
<field column="type" name="type" mongoField="type"/>
</entity>
</entity>
</document>
</dataConfig>
I am trying to join the field idStr of categories collection with the idStr of products collection(field name => idstr) and get the above fields ( name,description,... from products and type field from categories).
Any comments/solution on this exception would be really appreciated.Thanks!
Your SOLR field is declared as idstr but you are referencing it in the query attribute of dataConfig as idStr (camelcase difference).
I was able to resolve this ...
Following is the working configuration in the data-source-config file :
<entity
name="products"
query="select idStr,name,code,description,price,brand,size,color from products">
<field name="prodidStr" column="idStr" />
<field name="name" column="name" />
<field name="code" column="name" />
<field name="description" column="description" />
<field name="price" column="price" />
<field name="brand" column="brand" />
<field name="size" column="size" />
<field name="color" column="color" />
<entity
name="categories"
dataSource="mongod"
query="select idStr,ancestors from categories where idStr = '${products.idStr}'">
<field name="catidStr" column="idStr" />
<field name="ancestors" column="ancestors" />
</entity>
</entity>

complex Bean IO record ,multi segments (0-n occurences) pipe delimited

I have a scenario to map user information to Map of Objects (Map or List).
I have say user info as follows
CommonHeader(CX) block followed by 0 or more ID blocks followed by 0 or more Address blocks
Below are valid formats for user records
CX|19981222|19981222|ID|DriversLicence|111111111|ID|Passport|ABC12345|AD|123 Main Street|Atlanta|GA|30316|AD|100 PeachTree RD|Atlanta|Ga|3007|
CX|19981222|19981222|ID|DriversLicence|111111111|ID|Passport|ABC12345|
CX|19981222|19981222|AD|123 Main Street|Atlanta|GA|30316|AD|100 PeachTree RD|Atlanta|Ga|3007|
Is it possible to map such scenarios using beanio ?
Whats the best solution to handle these cases ?
I am using Beanio-2.1
My beanio mapping file is as follows
<stream name="userrRecord" format="delimited">
<parser>
<property name="delimiter" value="|"/>
</parser>
<record name="urecord" class="map" minOccurs="0" maxOccurs="unbounded" >
<segment name="CX" class="map">
<field name="CX"/>
<field name="DateFirstReported" type="date" format="yyyyMMdd"/>
<field name="DateLastReported" type="date" format="yyyyMMdd"/>
</segment>
<segment name="ID" class="map" minOccurs="0" maxOccurs="unbounded" collection="list">
<field name="ID"/>
<field name="IDType"/>
<field name="DocumentID"/>
</segment>
< segment name="AD" class="map" minOccurs="0" maxOccurs="unbounded" collection="list">
<field name="AD"/>
<field name="Street"/>
<field name="City"/>
<field name="State"/>
<field name="Zipcode"/>
</segment>
</record>
</stream>
When I try to unmarshall a record with 2 ID segmenst and 0 AD segments running into InvalidRecord exception.
Any help is highly appreciated.
I think this is not possible, as stated in the BeanIO Reference Guide:
Flat file formats (CSV, delimited and fixed length) may only contain one
field or segment of indeterminate length (i.e. where maxOccurs is greater
than minOccurs). The position of components that follow are assumed to be
relative to the end of the record.
You should change each of your segments to a separate record, and wrap it in a group. Then your sample input will look like this:
CX|19981222|19981222|
ID|DriversLicence|111111111|
ID|Passport|ABC12345|
AD|123 Main Street|Atlanta|GA|30316|
AD|100 PeachTree RD|Atlanta|Ga|3007|
CX|19981222|19981222|
ID|DriversLicence|111111111|
ID|Passport|ABC12345|
CX|19981222|19981222|
AD|123 Main Street|Atlanta|GA|30316|
AD|100 PeachTree RD|Atlanta|Ga|3007|
And your mapping like this:
<stream name="userrRecord" format="delimited">
<parser>
<property name="delimiter" value="|"/>
</parser>
<group name="urecord" class="map" minOccurs="0" maxOccurs="unbounded">
<record name="CX" class="map">
<field name="CX"/>
<field name="DateFirstReported" type="date" format="yyyyMMdd"/>
<field name="DateLastReported" type="date" format="yyyyMMdd"/>
</record>
<record name="ID" class="map" minOccurs="0" maxOccurs="unbounded" collection="list">
<field name="ID"/>
<field name="IDType"/>
<field name="DocumentID"/>
</record>
<record name="AD" class="map" minOccurs="0" maxOccurs="unbounded" collection="list">
<field name="AD"/>
<field name="Street"/>
<field name="City"/>
<field name="State"/>
<field name="Zipcode"/>
</record>
</group>
</stream>

The great OpenERP 7 directory structure mystery

I am currently deploying OpenERP 7 on a CentOS 6.4 machine.
I'm virtualizing the whole thing so that I can backup the whole system if I mess up.
Everything seems to be fine, I changed my models, my views, but it's been 2 days I've been banging my head against a seemingly impossible problem.
My deployment is for a book factory, so the product needed to be customized (number of pages, binding type , and so forth...)
In the new product view, I need something that can sum to fields x_colorpages and x_bwpages to populate a third field: x_totalpages. Easy huh?
I've got my XML , product.normal.form view based on the product.poduct object
When I change the value in "x_paginecolori" or "xpagineBN" it should automatically trigger the onchange function.
So I went in the product module code and coded my cal_change_event
In the python file product.py located in:
/usr/lib/python2.6/site-packages/openerp-7.0_20130524_231019-py2.6.egg/openerp/addons/account/product.py
def cal_change_event(self, cr, uid, ids, x_PagineColori, x_PagineBN):
res = {}
sum = 0
if not x_PagineColori:
return {}
else if not x_PagineBN:
return {}
else:
sum = x_PagineColori + x_PagineBN
res={'x_pagine':sum }
return {'value':res}
NO matter what i do , the onchange event will allways trigger a warning popup:
File "/usr/lib/python2.6/site-packages/openerp-7.0_20130524_231019-py2.6.egg/openerp/osv/osv.py", line 185, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
AttributeError: 'product.product' object has no attribute 'cal_change_event'
It seems to me that the function is not seen, where should I put it?
How can Product.Product not have this attribute if I placed it in the class inside product.py?
I grep'd the whole CENTOS installation in search for multiple instances of openerp , or to see if I missed something about product.py
It seems that the product.py is not the right file, even if I erase other On_change functions, nothing bad really happens.
But the directory must be right, because the error log gives me that same location in the debug popup window.
Should I be building a custom module fron scratch to make this work? Is it forbidden somehow to modify the standard product module?
Thanks in advance for any insight, my brain is defaulting on this one.
here is my Xml:
<?xml version="1.0"?>
<form string="Product" version="7.0">
<sheet>
<div>
<label for="x_partner2" string="Cliente Referente del prodotto"/>
<field name="x_partner2" />
</div>
<field name="image_medium" widget="image" class="oe_avatar oe_left"/>
<div class="oe_title">
<div class="oe_edit_only">
<label for="name" string="Product Name"/>
</div>
<h1>
<field name="name"/>
</h1>
<label for="categ_id" class="oe_edit_only"/>
<h2><field name="categ_id"/></h2>
<div name="options" groups="base.group_user">
<field name="sale_ok"/>
<label for="sale_ok"/>
</div>
</div>
<div class="oe_right oe_button_box" name="buttons">
</div>
<notebook>
<page string="Information">
<group>
<group>
<field name="type"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)" groups="product.group_uom"/>
<field name="list_price"/>
</group>
<group>
<field name="default_code"/>
<label for="ean13"/>
<div name="ean">
<field name="ean13" placeholder="e.g. 5901234123457"/>
</div>
</group>
<group>
<field groups="product.group_product_variant" name="variants"/>
<field name="price_margin" groups="product.group_product_variant"/>
<field name="price_extra" groups="product.group_product_variant"/>
</group>
</group>
<field name="description" placeholder="describe the product characteristics..."/>
</page>
<page string="Dati del volume Universal Book">
<group>
<group>
<field name="x_DataCreazione" />
<field name="x_DataUltimaModifica" />
<field name="x_Autore" />
<field name="x_Larghezza"/>
<field name="x_Altezza" />
<field name="x_Dorso"/>
<field name="x_Rilegatura" />
<field name="x_volumiformati" />
</group>
</group>
<group>
<field name="x_PagineColori" on_change="cal_change_event(x_PagineColori,x_PagineBN)" />
<field name="x_PagineBN" on_change="cal_change_event(x_PagineColori,x_PagineBN)" />
<field name="x_pagine" />
</group>
<group>
<field name="x_prezzo" />
</group>
</page>
<page string="Copertina">
<group>
<group>
<field name="x_TipoCartaCopertina"/>
<field name="x_TipoStampaCopertina"/>
<field name="x_TipoFFR"/>
<field name="x_PlastificazioneCopertina" />
<field name="x_NumeroCopertinePerPagina" />
</group>
<group>
<field name="x_TipoCartaSovracopertina"/>
<field name="x_TipoStampaScopertina"/>
<field name="x_TipoFFRSovracopertina"/>
<field name="x_PlastificazioneSovracopertina"/>
</group>
</group>
<label for="x_aletta" string="Libro con alette?"/>
<field name="x_aletta" />
<label for="x_Note" string="Note"/>
<field name="x_Note" />
</page>
<page string="Margini">
<group>
<field name="x_pagriferimento"/>
<field name="x_MargineDestro"/>
<field name="x_MargineDestro"/>
<field name="x_MargineInferiore" />
<field name="x_MargSinistro" />
<field name="x_MargineSuperiore"/>
<field name="x_RiferimentoLIFRE" />
<field name="x_MergineSuperioreLIFRE" />
<field name="x_MargineInferioreLIFRE" />
</group>
</page>
<page string="Procurements" groups="base.group_user">
<group name="procurement">
<group name="general">
<field name="cost_method" groups="product.group_costing_method"/>
<field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
</group>
<group name="procurement_uom" groups="product.group_uom" string="Purchase">
<field name="uom_po_id"/>
</group>
</group>
<separator string="Description for Suppliers"/>
<field name="description_purchase" placeholder="This note will be displayed on requests for quotation..."/>
</page>
<page string="Inventory" groups="base.group_user">
<group name="inventory">
<group name="status" string="Status">
<field name="state"/>
<field name="product_manager"/>
</group>
<group name="Weights" groups="product.group_stock_packaging" string="Weights">
<field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
<field name="weight" attrs="{'readonly':[('type','=','service')]}"/>
<field name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
</group>
</group>
</page>
<page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}">
<group name="sale">
<group string="Sale Conditions">
<label for="warranty"/>
<div>
<field name="warranty" class="oe_inline"/> months
</div>
</group>
<group groups="product.group_uos" string="Unit of Measure">
<field name="uos_id"/>
<field name="uos_coeff"/>
<field name="mes_type"/>
</group>
</group>
<field name="packaging" groups="product.group_stock_packaging">
<form string="Packaging" version="7.0">
<group col="4">
<field name="ean"/>
<field name="sequence" invisible="1"/>
<newline/>
<field name="qty"/>
<field name="ul"/>
<field name="weight_ul"/>
<separator colspan="4" string="Palletization"/>
<field name="ul_qty"/>
<field name="rows"/>
<field name="weight"/>
<separator colspan="4" string="Pallet Dimension"/>
<field name="height"/>
<field name="width"/>
<field name="length"/>
</group>
<separator colspan="4" string="Description"/>
<field name="name"/>
</form>
</field>
<separator string="Description for Quotations"/>
<field name="description_sale" placeholder="note to be displayed on quotations..."/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
It's not forbidden to modify the standard modules, but it is generally recommended to write your own modules to extend OpenERP.
I don't know how much experience you've got with OpenERP (if you are new to OpenERP, the problem could be caused by very simple mistakes), so forgive me for assuming you are a newbie.
Have you restarted OpenERP and reinstalled the product module?
Is the cal_change_event() method defined in a class whose _name = "product.product" ?
Could you post your XML code? The problem could be nothing to do with your Python code.
All the code here works FINE. The problem seemed to be my CENTOS install.
This code works correctly on WINDOWS and a new XUBUNTU Machine I just made.
Unfortunately the reason why it didn't work in CentOS still eludes me.
I'm closing this topic, hopefully the code pf my .XML and .PY can be a useful template for all those who wish to have personalized fields in their products and have them interactively change. thanks Wenshan for your assistance, as you noticed in the beginning, nothing was wrong with the code.