openerp

Download file locally in python

青春壹個敷衍的年華 提交于 2019-12-06 12:37:18
问题 I have a python method in OpenERP that generate a CSV file. My question is how can I set the default path of the CSV will be local path, not a path on the server. a part of my code have this with open('export_data.csv', 'wb') as csvfile: . which saves the file on the server. I want the file to be saved on the client side location. Do you have any idea on how to achieve this? the openerp built in export data function is not an option. 回答1: Using a fields.binary One common way to return a

How to find (and maybe extend) the list of available field names for reports in the OpenERP server sourcecode?

一个人想着一个人 提交于 2019-12-06 12:30:19
I am looking for a reliable way to get names of available data fields when creating or extending OpenOffice/LibreOffice report files. I already do know many field names from the existing reports. I also can lookup the field names in the module definitions. For example in the file addons\base\res\partner\partner.py I find a field list for the partner model: class res_partner(osv.osv): _columns = { 'name': fields.char('Name', size=128, required=True, select=True), 'date': fields.date('Date', select=1), 'title': fields.many2one('res.partner.title','Partner Form'), 'parent_id': fields.many2one(

Odoo loading javascript files in version 8?

你。 提交于 2019-12-06 09:57:24
问题 How do you load javascript files in version 8? In version 7, you could simply show the location of js in manifesto file ( __openerp__.py ) like this: 'js': ['static/src/js/file.js'], Now it does not work. For example I created js file in my module with this code: openerp.calendar_service = function(instance) { var _t = instance.web._t, _lt = instance.web._lt, QWeb = instance.web.qweb; instance.calendar_service = {}; console.log('TEST') }; But using debugger, I don't see that TEST is printed.

Create a functional field in OpenErp

那年仲夏 提交于 2019-12-06 09:25:52
问题 How do I create a functional field in OpenERP? It seems that I need to create the function in python, then call it with XML. I see the XML that needs to be edited, but what file does the python code go in? 回答1: The code for py file.. class some_model(osv.osv): _name = 'some.model' def Method_of_Function(self, cr, uid, ids, fld_name, arg, context=None): #Logic return value _columns = { "functional_filed":fields.function(Method_of_Function, method=True,type='int',string='Label', store=True), }

how to group one2many list view inside another model in openerp 6.1?

妖精的绣舞 提交于 2019-12-06 08:22:06
问题 In my sale.order, i have added a new one2many field sale_bom for showing the bill of material lines. Whenever i add a sale order line, if the product have a bill of material then its bom lines should be shown under the new field sale_bom. I found the way to group the sale_bom lines by sale_order_lines using context="{'group_by':'sale_order_line'}" in web client and gtk client of openerp v6.0.3 but it is not working in openerp v6.1 Is there any way to group in openerp v6.1 web client? 回答1: in

Get number of sheet excel in python

不想你离开。 提交于 2019-12-06 08:10:20
问题 How get number of sheet in below python example? file = self.excel_file.decode('base64') excel_fileobj = TemporaryFile('wb+') excel_fileobj.write(file) excel_fileobj.seek(0) workbook = openpyxl.load_workbook(excel_fileobj, data_only=True) sheet_number= ??? sheet = workbook[workbook.get_sheet_names()[0]] for row in sheet.rows: print(row[1].value) sheet_number=???? Any solutin? 回答1: workbook.worksheets contains a list of worksheet objects. To get the number of worksheets: sheet_number = len

Tree view to be called through button in OpenERP-7

荒凉一梦 提交于 2019-12-06 07:56:21
I wanted to know that how may I call the tree view(of different records) through a button . Because returning form view is easy but when I tried to do exact thing for tree view it shows a list only. The scenario is that I have a search product form. Now when the search is generated,a domain of records is filled in the field. I want to add a button to call the tree view showing me the records present in that domain. I added a function to button but it showed me all the record in a list , didnot even show only the records in the domain. I have tried to call the following function through a

name of type=“action” in openerp button

南楼画角 提交于 2019-12-06 07:15:43
问题 I've a problem when I want to make button in type="action" , it's really different with type="object" . I just want to make button that can connect one module to another. It already exists in openerp for a few buttons of type="action" . I just want to understand what is the function of "name" of this button? I have an example, I found this xml script in backend sale folder: <button name="%(action_view_sale_advance_payment_inv)d" string="Create Invoice" type="action" states="manual" class="oe

How overwrite default function of a field in odoo new api

眉间皱痕 提交于 2019-12-06 06:21:28
I have a field that call a function to get default value (in module project_forecast): def default_user_id(self): return self.env.user if ("default_user_id" not in self.env.context) else self.env.context["default_user_id"] user_id = fields.Many2one('res.users', string="User", required=True, default=default_user_id) I create another module to inherit it and change default value of field user_id but it's not working without any error in log, how can I resolve this ? def default_user_id(self): return False You're linking a method directly on field definition. So overriding the method isn't enough

Inherit form view from a predefined module

旧时模样 提交于 2019-12-06 05:55:16
I want to create my own module which is an extension of sale.order . I want to have a form view which is like sale order view with few additional fields, My problem is that when I inherit the sale order view and add say three extra fields these fields comes by default in the Original Sale Order form view too. is this the default behaviour or am I doing something wrong ? What should I do to achieve what I want. If you inherit the view and add some fields using 'xpath' , than it will change the original view by installing your new module. This is the application of view inheritance. If you want