insert into database the input fields - database

HI guys I have two fields code and name I want to insert into the database the user inputs when they fill the form (I use a wizard)
.py
class cria_edita_recinto(osv.osv):
_name='cria.edita.recinto'
_description = 'Cria e Edita Recinto'
_rec_name='code'
_columns={
'code':fields.char("Código",size=10),
'name':fields.char("Designação",size=50)
}
_sql_constraints = [
('code', 'unique(code)', 'O codigo do recinto deve ser unico')
]
_order = 'code'
def insert_recinto(self,cr, uid,vals, context=None):
lista=vals.values()
code=lista[0]
cr.execute("INSERT INTO gs_recintos (code,name) VALUES (%s,'jt')" %(code))
return True
cria_edita_recinto()
.xml
<record model="ir.ui.view" id="cria_edita_recinto_form">
<field name="name">cria.edita.recinto.form</field>
<field name="model">cria.edita.recinto</field>
<field name="arch" type="xml">
<form string="cria edita recinto" version="7.0">
<group string=" ">
<field name="code"/>
<field name="name"/>
</group>
<footer>
<button name="insert_recinto" string="Configurar Pisos" type="object" class="oe_highlight"/>
ou
<button string="Cancelar" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
I have an image if you could help see here
http://help.openerp.com/question/46472/insert-into-database-the-input-fields/

In openerp 7 osv.osv is deprecated you may use orm.Model
Here the guide lines to write a good code for openerp.
the class that you have post is a module class, but if you would write a record with a wizard
you need to insert insert_recinto method inside a wizard class and not inside a model class.
after in your wizard insert_recinto method you may to write a data in with the orm method like as your_class_object.write(cr,uid,id,vals,context).

I resolved this problem....
<group string=" ">
<field name="code"/>
<field name="name"/>
<field name="nameBilhetes"/>
<field name="recinto_id" on_change="insert_piso(code,name,nameBilhetes,recinto_id)"/>
</group>
I use the on change method and on the .py i use
I query to insert into the Database.
Please mark this answer with the tick this solution resolve my problem

Related

Redux Forms Field not populating values

This is my code in my form component:
{console.log('Value matching name for Field: ', props.initialValues.name)}
<Field
name="name"
//also tried name="props.initialValues.name"
component="input"
type="text"
placeholder="Name required"
/>
The console log correctly outputs the name value needed.
The <Field/> component never shows the name value that is console logged.
I cannot find an answer in RF documentation or anywhere else.
Using ReduxForms version 8.

VXML call transfer

I wrote an VXML file where first when user entered the system he listens welcome audio source, then he needs to enter a number for transferring call to the number that he entered. If a user does not enter a number so call must be transferred to operator with number 2212. But this vxml does not transfer any call, where I have made mistake and how can I fix it?
<vxml version="2.0">
<var name="number"/>
<form id="main">
<field name="phone" type="digits?length=4">
<grammar mode="dtmf" type="application/grammar+regex">[0123456789] </grammar>
<prompt bargein="false" timeout ="60">
<audio src="flash:welcome.au"/>
</prompt>
<noinput>
<transfer name="transferToOperator" dest="phone:2212">
</noinput>
<nomatch>
<transfer name="transferToOperator" dest="phone:2212">
</nomatch>
<filled>
<assign name="number" expr="phone"/>
<transfer name="transferToInputNumber" dest="phone:number">
</filled>
</field>
</form>
dest="phone:2212" may be valid for your platform, but the specification says this should be:
dest The URI of the destination (telephone, IP telephony address).
Platforms must support the tel: URL syntax described in [RFC2806] and
may support other URI-based addressing schemes.
So your attribute should be: dest="tel:2212"
You have made use mistake in your application code with wrong use of tag
See the parent - child relationship of vxml application tag here:
http://help.voxeo.com/go/help/xml.vxml.elements.overview
As per your given application code, you can do like this:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<var name="number"/>
<form id="main">
<field name="phone" type="digits?length=4">
<grammar mode="dtmf" type="application/grammar+regex">[0123456789] </grammar>
<prompt bargein="false" timeout ="60s">
<audio src="flash:welcome.au"/>
</prompt>
<noinput>
<goto nextitem="transferToOperator"/>
</noinput>
<nomatch>
<goto nextitem="transferToOperator"/>
</nomatch>
<filled>
<assign name="number" expr="phone"/>
<goto nextitem="transferToInputNumber"/>
</filled>
</field>
<transfer name="transferToOperator" dest="tel:2212">
<filled>
<disconnect/>
</filled>
</transfer>
<transfer name="transferToInputNumber" dest="tel:number">
<filled>
<disconnect/>
</filled>
</transfer>
</form>
</vxml>

ExtJs4 - Form defined in javascript multicombo loaded at runtime

When the form is initially loaded the multicombo on the form correctly reflects the data that is set up.
However, if I attempt to update the information at runtime, the list of options in the multicombo aren't updated when the form is displayed.
I have them successfully defined as form options, they have a simple 'text' only store. However, I can't seem to find the correct set of properties and method to actually update the multicombo from the C# code as needed.
I've noticed this as well. You can set the Ext.net.ListItems on page-load but they are fickle when it comes to setting them dynamically in code-behind. I now always use a Ext.net.Store with any Multicombo or ComboBox that needs to dynamically change.
You can use the Handler events on Focus or BeforeSelect to reload the list.
<ext:ComboBox ID="ComboBoxTransferGroupMembers" runat="server" FieldLabel="Transfer To" EmptyText="Group Members" LabelAlign="Top" DisplayField="Name" ValueField="Id" MarginSpec="0 0 5">
<Listeners>
<Focus Handler="#{ComboBoxTransferGroupMembers}.store.reload()" />
</Listeners>
<Store>
<ext:Store runat="server" OnReadData="StoreTransferGroupMember_ReadData" ID="StoreXferGroup">
<Model>
<ext:Model IDProperty="Id" runat="server">
<Fields>
<ext:ModelField Name="Name" />
<ext:ModelField Name="Id" />
</Fields>
</ext:Model>
</Model>
<Parameters>
<ext:StoreParameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</Parameters>
</ext:Store>
</Store>
<DirectEvents>
<Select OnEvent="ComboBoxTransferGroupMembers_Select">
<ExtraParams>
<ext:Parameter Mode="Raw" Name="Group" Value="#{ComboBoxTransferGroup}.getValue()" />
</ExtraParams>
</Select>
</DirectEvents>
</ext:ComboBox>

Lightning Component not showing on Lightning Tab

I am not able to see my lightning component when trying to create a lighting tab. Something is wrong with one of the components -
I moved the component and tab using salesforce dx and when editing the component. I am getting below error. I seems like one of the component is throwing an error when i am trying to edit the record -
Error = Review all error messages below to correct your data.
You can only create lightning tabs for AuraDefinitionBundles containing a component that implements force:appHostable and has no required attributes without a default value. (Related field: Content)
Observation - When i remove the attribute from parent component and child component than its working and i am able to save the tab. Something is not correct with my component initiation.
Code in parent Component -
<aura:if isTrue="{!!v.customTab}">
<div aura:id="defaultTabContent" class="slds-show">
<c:ApiRequestFieldMapping custom="false" objectName="Credit_Report__c"/>
</div>
</aura:if>
<aura:if isTrue="{!v.customTab}">
<div aura:id="customTabContent" class="slds-hide">
<c:ApiRequestFieldMapping custom="true" listSObjects="
{!v.listSObjects}" message="Select object from drop-down."
messageClass="Info"/>
</div>
Code in Child Component -
<aura:handler name="init" action="{!c.doInit}" value="{!this}"/>
<aura:registerEvent name="handleModelVisiblity" type="c:HandleModel"/>
<!-- attributes -->
<aura:attribute name="custom" type="Boolean"/>
<aura:attribute name="objectName" type="String"/>
<aura:attribute name="listSObjects" type="String[]"/>
<aura:attribute name="message" type="String"/>
<aura:attribute name="messageClass" type="String"/>
<aura:attribute name="listSObjectFields" type="String[]"
required="false"/>
<aura:attribute name="customObjectName" type="String"
required="false"/>
<aura:attribute name="listWrapper"
type="RequestMappingWrapper.MappingRecords[]" required="false"/>
Already Tried - 1. My component is already implementing "force:appHostable" interface.
2. The component us using latest version.(40.0)
3. Have already tried creating the components.
4. My org has my domain enabled and also have namespace.
I have fixed the issue. I have removed the reference to inner class in one of the attribute. Changed "RequestMappingWrapper.MappingRecords[]" to "RequestMappingWrapper[]".

Joomla 3.3.6 user profile form validation

I am trying to add validation to fields in user profile form.So I added
<field
name="postal_code"
type="text"
id="postal_code"
**class="validate-numeric"**
description="PLG_USER_PROFILE_FIELD_POSTAL_CODE_DESC"
filter="string"
label="PLG_USER_PROFILE_FIELD_POSTAL_CODE_LABEL"
size="30"
/>
to plugins\user\profile\profiles\profile.xml.Its working fine with user registration.How can this be resolved?
Create a class JFormRulePostal_code extending JFormRule in libraries/joomla/form/rule/ and change type="postal_code" and class="postal_code.

Resources