odoo-8

Odoo 8: Many2many domain filter

巧了我就是萌 提交于 2019-11-30 08:26:21
I have several organization types with a many2many relation describing which types that may be parent to other types (e.g. department can be parent to sub-department and working group). It's NOT a strict hierarchy (working group can be parent to other working groups), hence the many2many relation. I have two fields on my organization_type object: allowed_parent_type_ids and the inverse allowed_children_type_ids . Now I want to restrict the organization type field on my organization object depending on it's parent, so a child of a "department" can only select the organization types allowed to

How to set default values with methods in Odoo?

ε祈祈猫儿з 提交于 2019-11-30 07:04:51
How to compute the value for default value in object fields in Odoo 8 models.py We can't use the _default attribute anymore in Odoo 8. field_name = fields.datatype( string=’value’, default=compute_default_value ) In the above field declaration, I want to call a method to assign default value for that field. For example: name = fields.Char( string='Name', default= _get_name() ) You can use a lambda function like this: name = fields.Char( string='Name', default=lambda self: self._get_default_name(), ) @api.model def _get_default_name(self): return "test" A simpler version for the @ChesuCR answer

What's happening with these transient models' IDs?

无人久伴 提交于 2019-11-29 16:10:19
THE CODE I have the following transient models: class MoveLotsManager(models.TransientModel): _name = 'move.lots.manager' product_lots_available = fields.One2many( comodel_name='move.product.lot.available', inverse_name='manager_id', string='Available lots', ) class MoveProductLotAvailable(models.TransientModel): _name = 'move.product.lot.available' manager_id = fields.Many2one( comodel_name='move.lots.manager', string='Lots Manager', ) name = fields.Char( string='Name', ) @api.one @api.onchange('name') def onchange_name(self): # LOGGER 4 _logger.info(self.manager_id) # LOGGER 5 _logger.info

How to add css files to a custom module in Odoo?

梦想与她 提交于 2019-11-29 02:27:46
How can I add css files to my custom module to change xml views? I found this post but the solution is not working. I want modify all the elements from my module, such as forms, lists, inputs, etc. You must create the css file in this route: /module_name/static/src/css/module_name.css . Example of file: .openerp .classname{ margin: 12px 0px 12px 0px; } Create the file /module_name/views/module_name.xml with this content: <?xml version="1.0"?> <openerp> <data> <template id="assets_backend" name="module_name assets" inherit_id="web.assets_backend"> <xpath expr="." position="inside"> <link rel=

What's happening with these transient models' IDs?

拟墨画扇 提交于 2019-11-28 09:59:57
问题 THE CODE I have the following transient models: class MoveLotsManager(models.TransientModel): _name = 'move.lots.manager' product_lots_available = fields.One2many( comodel_name='move.product.lot.available', inverse_name='manager_id', string='Available lots', ) class MoveProductLotAvailable(models.TransientModel): _name = 'move.product.lot.available' manager_id = fields.Many2one( comodel_name='move.lots.manager', string='Lots Manager', ) name = fields.Char( string='Name', ) @api.one @api

odoo - display name of many2one field combination of 2 fields

风流意气都作罢 提交于 2019-11-28 09:24:39
In my module i have the following many2one field: 'xx_insurance_type': fields.many2one('xx.insurance.type', string='Insurance') where xx.insurance.type is the following: class InsuranceType(osv.Model): _name='xx.insurance.type' _columns = { 'name' : fields.char(size=128, string = 'Name'), 'sale_ids': fields.one2many('sale.order', 'xx_insurance_type', string = 'Sale orders'), 'insurance_percentage' : fields.float('Insurance cost in %') } I know the many2one field takes the name field as its display name but I would like to have it use the combination of name and insurance_percentage in the form

OpenERP/Odoo model relationship XML syntax

北城余情 提交于 2019-11-27 21:25:59
问题 I'm working with OpenERP 7.0. The code below is from the file addons/project/security/project_security.xml Please explain me where the number 4, 6 and 0 are from? Which place in the document I can consult about this? <record id="group_project_user" model="res.groups"> <field name="name">User</field> <field name="category_id" ref="base.module_category_project_management"/> </record> <record id="group_project_manager" model="res.groups"> <field name="name">Manager</field> <field name="category

How to get products available quantity (Odoo v8 and v9)

邮差的信 提交于 2019-11-27 16:55:33
问题 I need to get products available quantity from odoo stock. There are several models I stock_quant, stock_move, stock_location. What I am trying to achieve are two things: Products total available quantity Products available quantity based on location Can anyone please guide me? 回答1: Stock related fields are defines in products (functional field) and directly from the product you can get the stock for all warehouses / locations or for individual location / warehouse. Example: For all

How to add css files to a custom module in Odoo?

一个人想着一个人 提交于 2019-11-27 16:43:18
问题 How can I add css files to my custom module to change xml views? I found this post but the solution is not working. I want modify all the elements from my module, such as forms, lists, inputs, etc. 回答1: You must create the css file in this route: /module_name/static/src/css/module_name.css . Example of file: .openerp .classname{ margin: 12px 0px 12px 0px; } Create the file /module_name/views/module_name.xml with this content: <?xml version="1.0"?> <openerp> <data> <template id="assets_backend

Which are the available domain operators in Openerp / Odoo?

牧云@^-^@ 提交于 2019-11-27 10:30:21
I know few operator in openerp domain. I dont get the details of available domains and their explanation. Particularly for these negation domains. Can anyone tell me the detail list? This gives a overview: List of Domain operators: ! (Not), | (Or), & (And) List of Term operators: '=', '!=', '<=', '<', '>', '>=', '=?', '=like', '=ilike', 'like', 'not like', 'ilike', 'not ilike', 'in', 'not in', 'child_of' Usage : Input records: Record 1: Openerp Record 2: openerp Record 3: Opensource Record 4: opensource Record 5: Open Record 6: open Record 7: Odoo Record 8: odoo Record 9: Odooopenerp Record 10