logo
down
shadow

Order by selection in List view of OpenERP 7.0


Order by selection in List view of OpenERP 7.0

Content Index :

Order by selection in List view of OpenERP 7.0
Tag : python , By : lifchicker
Date : November 25 2020, 07:27 PM


Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

OpenERP - not getting list of customers from res.partner on tree view


Tag : python , By : user133834
Date : March 29 2020, 07:55 AM
around this issue When you are inheriting a model and creating another model, the new model will not have the data from inherited model. Here you inherited 'res.partner' and created new model 'delivery.forcast'. So data will be stored in new table 'delivery_forecast'. You have to specify the table name of the inherited model in order to show all the data. ie, You have to give like this _name = 'delivery.forcast' _inherit = 'res.partner' _table = 'res_partner' Then it will show all the data in res_partner

How to add the column to list view in openerp?


Tag : python , By : eastcoastj
Date : March 29 2020, 07:55 AM
Does that help I am new to openerp. I need to add the column to list view. Please see the dark line in the attached image. , yes it is possible, you need to inherit the tree view like,
   <record model="ir.ui.view" id="hr_tree_view">
        <field name="name">hr.tree.form.inherited</field>
        <field name="model">hr.employee</field>
        <field name="inherit_id" ref="hr.view_employee_tree"/>
        <field name="arch" type="xml">
            <field name="name" position='after'>
                <field name="Your_field"/>
            </field>
        </field>
    </record>

Change the Default Purchase Order view form OpenERP


Tag : forms , By : mhedberg
Date : March 29 2020, 07:55 AM
will help you there is a field called "priority" on model "ir.ui.view" and default it is set to 16. if you made a complete new form view for purchase.order, just set this field to a lower value. the actions on the purchases menus for purchase.order aren't set to any special view, so the view with the lowest priority will be chosen automatically.
edit: if you want to have a menu wichh opens a form view of purchase order with your defined form view, you have to use it in an action, like:
<record model="ir.ui.view" id="your_form_view_id">
... your form view ...
</record>

<record id="your_action_id" model="ir.actions.act_window">
    <field name="name">Menu Name</field>
    <field name="type">ir.actions.act_window</field>
    <field name="res_model">purchase.order</field>
    <field name="view_type">form</field>
    <field name="view_mode">tree,form</field>
    <field name="view_id" ref="your_form_view_id" />
</record>

<menuitem action="your_action_id" id="your_menu_id" parent="your_parent_menu_id" />

OpenERP (View) - change look of selection field? (aka radio button)


Tag : python , By : Denis Chaykovskiy
Date : March 29 2020, 07:55 AM
this will help I managed to move radio widget from OpenERP 8 to OpenERP 7. So I will post it how I've done. Maybe some one will need it too.
Basically you only need two main files, one js and one xml (also empty __init__.py is needed, because OpenERP will throw error that it didn't find that module).
 'js': ['static/src/js/widget_radio.js'],
'qweb': ['static/src/xml/widget_radio.xml'],
openerp.web_widget_radio = function (instance)
{
    instance.web.form.widgets.add('radio', 'instance.web_widget_radio.FieldRadio');
    instance.web_widget_radio.FieldRadio = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, {
        template: 'FieldRadio',
        events: {
            'click input': 'click_change_value'
        },
        init: function(field_manager, node) {
            /* Radio button widget: Attributes options:
            * - "horizontal" to display in column
            * - "no_radiolabel" don't display text values
            */
            this._super(field_manager, node);
            this.selection = _.clone(this.field.selection) || [];
            this.domain = false;
        },
        initialize_content: function () {
            this.uniqueId = _.uniqueId("radio");
            this.on("change:effective_readonly", this, this.render_value);
            this.field_manager.on("view_content_has_changed", this, this.get_selection);
            this.get_selection();
        },
        click_change_value: function (event) {
            var val = $(event.target).val();
            val = this.field.type == "selection" ? val : +val;
            if (val == this.get_value()) {
                this.set_value(false);
            } else {
                this.set_value(val);
            }
        },
        /** Get the selection and render it
         *  selection: [[identifier, value_to_display], ...]
         *  For selection fields: this is directly given by this.field.selection
         *  For many2one fields:  perform a search on the relation of the many2one field
         */
        get_selection: function() {
            var self = this;
            var selection = [];
            var def = $.Deferred();
            if (self.field.type == "many2one") {
                var domain = instance.web.pyeval.eval('domain', this.build_domain()) || [];
                if (! _.isEqual(self.domain, domain)) {
                    self.domain = domain;
                    var ds = new instance.web.DataSetStatic(self, self.field.relation, self.build_context());
                    ds.call('search', [self.domain])
                        .then(function (records) {
                            ds.name_get(records).then(function (records) {
                                selection = records;
                                def.resolve();
                            });
                        });
                } else {
                    selection = self.selection;
                    def.resolve();
                }
            }
            else if (self.field.type == "selection") {
                selection = self.field.selection || [];
                def.resolve();
            }
            return def.then(function () {
                if (! _.isEqual(selection, self.selection)) {
                    self.selection = _.clone(selection);
                    self.renderElement();
                    self.render_value();
                }
            });
        },
        set_value: function (value_) {
            if (value_) {
                if (this.field.type == "selection") {
                    value_ = _.find(this.field.selection, function (sel) { return sel[0] == value_;});
                }
                else if (!this.selection.length) {
                    this.selection = [value_];
                }
            }
            this._super(value_);
        },
        get_value: function () {
            var value = this.get('value');
            return value instanceof Array ? value[0] : value;
        },
        render_value: function () {
            var self = this;
            this.$el.toggleClass("oe_readonly", this.get('effective_readonly'));
            this.$("input:checked").prop("checked", false);
            if (this.get_value()) {
                this.$("input").filter(function () {return this.value == self.get_value();}).prop("checked", true);
                this.$(".oe_radio_readonly").text(this.get('value') ? this.get('value')[1] : "");
            }
        }
    });
};
<?xml version="1.0" encoding="UTF-8"?>
<templates id="template" xml:space="preserve">
    <t t-name="FieldRadio">
        <span t-attf-class="oe_form_field oe_form_field_radio #{widget.options.horizontal ? 'oe_horizontal' : 'oe_vertical'}" t-att-style="widget.node.attrs.style">
            <span t-if="!widget.get('effective_readonly')">
                <t t-if="widget.options.horizontal">
                    <t t-set="width" t-value="Math.floor(100 / widget.selection.length)"/>
                    <t t-if="!widget.options.no_radiolabel">
                        <t t-foreach="widget.selection" t-as="selection">
                            <label t-att-for="widget.uniqueId + '_' + selection[0]" t-att-style="'width: ' + width + '%;'"><t t-esc="selection[1]"/></label>
                        </t>
                        <br/>
                    </t>
                    <t t-foreach="widget.selection" t-as="selection">
                        <div t-att-style="'width: ' + width + '%;'">
                            <span class="oe_radio_input"><input type="radio" t-att-name="widget.uniqueId" t-att-id="widget.uniqueId + '_' + selection[0]" t-att-value="selection[0]"/></span>
                        </div>
                    </t>
                </t>
                <t t-if="!widget.options.horizontal">
                    <t t-foreach="widget.selection" t-as="selection">
                        <div>
                            <span class="oe_radio_input"><input type="radio" t-att-id="widget.uniqueId + '_' + selection[0]" t-att-name="widget.uniqueId" t-att-value="selection[0]"/></span><label t-if="!widget.options.no_radiolabel" t-att-for="widget.uniqueId + '_' + selection[0]"><t t-esc="selection[1]"/></label>
                        </div>
                    </t>
                </t>
            </span>
            <span t-if="widget.get('effective_readonly')" class="oe_radio_readonly"><t t-esc="widget.get('value')[1]"/></span>
        </span>
    </t>
</templates> 

OpenERP - how model selection influences a view


Tag : xml , By : JulianCT
Date : March 29 2020, 07:55 AM
I wish this helpful for you What you did is defining a view for mrp.bom with higher priority than the existing views. That's why your view is used to show the mrp.bom objects.
To give a lower priority to your view try the following:
<record id="bom_where_use_form" model="ir.ui.view">
    <field name="name">bom.where.use.form</field>
    <field name="model">mrp.bom</field>
    <field name="type">form</field>
    <field name="priority" eval="99"/>
    <field name="arch" type="xml">
        <field name="product_tmpl_id"
               on_change="onchange_product_tmpl_id(product_tmpl_id,
                                                   0, context)"/> 
    </field>         
 </record> 
<field name="priority" eval="99"/>
Related Posts Related QUESTIONS :
  • Counting the most common element in a 2D List in Python
  • logout a user from the system using a function in python
  • mp4 metadata not found but exists
  • Django: QuerySet with ExpressionWrapper
  • Pandas string search in list of dicts
  • Decryption from RSA encrypted string from sqlite is not the same
  • need of maximum value in int
  • a list of several tuples, how to extract the same of the first two elements in the small tuple in the large tuple
  • Display image of 2D Sinewaves in 3D
  • how to prevent a for loop from overwriting a dictionary?
  • How To Fix: RuntimeError: size mismatch in pyTorch
  • Concatenating two Pandas DataFrames while maintaining index order
  • Why does this not run into an infinite loop?
  • Python Multithreading no current event loop
  • Element Tree - Seaching for specific element value without looping
  • Ignore Nulls in pandas map dictionary
  • How do I get scrap data from web pages using beautifulsoup in python
  • Variable used, golobal or local?
  • I have a regex statement to pull all numbers out of a text file, but it only finds 77 out of the 81 numbers in the file
  • How do I create a dataframe of jobs and companies that includes hyperlinks?
  • Detect if user has clicked the 'maximized' button
  • Does flask_login automatically set the "next" argument?
  • Indents in python 3
  • How to create a pool of threads
  • Pandas giving IndexError on one dataframe but not on another similar dataframe
  • Django Rest Framework - Testing client.login doesn't login user, ret anonymous user
  • Running dag without dag file in airflow
  • Filling across a specified dimension of a numpy array
  • Python populating dataframe in pandas from text files
  • How to interpolate a single ("non-piecewise") cubic spline from a set of data points?
  • Divide 2 integers (leetcode 29) - recursion issue
  • Can someone explain why do I get this output in Python?
  • How do I scrape pdf and html from search results without obvious url
  • Is there a way to automatically make a "collage" of plots with matplotlib?
  • How to combine multiple rows in pandas with shared column values
  • How do I get LOAD_CLASSDEREF instruction after dis.dis?
  • Django - How to add items to Bootstrap dropdown?
  • Linear Regression - Does the below implementation of ridge regression finding coefficient term using gradient method is
  • How to drop all rows in pandas dataframe with negative values?
  • Most Efficient Way to Find Closest Date Between 2 Dataframes
  • Execution error when Passing arguments to a python script using os.system. The script takes sys.argv arguments
  • Looping through a function
  • Create a plot for each unique ID
  • a thread python with 'while' got another thread never start
  • Solution from SciPy solve_ivp contains oscillations for a system of first-order ODEs
  • trigger python events driven by selenium controlled browser
  • Passing line-edits to a contextmanager to set validators
  • Python: globals().items() iterations try to change a dict
  • Is it possible to specify starting values for each parameter (instead of bounds) for scipy's differential evolution?
  • why datetime.now() and constructed datetime using all fields(like year,month...) of now has big timedelta?
  • MySQL multiple table UPDATE query using sqlalchemy core?
  • find if a semantic version is superset of of another version python
  • Type checking against dynamically created objects
  • Struggling with simple reverse function
  • Is there a function for finding the midpoint of n points on sklearn.neighbors.NearestNeighbors?
  • How to set max number of tweets to fetch
  • PYTHON 3.7.4 NOT USING SQLITE 3.29.0
  • How to replace Nan value with zeros in a numpy array?
  • How to speed up calculating variance among sparse matrix
  • cupy code is not fast enough compared with numpy
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com