openerp

concatenate firstname and lastname and fill into name field in odoo

限于喜欢 提交于 2020-01-16 01:17:08
问题 I have module which has three fields •name •first name •last name When a user press save The first name and last name will concatenate and displayed in name field. Name Field must be in read only mode. def onchange_name(self, cr, uid, ids, firstname, lastname, context=None): value = {'fullname' : True} if firstname and lastname: value['fullname'] = firstname + " " +lastname return {'value': value} <field name="fullname" readonly="True" on_change="onchange_fullname(fullname,context)"/> <field

Odoo 10 - Javascript Query to a Model

纵然是瞬间 提交于 2020-01-15 09:24:08
问题 I'm doing: var callback = new $.Deferred(); new Model('pos.order').query(['invoice_id']).filter([['id', '=', '100']]) .first().then(function (order) { if (order) { callback.resolve(order); } else { callback.reject({code:400, message:'Missing Order', data:{}}); } }); It works fine, and returns an Order object. But my issue is that i want to access the relation objects (many2many, many2one), but the order object has only the ID's of his relations. For example if i want to access the company or

ImportError: No module named win32service

a 夏天 提交于 2020-01-15 05:32:09
问题 I am using odoo8 with python 2.7.9 (64 bit) on eclipse IDE. Python software got corrupted so I had to reinstall it.Now I am facing this new problem ImportError: No module named win32service 回答1: You need to install pywin32. Either use pip install pypiwin32 or download from https://github.com/mhammond/pywin32/releases 回答2: You need to install Piwin32 using pip pip install pypiwin32 回答3: If you use PyCharm, restart IDE. 来源: https://stackoverflow.com/questions/38197879/importerror-no-module

How do I properly create, write or unlink records for many2many field using the new API?

♀尐吖头ヾ 提交于 2020-01-14 14:25:11
问题 Can someone give me an example to manipulate a many2many field using the new API? I've tried to read the Documentation to no avail. Here are my example classes: from openerp import models, fields, api, _ class example_class_one(models.Model): _name = "example.class.one" name = fields.Char('Name') value = fields.Float('Value') example_class_one() class example_class_two(models.Model): _name = "example.class.two" name = fields.Char('Name') example_class_ones = fields.Many2many('example.class

How do I add products to purchase order in Odoo using xml-rpc?

廉价感情. 提交于 2020-01-14 03:57:06
问题 Im creating the order: new_order = models.execute_kw(db, uid, password, 'purchase.order', 'create', [{'partner_id':VENDOR_ID_soucastky,'product_uom':1, 'bom_id':product.odoo_id, 'product_qty': 1.0}],) and then I need to add the products but I can't find how odoo v9 P.S. I need to use the webservice API as I don't have aces to change the code on server 回答1: Create your purchase order. Then create the purchase order lines and give them an order_id of your newly created purchase order. new_order

Open another module form view with button

偶尔善良 提交于 2020-01-14 03:17:11
问题 I am trying to open another model form view but receiving error external id not found. in the py file class ru_assignments(models.Model): name = 'ru.assignments class ru_assignments_sub(models.Model): _name = 'ru.assignments.sub' This is ru_assignments_sub xml <record model="ir.actions.act_window" id="action_sub"> <field name="name">Assignment Sub</field> <field name="type">ir.actions.act_window</field> <field name="res_model">ru.assignments.sub</field> <field name="view_type">form</field>

OpenERP ir.rule records in security.xml

拥有回忆 提交于 2020-01-13 05:43:06
问题 <record model="ir.rule" id="stock_inventory_comp_rule"> <field name="name">Inventory multi-company</field> <field name="model_id" ref="model_stock_inventory" /> <field name="global" eval="True" /> <field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])] </field> </record> I'm confused with above code fragment in security.xml files which is mean by below tags.? id="stock_inventory_comp_rule" means of this line and where its tag with.or is it only

Backup Odoo db from within odoo

微笑、不失礼 提交于 2020-01-11 04:39:08
问题 I need to backup the current db while logged into odoo. I should be able to do it using a button, so that suppose I click on the button, it works the same way as odoo default backup in manage databases, but I should be able to do it from within while logged in. Is there any way to achieve this? I do know that this is possible from outside odoo using bash but thats not what I want. 回答1: By using this module you can backup your database periodically https://www.odoo.com/apps/modules/7.0/crontab

Error occured while overriding the search function of a class in openerp

你说的曾经没有我的故事 提交于 2020-01-07 07:36:07
问题 I tried to override search function of class 'project' to filter the projects.But its not give a list, which i need. It just load all value from the model . From where I need to pass the context.Below given is my code class project(osv.osv): _name = "project.project" _description = "Project" _inherits = {'account.analytic.account': "analytic_account_id", "mail.alias": "alias_id"} def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False): if user == 1:

Odoo 10 - Create a record in product.uom via data/…xml

此生再无相见时 提交于 2020-01-07 04:38:12
问题 I have to use the following custom UoM defined in the system: id | create_uid | name | rounding | write_uid | uom_type | write_date | factor | active | create_date | category_id ----+------------+--------+----------+-----------+----------+----------------------------+--------+--------+----------------------------+------------- 20 | 1 | MILES | 0.001 | 1 | bigger | 2017-07-12 03:42:25.363007 | 0.001 | t | 2017-07-12 03:33:27.251635 | 1 Could someone provide an example on how to create it? 回答1: