Odoo / OpenERP Display fields of one2many
By : bres
Date : March 29 2020, 07:55 AM
wish of those help In the end, I managed to get what I wanted through delegation: In my class.py: code :
class sample (osv.osv):
_inherits = { 'res.partner' : 'partner_id'}
|
Group by in one2many Fields in Odoo-8
By : gourav jain
Date : March 29 2020, 07:55 AM
it should still fix some issue The group by is possible only in tree views, not in One2many fields. Unfortunately.
|
Odoo - Combine two fields heading in one2many
By : Fahad
Date : March 29 2020, 07:55 AM
I hope this helps . First create the xml file which extends the ListView Template like this to add colspan feature in base list view template. colspan.xml code :
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
<div t-extend="ListView">
<t t-jquery="table" t-operation="replace">
<table class="o_list_view table table-condensed table-striped">
<t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0)"/>
<thead>
<tr t-if="options.header">
<t t-foreach="columns" t-as="column">
<th t-if="column.meta">
<t t-esc="column.string"/>
</th>
</t>
<th t-if="options.selectable" class="o_list_record_selector" width="1">
<div class="o_checkbox">
<input type="checkbox"/><span/>
</div>
</th>
<t t-set="col" t-value="0"/>
<t t-foreach="columns" t-as="column">
<t t-if="col == 0">
<th t-if="!column.meta and column.invisible !== '1'" t-att-data-id="column.id"
t-attf-class="text-center #{((options.sortable and column.sortable and column.tag !== 'button') ? 'o_column_sortable' : '')}"
t-att-width="column.width()" t-att-colspan="column.colspan" >
<t t-set="col" t-value="column.colspan or 1"/>
<t t-if="column.tag !== 'button'"><t t-raw="column.heading()"/></t>
</th>
</t>
<t t-if="col !== 0" t-set="col" t-value="col - 1"/>
</t>
<th t-if="options.deletable" class="o_list_record_delete"/>
</tr>
</thead>
<tfoot>
<tr>
<td t-if="options.selectable"/>
<td t-foreach="aggregate_columns" t-as="column" t-att-data-field="column.id" t-att-title="column.label">
</td>
<td t-if="options.deletable" class="o_list_record_delete"/>
</tr>
</tfoot>
</table>
</t>
</div>
</template>
...
'qweb': [
"static/src/xml/colspan.xml",
],
...
<tree>
<field name="any_field" colspan="2"/>
</tree>
|
How to change fields.One2Many view in odoo 12?
By : streamer45
Date : March 29 2020, 07:55 AM
hope this fix your issue i trying to create fields.One2Many for my invoice module, i create two different module, one called ms_produk and another called invoice, then for the ms_produk i use as master product, which serve CRUD for item and have a table named "ms_produk_ms_produk" , Change the newly added section as, code :
<record id="salesorder_tree" model="ir.ui.view">
<field name="name">salesorder.form.tree</field>
<field name="model">salesorder.salesorder</field>
<field name="type">tree</field>
<field name='arch' type="xml">
<field name='details'>
<tree string="SalesOrder" editable="bottom">
<field name="kd_produk"/>
<field name="nm_produk"/>
</tree>
</field>
</field>
</record>
|
Odoo: how to show fields of a many2one fields which is inside a one2many field
By : user3520442
Date : March 29 2020, 07:55 AM
this will help I don't know how to put it but here's what i want, i want to show the fields of a custom.product model in the tree view of a one2many field my code is as follows , Add related field for fields you want to display in the tree view. code :
class CustomSaleLine(models.Model):
_name = 'custom.sale.line'
_description = 'Sales Line'
order_id = fields.Many2one('custom.sale', string='Order Reference', required=True,)
product_id = fields.Many2one('custom.product', string='Product', change_default=True, ondelete='restrict')
product_uom_qty = fields.Integer(string='Ordered Quantity', required=True, )
brand_id = fields.Many2one('BRAND_MODEL_HERE',related='product_id.brand_id')
country_id = fields.Many2one('COUNTRY_MODEL_HERE',related='product_id.country_id')
sell_price = fields.Float(related='product_id.sell_price')
<record id="form_custom_sale" model="ir.ui.view">
<field name="name">custom.sale.form</field>
<field name="model">custom.sale</field>
<field name="arch" type="xml">
<form string="Sales">
<sheet>
<group>
<group>
<field name="name"/>
</group>
</group>
<notebook>
<page string="Order Lines" name="order_lines">
<field name="order_line" widget="section_and_note_one2many" mode="tree">
<tree editable="bottom">
<control>
<create string="Add a product"/>
</control>
<field name="product_id">
<field name="brand_id"/>
<field name="country_id"/>
<field name="sell_price"/>
<field name="product_uom_qty" string="Ordered Qty"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
|