odoo-8

Why am I getting “Internal Server Error” running two Odoo instances (same domain but different ports)?

巧了我就是萌 提交于 2019-12-01 17:49:10
I have two instances of Odoo in a server in the cloud. If I make the following steps I get "Internal Server Error": I make login in the first instance ( http://111.222.33.44:3333 ) I close the session I load the address of the second instance in the same browser ( http://111.222.33.44:4444 ) If I want to work in the second instance (in another port), I need to remove the browser cookies first to acces to the other Odoo instance. If do this everything works fine. If I load them in differents browsers (Firefox and Chromium) at the same time, they work well as well. It's not a NginX issue because

custom report through python odoo 9

给你一囗甜甜゛ 提交于 2019-12-01 09:23:27
How to pass multiple module data to a QWeb report? Is there something similar to passing dictionary in rendering html from controller? class account(model.Models): _name = 'account.main' name = fields.Char() class accountSub(model.Models): _name = 'account.sub' name = fields.Char() class PrintWizard(model.Models): _name = 'print.report' account = fields.Many2one('erp.account') @api.multi def print_report(self): ctx = self.env.context.copy() ctx.update({'domain':[('name','=',self.account.name)]}) self.with_context(ctx) return {'name': 'Report', 'type': 'ir.actions.report.xml', 'report_name':

custom report through python odoo 9

眉间皱痕 提交于 2019-12-01 06:37:25
问题 How to pass multiple module data to a QWeb report? Is there something similar to passing dictionary in rendering html from controller? class account(model.Models): _name = 'account.main' name = fields.Char() class accountSub(model.Models): _name = 'account.sub' name = fields.Char() class PrintWizard(model.Models): _name = 'print.report' account = fields.Many2one('erp.account') @api.multi def print_report(self): ctx = self.env.context.copy() ctx.update({'domain':[('name','=',self.account.name)

How to set PDF name in qWeb report, Odoo?

拜拜、爱过 提交于 2019-12-01 04:16:09
I'm making reports using qWeb in Odoo 8. Those generated PDF files are saved with a "default" name. I would like to set a specific name to every generated file (not after file was saved, but in "generation" time). Is that possible? If it is, how to do it? Thanks in advance. Jeroen Vet In Odoo 8 you can patch the method report_download of addons/report/controllers/main.py like below (between FIX START and END). It will then use the code for the attachment attribute in the report action definition. As the system will then always also save the file as an attachment in the database you can change

Set default value while creating record from one2many field - odoo

一世执手 提交于 2019-12-01 01:57:43
I want to set default value for multiple fields while creating records from one2many field, in that default value will be taken from the parent model. Odoo Model Structure class purchase_order(models.Model): _inherit='purchase.order' cash_forecast_ids = fields.One2many(comodel_name='cash.forecast', inverse_name='purchase_order_id', string='Payment Schedules') class cash_forecast(models.Model): _name='cash.forecast' purchase_order_id = fields.Many2one(comodel_name='purchase.order', string='PO', select=True, copy=False) foreign_currency_amount = fields.Float("Foreign Currency Amount", copy=False

How to send a simple message and status as a response in an Odoo JSON controller?

别说谁变了你拦得住时间么 提交于 2019-12-01 01:37:09
I tried different ways of doing that, but they didn't work. First I tried this way: import openerp.http as http from openerp.http import Response class ResPartnerController(http.Controller): @http.route('/odoo/create_partner', type='json', auth='none') def index(self, **kwargs): Response.status = '400' return "Result message" I get the right status and the message in the client. But I get this strange warning if I do any action on the Odoo interface Is there a way to avoid this message? I tried this both ways as well: data = {'result': 'RESULT message'} json_data = json.dumps(data, encoding=

How to hide the edit button form based on state field of invoice Odoo v8?

試著忘記壹切 提交于 2019-11-30 22:43:43
I want to hide the edit button when a invoice' state is paid, just like the image below. And I was inheriting the invoice_form and add the corresponding attribute. <record id="invoice_form_inherit" model="ir.ui.view"> <field name="name">invoice.form.inherit</field> <field name="model">account.invoice</field> <field name="inherit_id" ref="account.invoice_form"/> <field name="arch" type="xml"> <xpath expt='//form[@string="Invoice"]' possition='attributes'> <!-- Frist intent : nothing happened --> <attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}"/> <!-- Second intent : edit,

How to hide the edit button form based on state field of invoice Odoo v8?

左心房为你撑大大i 提交于 2019-11-30 17:23:16
问题 I want to hide the edit button when a invoice' state is paid, just like the image below. And I was inheriting the invoice_form and add the corresponding attribute. <record id="invoice_form_inherit" model="ir.ui.view"> <field name="name">invoice.form.inherit</field> <field name="model">account.invoice</field> <field name="inherit_id" ref="account.invoice_form"/> <field name="arch" type="xml"> <xpath expt='//form[@string="Invoice"]' possition='attributes'> <!-- Frist intent : nothing happened -

How to set default values with methods in Odoo?

半城伤御伤魂 提交于 2019-11-30 13:20:08
问题 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() ) 回答1: You can use a lambda function like this: name = fields.Char( string='Name', default=lambda self: self._get

Odoo - prevent button from closing wizard

点点圈 提交于 2019-11-30 09:06:37
I have a transient model that serves as a dialog. In my form view I have a button like this: <footer states="partnerId"> <button name="check_tax_id" string="Tovább" type="object"/> </footer> The button invokes this function (I can confirm it actually invokes): @api.one def check_tax_id(self, context=None): self.state = "partnerDetails" return None; My problem is that the dialog window is closed immediately once I click this button! What am I doing wrong? Solution 0 @api.multi def check_tax_id(self): self.ensure_one() self.name = "New name" return { "type": "ir.actions.do_nothing", } This