Set Default Value Using Context in Odoo

  Рет қаралды 13,381

Odoo Mates

Odoo Mates

Күн бұрын

Пікірлер: 56
@amitajangir6321
@amitajangir6321 3 жыл бұрын
A big thanks to you!! You make things seem so easy. I love the way you teach. Keep going 😁
@OdooMates
@OdooMates 3 жыл бұрын
Thanks for the kind words :)
@bondstar927
@bondstar927 4 жыл бұрын
I love your work buddy. Really cool stuff :)
@OdooMates
@OdooMates 4 жыл бұрын
Thanks bro :)
@helanatharwat7614
@helanatharwat7614 2 жыл бұрын
Thank you very much! I
@OdooMates
@OdooMates 2 жыл бұрын
glad it helped 🤩
@pichrazong9757
@pichrazong9757 4 жыл бұрын
I try to set context from python wizzard: context {default_name: name , default_gender: ''M"}, the only field that is automatically filled on create from is name, is it possible automatically select, the selection fill like gender ?
@OdooMates
@OdooMates 4 жыл бұрын
What all fields are there in wizard, and how you call the Create method
@pichrazong9757
@pichrazong9757 4 жыл бұрын
@@OdooMatesfields in wizard contain basic infomation such as (name,gender,country_id,email) the method was created from button type = object, I return the form view & pass the context like I described above. unfortunately fields like gender, country_id can't seem to be automatically selected.
@italaa86
@italaa86 3 жыл бұрын
We can also use the context from the action related to that button ??
@OdooMates
@OdooMates 3 жыл бұрын
If it is of type action button, if it is of type object, we have to make sure that the context is not changed or altered from the Python function
@jfsimon9333
@jfsimon9333 Жыл бұрын
Hi I dont understand why patient_id is set to active_id, as active_id is the ID of the record in the hospital.patient model. We should use the name instead of the ID maybe?
@italaa86
@italaa86 5 жыл бұрын
Hello thanks very much for your videos, we can set it from action attribute context also I think.
@OdooMates
@OdooMates 5 жыл бұрын
Suggest videos to others if you like it :)
@thanshidhap.p4743
@thanshidhap.p4743 3 жыл бұрын
Is there any video available, when clicking a button, then it will go for another model.
@OdooMates
@OdooMates 3 жыл бұрын
kzbin.info/www/bejne/h6Hdc5eCjKqKqac
@shadowcoder19
@shadowcoder19 3 жыл бұрын
@@OdooMates Is there a way to create invoice automatically using python code automated action studio?
@AdeshPaul
@AdeshPaul 4 жыл бұрын
Thanks for the information sir. I have a query. Here we are getting only name by default. But what if we want gender/age by default. Thanks.
@AdeshPaul
@AdeshPaul 4 жыл бұрын
I got the answer, we will do this by the help of onchange function in python file. For context, we will do like this:
@OdooMates
@OdooMates 4 жыл бұрын
Happy that you have solved it :)
@AdeshPaul
@AdeshPaul 4 жыл бұрын
@@OdooMates It is the result of teachings. Thanks.
@vviharika7191
@vviharika7191 2 жыл бұрын
hi sir i have error here in form view there is a field called 'Event amnount ' another field in notebook pages field name called 'total amount' if enter event amont the same amount should be display total amount automatically for this i write a code context = "{default_event_amount : active id or total_amount}" can you tel me the exact one sir thank you
@OdooMates
@OdooMates 2 жыл бұрын
both the field are in same model ? or one in main model and the other in one2many model ?
@vviharika7191
@vviharika7191 2 жыл бұрын
@@OdooMates yes sir one in main model another one is one2many
@OdooMates
@OdooMates 2 жыл бұрын
@@vviharika7191 {'default_event_amount ': field_in_main_model}"
@vviharika7191
@vviharika7191 2 жыл бұрын
@@OdooMates {'default_event_amount': total_amount} like this sir
@vviharika7191
@vviharika7191 2 жыл бұрын
@@OdooMates sir can i write this code in main model or one2many model sir
@prashanthpoojari8252
@prashanthpoojari8252 3 жыл бұрын
i have one questions sir i created one wizards with fields and with create button in footer when i click on the CREATE button it will redirect to the other module and shows the all the fields with data and after that if i dont click on the save button records will gone. so i dont want click on save button and without clicking save button it should save. when i click the create button can u pls answer for this sir
@prashanthpoojari8252
@prashanthpoojari8252 3 жыл бұрын
*if i dont click on the save button
@OdooMates
@OdooMates 3 жыл бұрын
after entering data in the wizard, what is expected to happen ?
@prashanthpoojari8252
@prashanthpoojari8252 3 жыл бұрын
@@OdooMates iwant all data in other model and inside of other model it should save automatically
@prashanthpoojari8252
@prashanthpoojari8252 3 жыл бұрын
its should be happen when i click CREATE button
@OdooMates
@OdooMates 3 жыл бұрын
@@prashanthpoojari8252 see this video, about how to add wizard and create record in another db. Wizard: kzbin.info/www/bejne/hIm3pKuqgM-fosU
@maaneadel2815
@maaneadel2815 3 жыл бұрын
Hi Bro can you help me ! i created a field named Auteur and i want to set the name of user account as default value
@OdooMates
@OdooMates 3 жыл бұрын
use this method: kzbin.info/www/bejne/Z2XQlGScfseJq7c
@maaneadel2815
@maaneadel2815 3 жыл бұрын
@@OdooMates auteur = fields.Many2one('res.users', default=lambda self: self.env.user, required=True, readonly=True) i use this it work for me
@OdooMates
@OdooMates 3 жыл бұрын
@@maaneadel2815 good
@mohammedraihan4961
@mohammedraihan4961 4 жыл бұрын
how you shown that partner's image in form view?
@OdooMates
@OdooMates 4 жыл бұрын
It's a binary field with widget OE_avatar
@conghunghoang6783
@conghunghoang6783 2 жыл бұрын
Thank you very much! I am facing with a problem that is context is none when edit one2many child. Please help me!
@OdooMates
@OdooMates 2 жыл бұрын
how you pass the context
@usmanfarzand4078
@usmanfarzand4078 5 жыл бұрын
amazing video
@OdooMates
@OdooMates 4 жыл бұрын
Thanks :)
@nitinshah334
@nitinshah334 4 жыл бұрын
can you tell how to pass context in xml and use it in name_get method in .py file
@OdooMates
@OdooMates 4 жыл бұрын
You can pass context along with the field in XML... In the name_get function you can get it by self.env.context
@nitinshah334
@nitinshah334 4 жыл бұрын
@@OdooMates I ahave tried that I get error saying" none type object is not iterable" Also when I try to print context as print(self._context.get('form_patient')) None is printed instead of True which I passed
@vviharika7191
@vviharika7191 2 жыл бұрын
sir i am waiting for your rply
@OdooMates
@OdooMates 2 жыл бұрын
{'default_event_amount ': field_in_main_model}"
Write Onchange Functions in Odoo
5:08
Odoo Mates
Рет қаралды 13 М.
Create a Wizard and Call it in Button Click Odoo
17:51
Odoo Mates
Рет қаралды 34 М.
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 55 МЛН
Kluster Duo #настольныеигры #boardgames #игры #games #настолки #настольные_игры
00:47
Record Rules in Odoo
19:50
Odoo Mates
Рет қаралды 32 М.
How To Add Smart Buttons in Odoo12 (type object)
21:42
Odoo Mates
Рет қаралды 20 М.
The Problem With Microservices
17:47
Continuous Delivery
Рет қаралды 435 М.
Run ALL Your AI Locally in Minutes (LLMs, RAG, and more)
20:19
Cole Medin
Рет қаралды 149 М.
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 310 М.
I tried 5 Firebase alternatives
10:31
Fireship
Рет қаралды 797 М.