openerp-8

different view form for edit and create in odoo

夙愿已清 提交于 2019-12-03 21:52:07
I'd like to know is it possible to have different form views for edit mode and create mode in odoo ? Actually I just want to hide some elements in create mode and show it in edit mode. I've tried to using attrs like : <button name="%(print_invoice)d" string="Cetak Struk" type="action" attrs="{'invisible':[('id', '!=', False)]}" /> But when i open the form it gives me error like this : Uncaught Error: Unknown field id in domain [["id","!=",false]] Any help would be appreciated. Thank you @qatz You cannot have different views based on "Edit" or "Create" of record. You can try this by adding

Inheritance in openERP (odoo)

天大地大妈咪最大 提交于 2019-12-03 08:51:57
问题 I am new in openERP and have an interview. Please explain the idea of different types of inheritance in openERP, i think it total 3 types. please explain it in very simple way from the perspective of interview. P.S: I am familiar with the concept of simple inheritance. 回答1: Inheritance : Inheritance mechanism is used to create idea of re usability.there re usability means that reuse the code of the parent class in any Object Oriented Programming. Advantages : Reduce code redundancy. Provides

When to use api.one and api.multi in odoo | openerp?

早过忘川 提交于 2019-12-03 06:05:18
问题 Recently odoo (formerly OpenERP) V8 has been released. In new API method decorators are introduced. in models.py methods needs to be decorated with @api.one or @api.multi . Referring odoo documentation i can not determine the exact use. Can anybody explain in detail. Thanks. 回答1: Generally both decoarators are used to decorate a record-style method where ' self ' contains recordset (s). Let me explain in brief when to use @api.one and @api.multi : 1. @api.one : Decorate a record-style method

Difference between _sql_constraints and _constraints on OpenERP/Odoo?

百般思念 提交于 2019-12-03 03:37:16
I noticed there are 2 kinds of constraints on Odoo ERP. But I want to know what is the difference between _sql_constraints vs _constraints? _sql_constraints = { ('email_uniq', 'unique(email)', ' Please enter Unique Email id.') } _constraints=[ (_check_qty_and_unitprice, u'Qty must be more than 0',['product_qty', 'cost_unit']), ] Bhavesh Odedra _sql_constraints means it will set constraint on postgresql database side. _sql_constraints = [ ('email_uniq', 'unique(email)', ' Please enter Unique Email id.'), ] Where: email_uniq means constraint name, unique(email) means unique is name of constraint

Inheritance in openERP (odoo)

放肆的年华 提交于 2019-12-02 21:28:12
I am new in openERP and have an interview. Please explain the idea of different types of inheritance in openERP, i think it total 3 types. please explain it in very simple way from the perspective of interview. P.S: I am familiar with the concept of simple inheritance. Inheritance : Inheritance mechanism is used to create idea of re usability.there re usability means that reuse the code of the parent class in any Object Oriented Programming. Advantages : Reduce code redundancy. Provides code reusability. Reduces source code size and improves code readability. Code is easy to manage and divided

How to Get the ID field value in Odoo [duplicate]

流过昼夜 提交于 2019-12-02 17:50:51
问题 This question already has an answer here : How do I get the value from a form field using Odoo? (1 answer) Closed 4 years ago . I'm new in Odoo 8 and have some difficulties getting the ID value of a object for example the ID field value of hr.employee, can you give me some sample in this matter 回答1: Please read the Official Doc for v8.0 , it will give you clear idea. For note, if your are using New API then you just directly create model_object and fetch using model_obj.id As on your example

How to Get the ID field value in Odoo [duplicate]

泄露秘密 提交于 2019-12-02 13:00:56
This question already has an answer here: How do I get the value from a form field using Odoo? 1 answer I'm new in Odoo 8 and have some difficulties getting the ID value of a object for example the ID field value of hr.employee, can you give me some sample in this matter Bazzinga... Please read the Official Doc for v8.0 , it will give you clear idea. For note, if your are using New API then you just directly create model_object and fetch using model_obj.id As on your example HrEmployee = self.env['hr.employee'] employee_id = HrEmployee.id 来源: https://stackoverflow.com/questions/32754056/how-to

Could not display Selected Image in Odoo 9

帅比萌擦擦* 提交于 2019-12-02 09:01:09
I have problem with image loading in product.template form view. When i upload a new image it is uploading and displaying correctly in product kanban view , but in product form view it is giving me error Could not display Selected Image as displaying in attached image Someone please tell me about why it is happening. I'll be very thankful .. 来源: https://stackoverflow.com/questions/37987347/could-not-display-selected-image-in-odoo-9

Odoo throws a MissingError On treeview Second line record

百般思念 提交于 2019-12-02 08:08:01
How can i solve this error Odoo throws a MissingError on TreeView Second line button when clicked . The first Record line works but i need such that for each record on the tree the code below will be able to pass the contexts and open the appropriate view . Kindly assist Here is the code called on the button @api.multi def action_four_weeks_schedule_form(self): self.ensure_one() res = {} ids = self._ids cr = self._cr uid = self._uid context = self._context.copy() for id in self.browse(self.ids): print 'id in ++++ ' , id order_obj = self.pool.get('ratecard.multiple').browse(cr,uid,ids)[0]

Odoo 8 - Compute Field with “store=True” can't store in database

主宰稳场 提交于 2019-12-02 07:52:20
问题 I'm using Odoo 8 and I have a problem with compute field with type is Many2One . Here, I declared department_id : department_id = fields.Text( string="Department", store=True, comodel_name="hr.department", compute="_get_department_id" ) And fuction of this compute field: @api.depends('employee_id') def _get_department_id(self): if self.employee_id.department_id: self.department_id = self.employee_id.department_id.name It seems to work right now, but it's not. In view, I can see the value of