odoo-11

Odoo 11 how to override the auto generated modal views of one2many field

萝らか妹 提交于 2019-12-23 03:09:41
问题 Hi guys i am new to Odoo, for now i have 2 model as below: class HumanResource(models.Model): _name = 'hr.employee' _inherit = 'hr.employee' test = fields.Char('test') # Profiling Details food_ids = fields.One2many( 'hr.employee.food', 'food_id', string='Food Cost' ) class HrFood(models.Model): _name = "hr.employee.food" _description = "Employee Food" # food_id = fields.Many2one('hr.employee', 'Food', default={'food_id': lambda self, cr, uid, context: context.get('food_id')}) food_id = fields

How to call python function in jquery in odoo 11

不打扰是莪最后的温柔 提交于 2019-12-22 06:48:18
问题 Python code: @api.model def test_method(self): a= 10 b = 20 c = a+b return c jQuery: var Model = require('web.Model'); $(document).ready(function() { var test_model = new Model("MyClass"); test_model.call("test_method").then(function(c) { console.log("res ult:" + JSON.stringify(result)); }); }); Error: Missing depends, The above code will is working in odoo 10 but not in odoo 11. I want to know how to call a python function from JS. 回答1: in Odoo 11 you need to use var rpc = require('web.rpc')

How to view or hide field by attrs based on function (Automatically)?

依然范特西╮ 提交于 2019-12-20 04:21:29
问题 I want to view 'working_hours' field only for employee, his manager and 'hr.group_hr_user' group. how to hide this field automatically without edit form or trigger a button class InheritHrEmployee(models.Model): _inherit = 'hr.employee' def hide_working_hours(self): if self.env.uid == self.user_id.id or self.env.uid == self.parent_id.user_id.id or self.env.user.has_group( 'hr.group_hr_user'): self.working_hours_view = True else: self.working_hours_view = False working_hours_view = fields

Odoo 11 store attachments to other db

元气小坏坏 提交于 2019-12-13 02:56:58
问题 In Odoo 11 I want to store the attachment in a different database. So to achieve that I need to get the file once uploaded. So for that I have made my code like this import logging from odoo import fields from odoo import models,api import base64 _logger = logging.getLogger(__name__) class AttachmentStorage(models.Model): _name = "attachment.storage" _inherit = 'ir.attachment' @api.model def _file_write(self, value, checksum): bin_value = base64.b64decode(value) printf(bin_value) fname, full

Manage webservice from odoo

假装没事ソ 提交于 2019-12-11 21:30:47
问题 I am new to Odoo 11, I have created a module called 'coupon' , for this module I have created a security group and a default user that is added to this group: <record id="default_coupon_user" model="res.users"> <field name="login">couponuser</field> <field name="password">couponuser</field> <field name="password_crypt">couponuser</field> <field name="name">Default User Coupon</field> <field name="display_name">Default Coupon User</field> <field name="customer">False</field> </record> <record

How to access the printers connected to a local machine when CUPS is installed in an Ubuntu Server

ぐ巨炮叔叔 提交于 2019-12-11 18:23:47
问题 I have an Odoo Instance running in an Ubuntu Server.I installed the module base_report_to_printer ( Module link : https://github.com/OCA/report-print-send/tree/11.0/base_report_to_printer ) for printing the pdf reports directly to default printer instead of printing it from the saved pdf .I checked the module by installing printer in my local machine and running odoo's local instance and it is working perfectly.But when I run odoo in My Ubuntu Server I am not able to access the printers

odoo v11 - how do you add an action/view to the 'action drop down' menu

只愿长相守 提交于 2019-12-11 13:49:38
问题 In previous versions of odoo, you could add an item to the 'more' drop down menu by creating an ir.values record. This new option then became visible in tree views and within records. This does not appear to work in V11. How do you add an item to what is now called the 'action' drop down menu. 回答1: It appears that there may be a new field against actions to allow this link to be created directly on the action itself. field: binding_model_id e.g. within an ir.actions.server record: <field name

Odoo 11.0 make field unique

岁酱吖の 提交于 2019-12-11 12:47:47
问题 Can somebody explain how to make a field unique value? Like the invoice number, order number, ... each value must be unique. I need this for the product internal_reference and contact reference too. I've been checking the parameters for these fields via Odoo Studio app, but I don't see anything how to make them unique. Thanks 回答1: _sql_constraints = [ ('Any_name', 'unique (your_field_name)','Your message!')] 来源: https://stackoverflow.com/questions/47843819/odoo-11-0-make-field-unique

Odoo 11 how to override the auto generated modal views of one2many field

守給你的承諾、 提交于 2019-12-08 18:24:35
Hi guys i am new to Odoo, for now i have 2 model as below: class HumanResource(models.Model): _name = 'hr.employee' _inherit = 'hr.employee' test = fields.Char('test') # Profiling Details food_ids = fields.One2many( 'hr.employee.food', 'food_id', string='Food Cost' ) class HrFood(models.Model): _name = "hr.employee.food" _description = "Employee Food" # food_id = fields.Many2one('hr.employee', 'Food', default={'food_id': lambda self, cr, uid, context: context.get('food_id')}) food_id = fields.Many2one('hr.employee', string='Employee Name') # foodtype = ?to? food_name = fields.Char( string=

How to connect or login with Odoo using c# code? And after connect with Odoo how to add custom field to Odoo database from c#?

…衆ロ難τιáo~ 提交于 2019-12-06 06:29:11
问题 I have to implement some code in c# for login with Odoo database and give the logged user id please have a look, public interface IOpenErpLogin { [XmlRpcMethod("login")] int login(string dbName, string dbUser, string dbPwd); } But, it give error like "Bad Request". Also i'm not sure for XmlRpcUrl , have you any idea about what URL in to [XmlRpcUrl("")] ? 回答1: public interface IOpenErpLogin : IXmlRpcProxy { [XmlRpcMethod("login")] int login(string dbName, string dbUser, string dbPwd); } 来源: