odoo-9

How to hide or disable “Edit” button in Odoo 9

試著忘記壹切 提交于 2019-12-11 06:24:53
问题 Can anyone help me how to hide or disable Edit and/or Create button when my workflow status value is "Done" I have workflow status "Draft > Approval > Confirmed > Done" so when status is Done i want 'Edit' to be hidden or disabled. Please help. thanks in advance. 回答1: You should be able to create a security rule which restricts write access when the status is done. Something like this. If you have a group you wish to specify then select it. If you have no group I am not sure however you may

How to resolve “TypeError: float() argument must be a string or a number”

陌路散爱 提交于 2019-12-11 06:18:14
问题 I was trying to install module product_print_zpl_barcode in odoo 9. This module is used to add a wizard on product variant to generate and print a product barcode on a ZPL printer. I got the error: TypeError: float() argument must be a string or a number when I pressed the button "Print barcode". Here is the source code and error: product_print_zpl_barcode.py # -*- coding: utf-8 -*- from openerp import models, fields, api, _ from openerp.exceptions import UserError from openerp.tools import

Odoo how to filter many2one field values in one2many field

馋奶兔 提交于 2019-12-11 05:59:25
问题 I have many2one field name_id . Usually when I use it in my_model.xml code below in this field I can select from all the values written in my.model.line . In this case I want to filter values and see the list of only these values which are written in current my.model. my_model.xml <record model="ir.ui.view" id="view_my_model_form"> <field name="name">my.model.form</field> <field name="model">my.model</field> <field name="arch" type="xml"> <form string="My Model"> <header> <field name="my

Odoo - How to add “code” field to Accounting Model

删除回忆录丶 提交于 2019-12-11 05:48:52
问题 I am working on a module that will print some values related to the invoice. The only two things that are missing in the Accounting Model are fields: -vat -code (Country Code) I have successfully added vat field. However, get an error when trying to bring the "code" field. My py code is as follows: from openerp import models, fields class CountryCodeInvoice(models.Model): # where to place new fields _inherit = 'account.invoice' # getting country code to the accounting model code = fields.Char

How to Dynamic change paper format margins (Left, Right, Top, Bottom)?

百般思念 提交于 2019-12-11 05:26:39
问题 I want to change my report paper size dynamically while printing pdf report. Like I have type in my object. When type change then, I want to change my report margin(top, bottom, left, right) which value configure as per margin. Thanks for your valuable help 回答1: You can override the method that calls wkhtmltopdf and manipulate the parameters passed there. See odoo.addons.report.models.report.get_pdf function. You can override this, check your variable and call _run_wkhtmltopdf with different

How to hide specific odoo server action from action drop down for some records conditionally?

旧巷老猫 提交于 2019-12-11 05:08:41
问题 Here is my code. I want to hide this action for some records conditionally? I found some tutorials about ir.action.server but did not find the way to hide an action. <record id="ar_change_state_bulk_assign_id" model="ir.actions.server"> <field name="name">Assign AR Number</field> <field name="type">ir.actions.server</field> <field name="model_id" ref="model_olims_analysis_request"/> <field name="state">code</field> <field name="code">self.bulk_change_states_pre("to_be_sampled",cr, uid,

How we can inherit BaseModel class in odoo

☆樱花仙子☆ 提交于 2019-12-11 04:25:09
问题 Need to inherit BaseModel class and add a new attribute like _auto = True _register = False _name = None _columns = {} _constraints = [] _custom = False _defaults = {} _rec_name = None _parent_name = 'parent_id' _parent_store = False _parent_order = False _date_name = 'date' _order = 'id' _sequence = None _description = None _needaction = False _translate = True Use this attribute in all models so need to be declare as a global example : from openerp import api, fields, models, _ class

odoo 9 - how to restrict one2many to not show a form view

为君一笑 提交于 2019-12-11 01:40:53
问题 I have a many2many, which is using the one2many widget. I set mode="tree" and am using editable="bottom". This works as expected in edit mode, however when in view mode - if the user clicks on a line it opens the line in a form view - how do i prevent this? I either want nothing to happen, or to allow user to click on one of the _id items on the line. Either way, clicking on the line should not open the record in a form view. <field name="test_ids" widget="one2many" nolabel="1" mode="tree">

How to add an external jQuery plugin to the list view on Odoo?

妖精的绣舞 提交于 2019-12-10 16:09:07
问题 I am using Odoo 10e. I want to integrate a jquery plugin into my module. I want to integrate the jQuery plugin jquery-resizable-columns. It simple helps user to resize columns of table on the fly and I want to apply this on a specific model's list view Which method should I extend in order to add the plugin? 回答1: I think you should extend (maybe include) some widget in the web module. If you go to the file /addons/web/static/src/js/view_list.js , you can see the widget that renders the table:

how to filter tree view with dynamic field odoo-10

那年仲夏 提交于 2019-12-10 15:29:24
问题 i added 'location_id' field to res.user to connect user to a certain location class ResUser(models.Model): _inherit='res.users' current_location_id=fields.Many2one('physical.location',string="Current Loction") allowed_location_ids=fields.Many2many('physical.location',string="Allowed Location") i wanted to filter only the visits with current_location_id = user_current_location_id <filter string="My visits" name="filter_my_visits" domain="[('current_location_id','=',current_location_id)]"/>