<group>
<field name="tax_id" widget="many2many_tags" domain="[('type_tax_use','=','sale'),('company_id','=',parent.company_id)]"
attrs="{'readonly': [('qty_invoiced', '>', 0)]}"/>
<label for="customer_lead"/>
<div>
<field name="customer_lead" class="oe_inline"/> days
</div>
<label for="analytic_tag_ids"/>
<div>
<field name="analytic_tag_ids" widget="many2many_tags"/>
</div>
</group>
</group>
############WANT TO INSERT HERE
<label for="name"/>
<field name="name"/>
<div groups="base.group_no_one">
<label for="invoice_lines"/>
<field name="invoice_lines"/>
</div>
<field name="state" invisible="1"/>
This is in sale_view.xml
I have tried
xpath expr="//label[#for='name'//field name='name']" position='before'
and also tried various other paths and the full path too
/odoo/record[7]/field[3]/form/sheet/notebook/page[1]/field[1]/form/group
and
/odoo/record[7]//form[2]/group
I do not understand why it cannot find this path and why does not accept a string as selector.
EDIT:
<record id="view_order_form" model="ir.ui.view">
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//form//form//label[#for='name']" position="before">
<div groups="base,group_no_one">
<label for="l_ids"/>
<field name="l_ids"/>
</div>
</xpath>
<field name="partner_id" position="after">
<button name="abc" string="abc" type="object"
class="oe_inline fa fa-arrow-right oe_link"/>
</field>
</field>
</record>
This is the Error:
Error context:
View `sale.order form`
[view_id: 687, xml_id: promo.view_order_form, model: sale.order, parent_id: 508]
2016-11-07 06:43:03,556 22642 CRITICAL odoo10 odoo.service.server: Failed to initialize database `odoo10`.
Traceback (most recent call last):
File "/home/maharshi/workspace/odoo-10.0/odoo/service/server.py", line 898, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "/home/maharshi/workspace/odoo-10.0/odoo/modules/registry.py", line 78, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/home/maharshi/workspace/odoo-10.0/odoo/modules/loading.py", line 333, in load_modules
force, status, report, loaded_modules, update_module)
File "/home/maharshi/workspace/odoo-10.0/odoo/modules/loading.py", line 235, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/home/maharshi/workspace/odoo-10.0/odoo/modules/loading.py", line 177, in load_module_graph
env['ir.ui.view']._validate_module_views(module_name)
File "/home/maharshi/workspace/odoo-10.0/odoo/addons/base/ir/ir_ui_view.py", line 1171, in _validate_module_views
self.raise_view_error("Can't validate view:\n%s" % (e.message or repr(e)), vid)
File "/home/maharshi/workspace/odoo-10.0/odoo/addons/base/ir/ir_ui_view.py", line 445, in raise_view_error
raise ValueError(message)
ValueError: Can't validate view:
External ID must be fully qualified
Error context:
View `sale.order form`
This is the problem with most of the path i have tried to use.
It should be:
<label for="name" position="before">
<!-- your xml here -->
</label>
or
<xpath expr="//form//form//label[#for='name']" position="before">
<!-- your xml here -->
</xpath>
Edit:
Your record should look something like this:
<record id="view_order_form" model="ir.ui.view">
<field name="name">my.sale.order.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<!-- one of the above here -->
</field>
</record
Related
I am getting the following error on odoo 15.0 when clicking on menu Time Off/Approvals/Time Off
This menu is linked to the action
open_view_holiday_status
from odoo module's hr_holidays which in turn is linked to the view tree
view_holiday_status_normal_tree
I have extended that view the following way in a module named hr_holidays_base:
<record id="holiday_status_base_tree" model="ir.ui.view">
<field name="name">hr.holidays.status.tree</field>
<field name="model">hr.leave.type</field>
<field name="inherit_id" ref="hr_holidays.view_holiday_status_normal_tree" />
<field name="priority" eval="1" />
<field name="arch" type="xml">
<field name='display_name' position="after">
<field
name="max_leaves"
invisible="not context.get('active_id',False)"
/>
<field
name="leaves_taken"
invisible="not context.get('active_id',False)"
/>
<field
name="remaining_leaves"
invisible=" not context.get('active_id',False)"
/>
</field>
</field>
</record>
Note: i have a second view tree extending from it too:
<record id="secondary_holiday_status_base_tree" model="ir.ui.view">
<field name="name">secondary.hr.holidays.status.tree</field>
<field name="model">hr.leave.type</field>
<field name="inherit_id" ref="hr_holidays_base.holiday_status_base_tree" />
<field name="mode">primary</field>
<field name="priority" eval="15" />
<field name="arch" type="xml">
<field name="company_id" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
Now getting the error:
Error:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/local/lib/python3.10/dist-packages/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
File "<string>", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
What could go wrong? any hint maybe?
I have tried following the execution of every step by step. I have searched these defined views from the UI and they work well individually. The only issue is when trying on that menu and this is where it shows the error
I created a model like this
class FoundCheque(models.TransientModel):
_name = "found.cheque"
date_Found = fields.Date(string='Found Date', default=fields.Date.context_today, required=True, translate=True)
and its view
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="wizard_found_cheque">
<field name="name">found.cheque.wizard</field>
<field name="model">found.cheque</field>
<field name="arch" type="xml">
<form string="found Cheque">
<group>
<field name="date_found" style="width:40%%"/>
</group>
<footer>
<button name="found_cheque" string="Post" type="object" class="oe_highlight"/>
or <button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
</data>
</odoo>
but when I try to update the module after restarting the service
it just says:
Field `date_found` does not exist
Error context:
View `found.cheque.wizard`
[view_id: 4100, xml_id: n/a, model: found.cheque, parent_id: n/a]
None" while parsing /opt/odoo/odoo11-custom-addons/cheque_management/views/found_cheque.xml:4, near
<record model="ir.ui.view" id="wizard_found_cheque">
<field name="name">found.cheque.wizard</field>
<field name="model">found.cheque</field>
<field name="arch" type="xml">
<form string="found Cheque">
<group>
<field name="date_found" style="width:40%%"/>
</group>
<footer>
<button name="found_cheque" string="Post" type="object" class="oe_highlight" confirm="آیا مطمئن هستید؟"/>
or <button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
and just to add I restarted the service several times
more information will be added on request
Your field name in python file is date_Found and date_found in xml. Both are different. so change field name in xml file
the defined field in model was "date_Found" and the defined field in wizard was "date_found"
F
I'm create simple module with 4 fields (name,date,user,description).Below is my .xml file.
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_my_report_form" model="ir.ui.view">
<field name="name">penalty.form</field>
<field name="model">my.report</field>
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Project">
<sheet string="My report">
<group>
<div class="oe_title">
<h1 class="o_row">
<field name="name" placeholder="Name..." />
</h1>
</div>
</group>
<group>
<field name="user" placeholder="User..."/>
</group>
<group>
<field name="date" placeholder="Date..."/>
</group>
<notebook>
<page name="description_page" string="Description">
<field name="description"/>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_my_report_form">
<field name="name">Add new</field>
<field name="res_model">my.report</field>
</record>
<menuitem name="MY report" id="menu_penalty" action="action_my_izvjestaj_form" sequence="1"/>
</data>
</openerp>
When open from menu in grid view visble is only name.
https://postimg.org/image/ccms5aww3/
How add date and user fields?
You need to declare Tree view for that model.
<!-- Tree Views BEGIN-->
<record model="ir.ui.view" id="view_my_report_tree">
<field name="name">penalty.tree</field>
<field name="model">my.form</field>
<field name="arch" type="xml">
<tree string="Project">
<field name="name"/>
<field name="user"/>
<field name="date"/>
</tree>
</field>
</record>
I want to create Delivery orders based on a selection of order lines to invoices (as shown below) with the possibility to adjust quantity used in the delivery order.
Expected UI
Looking around, I found a UI similar to want I want in Delivery orders > More > Return Shipments (cf. _stock/wizard/stock_return_picking_view.xml_).
What I got
But I don't get the same result with my XML
view.xml
<record id="view_create_delivery_button" model="ir.ui.view">
<field name="name">Create Delivery</field>
<field name="model">sale.order.line</field>
<field name="arch" type="xml">
<form string="Create Delivery" version="7.0">
<label string="Select the quantities to create."/>
<group>
<field name="order_id"/>
<field name="name"/>
<field name="product_uom_qty"/>
<field name="state" invisible="1" />
</group>
<footer>
<button name="create_returns" string="Create delivery" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
Question
How do I get this editable multilines layout?
What you see in the Return Shipments wizard is a one2many field that related to stock.return.picking.line on it tree view with editable=top attribute.
I am assuming this is what you wanted:
<record id="view_create_delivery_button" model="ir.ui.view">
<field name="name">Create Delivery</field>
<field name="model">sale.order</field>
<field name="arch" type="xml">
<form string="Create Delivery" version="7.0">
<label string="Select the quantities to create."/>
<field name="order_line" >
<tree editable="top">
<field name="order_id"/>
<field name="name"/>
<field name="product_uom_qty"/>
<field name="state" invisible="1" />
</tree>
</field>
<footer>
<button name="create_returns" string="Create delivery" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel"/>
</footer>
</form>
</field>
</record>
Note: This is just a sample of how to use the field many2one's tree view, you might need adjust to your on needs.
I have to show the records of a custom module in a tree view (not list)
<field name="view_type">tree</field>
Instead of
<field name="view_type">form</field>
However, I would also like to be able to go to the records' corresponding forms when I click on them. Based on what I read, it's not possible, at least not by default. Is there any workaround to 'fix' it?
Here is my code:
<!-- Estrutura de Redes -->
<record id="edit_estrutura" model="ir.ui.view">
<field name="name">gestao.rede.estrutura.form</field>
<field name="model">gestao.rede.estrutura</field>
<field name="arch" type="xml">
<form string="Estrutura da Rede">
<header>
<!--<button name="" string="Desabilitar" type="object" states="habilitado"/>-->
<!--<button name="" string="Habilitar" type="object" states="desabilitado"/>-->
</header>
<sheet string="Estrutura da Rede">
<div class="oe_nome">
<label for="razao_social" class="oe_edit_only" string="Nome"/>
<h1>
<field name="name" string="Nome:"/>
</h1>
<label string="Pasta Acima:"/>
<field name="parent_id" options="{'no_create': True}"/>
<label string="Variável:"/>
<field name="variavel"/>
<label string="Pastas Abaixo:" class="oe_read_only"/>
<field name="pastas_filho" options="{'no_create': True}" class="oe_read_only"/>
</div>
</sheet>
</form>
</field>
</record>
<record id="view_estrutura_tree" model="ir.ui.view">
<field name="name">gestao.rede.estrutura.tree</field>
<field name="model">gestao.rede.estrutura</field>
<field name="field_parent">pastas_filho</field>
<field name="arch" type="xml">
<tree string="Estrutura da Rede" delete="true" editable="bottom/top" toolbar="1">
<field name="name"/>
<field name="pastas_filho"/>
<field name="parent_id"/>
<field name="variavel"/>
</tree>
</field>
</record>
<record id="open_view_gestao_estrutura_all" model="ir.actions.act_window">
<field name="name">Estrutura da Rede</field>
<field name="res_model">gestao.rede.estrutura</field>
<field name="view_type">tree</field>
<field name="domain">[]</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_estrutura_tree"/>
</record>
<menuitem action="open_view_gestao_estrutura_all" id="menu_action_estrutura" parent="menu_gestao_redes" sequence="20"/>
Thanks!
Editable Tree View
by default, selecting a list view's row opens the corresponding form view. The editable attributes makes the list view itself editable in-place.
Valid values are top and bottom, making new records appear respectively at the top or bottom of the list.
The architecture for the inline form view is derived from the list view. Most attributes valid on a form view's fields and buttons are thus accepted by list views although they may not have any meaning if the list view is non-editable
Example:
<tree editable="bottom/top">
<field name="xyz"/>
</tree>
Try this
<tree editable="bottom">
Add your fields
</tree>