Joomla 3 Article Modal form field in custom module - module

I want to have an article picker in my custom module. A button and a form field like this one in add new article.
Is ist possible?
I tried this in my module xml:
<field name="article_id" type="modal_article" default="" label="Select an article" description="" />
But I only get a form input, not a button to choose an article.

You need to manually add the path to the modal article element.
In the < fieldset > element just above the modal_article field type, add the following attribute:
addfieldpath="/administrator/components/com_content/models/fields"
So your final xml would look something like this:
<fieldset name="basic" addfieldpath="/administrator/components/com_content/models/fields">
<field name="article_id" type="modal_article" default="" label="Select an article" description="" />

Related

How to autofocus some field in tree view on "add new" button?

For example, I have this tree view in one2many field:
<tree editable="bottom" class="check_class">
<field name="check" class="oe_edit_only" string=" "/>
<field name="description" decoration-crossed="check == True" string="Чек лист"/>
</tree>
When I click button "add new", in tree view appears a new line and focus go to first field. I want to autofocus second field. Is there some parameter or attribute to achieve this?

how hide button if have same name with different field based on user selection

For example below mentioned code
<button name="invoice_recreate" string="Recreate Invoice"/>
<button name="invoice_corrected" string="Ignore Exception" />
Add the field selection to the view and the attrs attribute to the button like this:
<field name="selection_field" invisible="1" />
<button name="invoice_recreate"
string="Recreate Invoice"
attrs="{'invisible': [('selection_field', '=', 'value')]}" />
<button name="invoice_corrected"
string="Ignore Exception"
attrs="{'invisible': [('selection_field', '!=', 'value')]}" />
I am not sure if this is what you are asking for, let me know if you are asking anything different

Adding menu to Odoo 10 in custom module

I want to add a submenu to Settings->Technical menu in Odoo 10.
I have tried with the following code, apparently the menu item is loaded (you can see that it is one of the menus created by the custom module) but it is not displayed.
Any tip/suggestion on why?
<?xml version="1.0"?>
<odoo>
<menuitem id="sale_order_custom_document"
name="Sale Order Custom Documen"
parent="base.menu_custom"
/>
</odoo>
Thanks
You have to define the action in menuitem then only it is visible. menuitem without any action will became normal string for display purpose. So either add sub menu with action or directly assign any action to it.
<menuitem name="Sale Order Custom Document" action="<your_action_id>" id="sale_order_custom_document" parent="base.menu_custom" sequence="20"/>
Here's a description link for odoo action
you must also create the actions 's record named:
product.product_template_action_custom_docs for example
declare your menu just after
Try this:
<odoo>
<data>
<!-- your initial code in your <app>_view.xml -->
<record id="product.product_template_action_custom_docs" model="ir.actions.act_window">
<field name="name">Sale Order Custom Document</field>
<field name="res_model">product.template</field>
<field name="view_mode">tree,kanban,form</field>
<field name="view_type">form</field>
<field name="context">{"search_default_filter_to_sell":1}</field>
<field name="help" type="html">
<p> here you write the help form your form</p>
</field>
</record>
<!-- after the action, you can now paste your menu declaration
your specified "action", "id","name","sequence" and "parent"-->
<menuitem action="product.product_template_action_custom_docs"
id="sale_order_custom_document" parent="base.menu_custom" sequence="20" name="Sale Order Custom Document" />
</data>
<odoo>

How to add icon in list view Odoo?

Is it possible add icon instead text in list view?
Example:
<field name="status" />
If status = phone display (icon="fa-phone) else status = fax display (icon="fa-fax).
Field display with string fax or phone.
You need to change icon name.
Try with this:
<field name="status" invisible='1'/>
<button name="status" icon="fa-check text-success" attrs="{'invisible': ['|',('status','=','phone')]}" />
<button name="status" icon="fa-times-circle text-danger" attrs="{'invisible': ['|',('status','=','fax')]}" />

System should not refresh after clicking on already selected radio button

I have 2 radio buttons , i selected one to them , there is an ajax call when i select that , what i want that there should not be any ajax call when i click on the already selected radio button . How to implement this.
<label for="cooperativeAuthorisedRepresentativeType">#{msg['com.crimsonlogic.egov.rol.rnra.landsubdivision.applicantdetails.cooperative.cooperativeAuthorisedRepresentativeType']}</label>
<h:selectOneRadio id="applicantDetails_cooperative_cooperativeAuthorisedRepresentativeType" required="true"
value="#{landSubdivisionController.cooperativeDetails.repCode}" requiredMessage="#{cmn['rol.common.message.error.RADIO_REQUIRED']}" >
<f:selectItem itemLabel="#{msg['REPRWAND']}" itemValue="REPRWAND" />
<f:selectItem itemLabel="#{msg['REPFOR']}" itemValue="REPFOR" />
<f:validateRequired />
<a4j:ajax event="click" listener="#{landSubdivisionController.changeRepresentativeTypeForCooperative()}" render="cooperativeCitizenNationalId,cooperativeCitizenNationalIdForFranchisee,cooperativeCitizenSurname,cooperativeCitizenOtherNames,cooperativeCitizenDistrict,cooperativeCitizenSector,cooperativeCitizenCell,cooperativeCitizenVillage,cooperativeForeignerPassportNo,cooperativeForeignerSurname,cooperativeForeignerOtherNames,cooperativeForeignerCountry,cooperativeForeignerCity" />
</h:selectOneRadio>
<div class="col-md-4">
<h:message for="applicantDetails_cooperative_cooperativeAuthorisedRepresentativeType" styleClass="help-block"></h:message>
</div>
You should use change event instead of click event of javascript.
You can try writing like this:
<a4j:ajax event="change"