How to add new field to hr.employee.public [Odoo 14] - odoo-14

I'm a newbie to Odoo. I can add new field to hr.employee but fail on hr.employee.public. It shows
error psycopg2.ProgrammingError: column emp.onboarding_date does not exist.
Why Odoo cannot create new column in the case?
I would like to add onboarding_date to both hr.view_employee_form and hr.hr_employee_public_view_form.

Since Odoo V13:
Inherit from hr.employee.base instead of hr.employee. Related commit.

Related

Odoo 12: KeyError: 'ir.values'

I m trying to create a new contact in odoo application but it shows me this error :
KeyError: 'ir.values'
The issue is related with this funtion.
class ResPartner(models.Model):
_inherit = 'res.partner'
def _default_credit_limit(self):
return self.env['ir.values'].get_default('account.config.settings', 'credit_limit')
I don't understand the problem
Can you please help me
KeyError: 'ir.values'
If you run self.env['ir.values'] on Odoo 12, you will get the above error because the ir.values Model does not exist in Odoo 12.
The ir.values Model was removed and replaced with ir.default. For example:
self.env['ir.default'].get('sale.order', 'sale_order_template_id')
You can see the relevant file in the Odoo core code or the commit where most of that Model was added.
Are you sure that this setting even exists anymore? I don't know for sure, but couldn't find it, i'm aware in Odoo 8 it existed. Beside the fact, that i don't think it exists anymore: account.config.settings don't exist for 100% sure, because the settings model was refactored into res.config.settings.
Actually the partner field credit_limit is gone, too. So if you want to use it and have a default outside the code, use ir.default for your desired behaviour.

How to appear TIN field CRM module in odoo10?

I am new user of odoo10 development.I want to appear TIN field in CRM module for odoo10. How should I do? In odoo11, TIN field is already appeared in CRM module.
The Tax Identification Number TIN is a base field named "vat" in res.partner model in both Odoo 10 and 11. It is specified in Odoo 11 res.partner form view but not in Odoo 10. This is why it is not visible in 10.
You can make a modification yourself to the Odoo 10 form by adding the field. You can add it the same way it is done in Odoo 10:
<field name="vat" placeholder="e.g. BE0477472701"/>
Note that the field name is "vat" and the field caption is "TIN". The right way to make modifications to Odoo base views is to inherit from them, not to modify directly them. If you modify them directly, your modifications will be overridden when you update Odoo.

How to inherit and add new state on a default module in odoo?

i am using odoo 10. Here i want to add an extra state in purchase module.Current states are open,draft and done. I want to add another state named new. How can i achieve this?
Use selection_add attribute.
Try below code:
state = fields.Selecion(selection_add=[('new_state','New State')])
Hope this will help you.

Getting reference from model One2many relationship comodel inside an ir.actions.act_window

Would like to ask on how you can get the id of the comodel inside the ir.actions.act_window.
See my source code: https://gist.github.com/renesansz/2642b02875475383605e
Currently, I cannot get the sprint_id.project_id.current_sprint reference since it's giving me an error of Uncaught Error: NameError: name 'sprint_id' is not defined. So what I wanted to happen is that upon opening the project it should add a default filter for the current sprint of the project.
Do I have any alternative for this kind of approach?
Tried doing domain, but still no luck solving the issue.
Try this: make related field and then use this field in xml view.

Adding new field on Odoo Product Variant

I am trying to add new field to product.product model.
What I've done so far is:
Add new field on the following model (From Settings > Database Structure > Models):
product.product
with the following details:
Name: x_product_cost
Field Label: Product Cost
Field Type: Float
and leave the rest to default.
The problem is i am unable to show it on the form. This is the only code that is generated when I tried to edit Form:
View Name: product.product.form
Object: product.product
Inherited View: product.template.common.form
Product Variant
lst_price
I can't use product.template model, since that inherits to product.product
Am i missing something here?
PS: I am trying to temporarily fixed assign-different-cost-on-product-variant bug as specified here
https://github.com/odoo/odoo/issues/1198
Can anyone help me with this?
Actually instead of modifying the model from the Odoo configuration, you should create a custom module, in which you will add the new fields and the new behaviors that you need.
To do so you will have to inherit from the models in the python files to extend them, and you will surely have to modify the views as well, so that your custom fields get displayed.
For reference on how to extend models, create a custom module and create the views, you should refer to the Odoo documentation that you can find here.
As an additional note in case you didn't know, but their is a new API that appeared in the version 8 of Odoo, if you can use it, it is much easier and much nicer.