How to trigger checkboxes with XFDF - pdf

Here is what I have:
<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
<field name="text1">
<value>First Last</value>
<field name="checkbox1">
<value>yes</value>
</field>
<field name="checkbox2">
<value></value>
</field>
<ids original="xxxxx" modified="1331062234" />
<f href="http://example.com/test.pdf" />
</xfdf>
The text value gets entered in the PDF, but I can't figure out how to get the checkboxes to recognize that they are checked.

<input type="checkbox" name="checkbox_name" value="yes" />
The xfdf value entry needs to match the checkbox value:
<field name="checkbox_name">
<value>yes</value>
</field>

Related

Create cron task in Odoo13

I am working on a new module in Odoo13CE and trying to create a scheduled task with the code:
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">
<record forcecreate="True" id="electricity_charges_cron" model="ir.cron">
<field name="name">Get electricity charges</field>
<field name="model_id" ref="electricity_charges.model_electricity_charges_readings"/>
<field name="active" eval="True" />
<field name="state">code</field>
<field name="code">model.set_readings()</field>
<field name="interval_number">6</field>
<field name="interval_type">hours</field>
<field name="numbercall">-1</field>
<field name="active" eval="False" />
<field name="doall" eval="True" />
<field name="user_id" ref="base.user_root" />
</record>
</data>
</odoo>
But when install or update the module this error appears:
odoo.tools.convert.ParseError: "null value in column "activity_user_type" violates not-null constraint
Any idea how I can resolve this error? Have the mail module installed.

Odoo - How to update non updateable records by XML

I have created a few companies under res.company
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="True">
<record id="partner_my_company_hk" model="res.partner" context="{'default_is_company': True}">
<field name="name">My company HK</field>
<field name="company_id" eval="None"/>
<field name="customer" eval="False"/>
<field name="is_company" eval="True"/>
<field name="street"></field>
<field name="city"></field>
<field name="zip"></field>
<field name="phone"></field>
<field name="email">info#my_company.com</field>
<field name="website">www.my_company.com</field>
<field name="image" type="base64" file="base/static/img/res_company_logo.png"/>
</record>
<record id="partner_my_company_us" model="res.partner">
<field name="name">My company US</field>
<field name="company_id" eval="None"/>
<field name="customer" eval="False"/>
<field name="is_company" eval="True"/>
<field name="street"></field>
<field name="city"></field>
<field name="zip"></field>
<field name="phone"></field>
<field name="email">info#my_company.com</field>
<field name="website">www.my_company.com</field>
<field name="image" type="base64" file="base/static/img/res_company_logo.png"/>
</record>
<record id="company_my_company_hk" model="res.company">
<field name="name">My company HK</field>
<field name="partner_id" ref="partner_my_company_hk"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record id="partner_my_company_hk" model="res.partner">
<field name="company_id" ref="company_my_company_hk"/>
</record>
<record id="company_my_company_us" model="res.company">
<field name="name">My company US</field>
<field name="partner_id" ref="partner_my_company_us"/>
<field name="currency_id" ref="base.USD"/>
</record>
<record id="partner_my_company_us" model="res.partner">
<field name="company_id" ref="company_my_company_us"/>
</record>
</data>
</odoo>
This is my original res_users.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="base.user_admin" model="res.users">
<field name="groups_id" eval="[(4, ref('account.group_account_user'))]"/>
</record>
</data>
</odoo>
So I want to set those 2 newly created 2 companies into base.user_admin
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="base.user_admin" model="res.users">
<field name="groups_id" eval="[(4, ref('account.group_account_user'))]"/>
<field name="company_id" ref="company_my_company_hk" />
<field name="company_ids" eval="[(4, ref('company_my_company_hk')),(4, ref('company_my_company_us'))]" />
</record>
</data>
</odoo>
And it is not working. But when I uninstall the module and reinstall it works.
Why? I cannot uninstall the module just to make it work in the future. What are the limitations and how to bypass the limits?
You can change the noupdate value on XML, change the desired fields and should take the change on noupdate back.
<!-- Allow updating on noupdate=True records -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'base'), ('name', '=', 'user_admin')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="base.user_admin" model="res.users">
<!-- change fields here -->
</record>
<!-- Revoke noupdate change -->
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'base'), ('name', '=', 'user_admin')]" />
</function>
<value eval="{'noupdate': True}" />
</function>
External ID user_admin in base has been marked as noupdate.
And noupdate cannot be overridden.
Unless I run
UPDATE ir_model_data SET noupdate=False WHERE name = 'user_admin' and module='base';
Otherwise I won't be able to update it when I upgrade the module
More refined solution to #CZoellner 's solution is:
<function name="toggle_noupdate" model="ir.model.data" eval="['res.users', ref('base.user_admin')]"/>

Logout when print Qweb report

How can I close the odoo session after printing a qweb report?
What I want is to close session after clicking Sample Report
<?xml version="1.0"?>
<odoo>
<record id="paperformat_euro_landscape"
model="report.paperformat">
<field name="name">European A4 Landscape</field>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
<field name="orientation">Landscape</field>
<field name="margin_top">35</field>
<field name="margin_bottom">15</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False" />
<field name="header_spacing">35</field>
<field name="dpi">90</field>
</record>
<report id="action_mantto_task_report"
string="Sample Report"
model="rep.oper"
report_type="qweb-pdf"
name="repop_report.report_repop_task_template"
paperformat="paperformat_euro_landscape"
/>
</template>
</odoo>

Unable to upack ISO 8583 F137 using JPOS

I'm trying to introduce F137 to my ISO 8583 processing. I'm using following xml configurations in packing and unpacking the ISO message for f137.
<isofield
id="137"
length="2"
name="Application Transaction Counter"
class="org.jpos.iso.IFB_BINARY"/>
I'm able to pack the F137 where I'm able to see F137 in outgoing message,
<send>
<isomsg direction="outgoing">
<header>16010201E10000000000000000000000000000000000</header>
<field id="0" value="0210"/>
<field id="2" value="933456______7663"/>
<field id="4" value="000000000200"/>
<field id="7" value="0906144357"/>
<field id="11" value="123456"/>
<field id="12" value="144357"/>
<field id="13" value="0906"/>
<field id="18" value="6012"/>
<field id="19" value="356"/>
<field id="22" value="0911"/>
<field id="25" value="59"/>
<field id="28" value=" 5 "/>
<field id="32" value="441370"/>
<field id="37" value="727523083909"/>
<field id="38" value="231043"/>
<field id="39" value="00"/>
<field id="41" value=" 101"/>
<field id="42" value="CA-IDCode-77765"/>
<isomsg id="43">
<!-- org.jpos.iso.packager.GenericSubFieldPackager -->
<field id="1" value="Acceptor 11 "/>
<field id="2" value="NW "/>
<field id="3" value="IN"/>
</isomsg>
<isomsg id="44">
<field id="15" value="4233"/>
</isomsg>
<field id="48" value=" 3"/>
<field id="49" value="356"/>
<field id="55" value="AA55AA55" type="binary"/>
<field id="59" value="CA123700052"/>
<field id="60" value="9100F0000500" type="binary"/>
<isomsg id="62">
<!-- org.jpos.iso.packager.GenericSubFieldPackager -->
<field id="1" value="1"/>
<field id="2" value="153621623779500"/>
<field id="7" value="11234123412341234123412345"/>
<field id="20" value="0000909090"/>
</isomsg>
<isomsg id="63">
<!-- org.jpos.iso.packager.Base1SubFieldPackager -->
<field id="13" value="02F0F0"/>
<field id="19" value="210"/>
</isomsg>
<field id="102" value="00023830"/>
<field id="104" value="5700040102D7D75F00761006F0F6F5F4F3F40105F1F2F3F4F50210F6F5F4F3F2F1F0F0F0F0F3F3F4F2F3F3030997998182A4848488810404A385A2A30509A289958781979699850602E2D50709A289958781979699850802F0F10A0ED985838997898595A340D58194850C09A289958781979699850D09A28995878197969985" type="dataset" />
<field id="119" value="35623"/>
<!-- 123{ 68{02:10, 03:12321232123, 04:123412341}} -->
<field id="123" value="68001C0202F1F0030BF1F2F3F2F1F2F3F2F1F2F30409F1F2F3F4F1F2F3F4F1" type="dataset" />
**<field id="137" value="1232" type="binary"/>**
</isomsg>
</send>
but during unpacking jpos throws following exception.
<session-error>
<iso-exception>
org.jpos.iso.IFB_LLHNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 96 too long. Max: 11) unpacking field=32, consumed=54
org.jpos.iso.ISOException: org.jpos.iso.IFB_LLHNUM: Problem unpacking field 32 (org.jpos.iso.ISOException: Field length 96 too long. Max: 11) unpacking field=32, consumed=54
at org.jpos.iso.ISOBasePackager.unpack(ISOBasePackager.java:265)
at org.jpos.iso.ISOMsg.unpack(ISOMsg.java:420)
at org.jpos.iso.BaseChannel.unpack(BaseChannel.java:924)
at org.jpos.iso.BaseChannel.receive(BaseChannel.java:692)
at org.jpos.iso.ISOServer$Session.run(ISOServer.java:155)
at org.jpos.util.ThreadPool$PooledThread.run(ThreadPool.java:72)
</iso-exception>
Does JPOS support fields greater than F128. Btw Application works properly without F137.
ISO-8583 defines 128 fields. Systems that use fields beyond 128 are quite unusual, and weird (I see this sample message seems to come from Bhutan). That said, jPOS supports them.
I suggest you search the jPOS forum for the keyword 'tertiary bitmap':
https://groups.google.com/forum/#!searchin/jpos-users/tertiary$20bitmap%7Csort:date

Update data file

(version 9)
i need to update odoo/openerp/addons/base/res/res_currency_data.xml file
i created module added field to res.currency and added data file in my modules data folder. but my field is not updating. any suggestions?
from openerp import models, fields
class ResCurrency(models.Model):
_inherit = 'res.currency'
currency_word = fields.Char(translate=True, help='HELP')
and this is my data xml file.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<!-- Currencies -->
<record id="base.USD" model="res.currency">
<field name="currency_word">Dollars</field>
</record>
</data>
</openerp>
and xml for field to show up in form view.
<openerp>
<data>
<record id="view_currency_form" model="ir.ui.view">
<field name="name">res.currency.form</field>
<field name="model">res.currency</field>
<field name="inherit_id" ref="base.view_currency_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="currency_word"/>
</field>
</field>
</record>
</data>
</openerp>
this is a workaround for noupdate=1
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'base'), ('name', '=', 'USD')]" />
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="base.USD" model="res.currency">
<field name="currency_word">Dollars</field>
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value eval="[('module', '=', 'base'), ('name', '=', 'USD')]" />
</function>
<value eval="{'noupdate': True}" />
</function>