VXML: Field input, forward typing - input

Situation:
I have two VXML documents that are part of one flow. In the first document the user is prompted to enter a number (dtmf, max = 3 digits). The second document prompts the user to enter another number (dtmf, max = 10 digits).
Problem:
When the user is prompted to enter the first number and he enters 4 digits (e.g. 1234), the last number (4) is used as input for the second field.
Expected:
The last number must be ignored. I expect that a "nomatch" event is thrown because I define that the maxlength = 3.
Document 1:
<form>
<field name="input1" type="digits?minlength=1;maxlength=3">
<audio src="prompt1"/>
<filled>
<submit next="next.jsp" namelist="input1" />
</filled>
</field>
Document 2:
<form>
<field name="input2" type="digits?minlength=1;maxlength=10">
<audio src="prompt2"/>
<filled>
<submit next="next2.jsp" namelist="input2" />
</filled>
</field>
Question:
How can I solve this issue in VXML?

Try to set "termtimeout" property.
It means "The terminating timeout to use when recognizing DTMF input."
For example
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<form>
<property name="termtimeout" value="0s" />
<field name="input1" type="digits?minlength=1;maxlength=3">
<filled>
<submit next="next.jsp" namelist="input1" />
</filled>
</field>
</form>
</vxml>

Related

Odoo Overwrite delete record confirmation dialog

Hello I need to add some information to the delete record confirmation dialog on Odoo 12, adding some information of how many dependent records will be deleted. Something like:
Are you sure you want to delete this record ?
Doing this you will lose N records.
Currently is defined on "addons/web/static/src/js/views/basic/basic_controller.js" on _deleteRecords method. But if I change it there it will be changed for all my modules.
I'm wondering if there is a method to overwrite this... Or my other idea is to hide the button and use a wizard to do it.
any idea?
By default odoo can do that from xml file but if you need dynamic message than
please create one transient model for wizard and this model have two fields which is your message field and your main form view id after that you simply override the method unlink and in method do your computations if you want confirmation in deletion then return from that condition like this:
return{
'type':'ir.actions.act_window',
'name':'Message',
'res_model':'your.wizard.model',
'view_type':'form',
'view_mode':'form',
'target':'new',
'context':{'thesis_obj':self.id,'text_message_field':'course Work completed'},
'res_id':value.id
}
After wizard opened you have your wizard's form view right?
in wizard form view if user click on OK button then call your original method from which you have to do it in first place.
Wizard View Reference:
<record id="wizard_message_form_view" model="ir.ui.view">
<field name="name">Approval Message</field>
<field name="model">your.wizard.model</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Message">
<separator string="Message" colspan="6"/>
<field name="text_message" colspan="4" nolabel="1" readonly="1" widget="html"/>
<newline/>
<separator colspan="6"/>
<footer>
<button name="btn_approve_oric" type="object" string="OK" class="oe_highlight"/>
<button special="cancel" string="No"/>
</footer>
</form>
</field>
Feel free to ask.

Use context in odoo 9

I have two forms. First task_view.xml display all task for all users. In second form user_view.xml after open one user I'm add
button
<button class="oe_inline oe_stat_button" style="float:right;" type="action" icon="fa-folder" name="%(task_view_form)d"
context="{'??????}">
<field string="total" name=total_qty" widget="statinfo" />
</button>
Now when click on button I get all task for all users, how use context or any other solution after click on button I need (filter) only task for that users.
I need filter project_task_user_id = id user from form where is placed button.
Try this:
context="{'search_default_project_task_user_id ': active_id}"
I think to achieve this you need to add the domain to you action:
<record id="task_view_form" ...>
...
...
<field name="domain">[('project_task_user_id','=' , uid)] </field>
</record>

How to hide edit/create button on form by conditions?

I'm a new Odoo developer and I need to hide the edit button when my form is entering a custom state, I need this because of a security problem.
This code in XML does not work when I try to give an attribute to the form.
<record model="ir.ui.view" id="pesan_form_view">
<field name="name">pesan_service_form</field>
<field name="model">pesan.service</field>
<field name="arch" type="xml">
<form string="Booking Service" attrs="{edit:'false':[('state','in','baru')]}">
<!-- structure of form -->
</record>
I don't know why it doesn't work.
qWeb conditions doesn't work for FormView.
You can check it here(path_to_odoo/addons/web/static/src/js/framework/view.js):
/**
* Return whether the user can perform the action ('create', 'edit', 'delete') in this view.
* An action is disabled by setting the corresponding attribute in the view's main element,
* like: <form string="" create="false" edit="false" delete="false">
*/
is_action_enabled: function(action) {
var attrs = this.fields_view.arch.attrs;
return (action in attrs) ? JSON.parse(attrs[action]) : true;
},
This method calls from template FormView.buttons in path_to_odoo/addons/web/static/src/xml/base.xml:
<button t-if="widget.is_action_enabled('edit')"
type="button"
class="oe_form_button_edit btn btn-default btn-sm" accesskey="E">
Edit
</button>
These problems are solved in Odoo with the help of rules(ir.rule object of Odoo)
You can find and edit rules in GUI here: Settings(top menu) -> Security(left menu) -> Access Rules(left menu). Use admin user in debug mode for this.
At the same you can add some rules to data.xml of your module for import. They will be added when you install or update module.
Be careful! Record rules do not apply to the Administrator user.
At the same you can try to expand widget FormView.
Hope this helps you.
Try this code.
<record model="ir.ui.view" id="pesan_form_view">
<field name="name">pesan_service_form</field>
<field name="model">pesan.service</field>
<field name="arch" type="xml">
<form string="Booking Service" attrs="{'edit': [('state', 'in', ['baru'])]}">
<!-- structure of form -->
</record>

How can I control the key with IzPack class?

I'm trying to control the product key with IzPack. I did it with RegularExpressionClass but, I should write my own class to control lots of key.
I use it as below, but I can not do the same thing with the class.
<userInput>
<panel id="keyControl">
<field type="rule" align="left" variable="the.password">
<spec txt="the key:"
layout=" O:6:6 "/>
<validator class="com.j32bit.installer.validator.RegularExpressionValidator" txt="wrong key!!" id="lang pack key for the error text">
<param name="pattern" value="asd"/>
</validator>
</field>
</panel>
</userInput>
I hope, my explanation is understandable.
Thanks for help.
You can change the message by overriding getErrorMessageId method with your validator class:
#Override
public String getErrorMessageId()
{
return "Your.error.message";
}
Where Your.error.message points to the particular key from CustomLangPack XML file(s):
<str id="Your.error.message" txt="Enter text here" />

Craigslist API - how to post with RSS data?

http://www.craigslist.org/about/bulk_posting_interface - it says, "New postings are submitted to craigslist in RSS format with additional craigslist-specific elements via HTTPS POST"
How do I post a form passing rss data?
I was hoping to just have something like this:
<form action="https://post.craigslist.org/bulk-rss/post" type="post">
<input type="hidden" name="area" value="richmond" />
<input type="hidden" name="category" value="free" />
<input type="hidden" name="reply-email" value="x#y.com" />
</form>
But, it says I have to supply the data in RSS format.
So is it something like this?
<form action="https://post.craigslist.org/bulk-rss/post" type="post">
<input type="hidden" value="{all the RSS data goes here??}" />
</form>
Any help is super appreciated. Eventually I'd like to build an android app that posts to Criagslist, but, just want to get a simple html form to test for proof of concept for now. Thanks!
I've been trying to figure this out, too, but from what I have read about this RSS interface it is only available for non-free categories like employment and real estate postings. Those categories require you to purchase blocks of posting credits.
IMO this is a good reason not to use Craigs List. If anything, they should open up the RSS interface to all categories and perhaps limit the rate of posting for free ads and/or let people buy blocks for other categories.
The format of the request will look like this
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:cl="http://www.craigslist.org/about/cl-bulk-ns/1.0">
<channel>
<items>
<rdf:li rdf:resource="NYCBrokerHousingSample1" />
</items>
<cl:auth username="Vusername#gmail.com" password="password" accountID="14" />
</channel>
<item rdf:about="NYCBrokerHousingSample1">
<cl:category>fee</cl:category>
<cl:area>nyc</cl:area>
<cl:subarea>mnh</cl:subarea>
<cl:neighborhood>Upper West Side</cl:neighborhood>
<cl:housingInfo price="1450" bedrooms="0" sqft="600" />
<cl:replyEmail privacy="C">bulkuser#bulkposterz.net</cl:replyEmail>
<cl:brokerInfo companyName="Joe Sample and Associates" feeDisclosure="fee disclosure here" />
<title>Spacious Sunny Studio in Upper West Side</title>
<description><![CDATA[posting body here]]></description>
</item>
<item rdf:about="NYCBrokerHousingSample2">
<cl:category>fee</cl:category>
<cl:area>nyc</cl:area>
<cl:subarea>mnh</cl:subarea>
<cl:neighborhood>Chelsea</cl:neighborhood>
<cl:housingInfo price="2175" bedrooms="1" sqft="850" catsOK="1" />
<cl:mapLocation city="New York" state="NY" crossStreet1="23rd Street" crossStreet2="9th Avenue" latitude="40.746492" longitude="-74.001326" />
<cl:replyEmail privacy="C" otherContactInfo="212.555.1212">bulkuser#bulkposterz.net</cl:replyEmail>
<cl:brokerInfo companyName="Joe Sample and Associates" feeDisclosure="fee disclosure here" />
<title>1BR Charmer in Chelsea</title>
<description><![CDATA[posting body goes here]]></description>
<cl:PONumber>Purchase Order 094122</cl:PONumber>
<cl:image position="1">/9j/4AAQSkZJRgABAQEASABIAAD/4QCARXhpZgAATU0AKgAAAAgABQESAAMAA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