odoo-8

Is it possible to make a one2many relation without specifying the target model's “foreign key field”?

给你一囗甜甜゛ 提交于 2020-01-24 00:54:06
问题 I want to make a superclass that have a one2many relation with says dummy.one . So that every subclass that inherit the superclass will have a one2many relation with dummy.one . The problem is declaring a one2many relation forces me to specify the foreign key which link dummy.one to the superclass . Thus I need to create many2one relation (foreign key) in dummy.one for every subclass that I create. The only trick that works is that I create a many2many relation instead of one2many . Here's an

Set default value of field depends on other field in odoo

拜拜、爱过 提交于 2020-01-17 06:32:38
问题 I am setting up default value of analytics_id in account.move.line by below code class account_move_line(models.Model): _inherit = 'account.move.line' _name = "account.move.line" def _get_default_account(self, cr, uid, context=None): obj = self.pool.get('account.move') value = obj.browse(cr, uid, uid) if value.move_id.debit>0 or value.move_id.credit<0: res = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('code','=','LAL')], context=context) return res and res[0] or False

Set default value of field depends on other field in odoo

馋奶兔 提交于 2020-01-17 06:32:08
问题 I am setting up default value of analytics_id in account.move.line by below code class account_move_line(models.Model): _inherit = 'account.move.line' _name = "account.move.line" def _get_default_account(self, cr, uid, context=None): obj = self.pool.get('account.move') value = obj.browse(cr, uid, uid) if value.move_id.debit>0 or value.move_id.credit<0: res = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('code','=','LAL')], context=context) return res and res[0] or False

How to set store trigger for computed fields in Odoo 8?

房东的猫 提交于 2020-01-16 12:09:05
问题 I started using the new API of Odoo v8.0 but I cannot find useful information about store trigger in computed fields like this (for v7.0 and v6.1): Store Parameter in Odoo v6 In Odoo v8.0, I tried to use the same syntax of v7.0 but I couldn't get it to work because the JSON response cannot be returned back to the web client: <function _store_trigger> is not JSON serializable. I read then that store parameter had been converted to Boolean only field (no dict for triggers): Odoo store function:

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

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>

Create receipt in pos Odoo-8

☆樱花仙子☆ 提交于 2020-01-11 13:05:44
问题 i'd like to print the template PosTicket before to pay it(preview of the ticket), I tried with the module "pos_restaurant" but doesn't work, any suggestions?. Thanks. 回答1: Create a js using this code /* Button Widget */ var PrintBillButtonTicket = screens.ActionButtonWidget.extend({ template: 'PrintBillButtonTicket', print_xml: function(){ var order = this.pos.get('selectedOrder'); if(order.get_orderlines().length > 0){ var receipt = order.export_for_printing(); receipt.bill = true; this.$('

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

偶尔善良 提交于 2020-01-11 08:43:28
问题 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

Odoo - prevent button from closing wizard

偶尔善良 提交于 2020-01-10 14:16:28
问题 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? 回答1: Solution 0 @api.multi def check