hello, i have a question after finishing making search panel in patient xm view , i finished work and turned my computer off. when i came to continue work on next day , i didn't find search filters or search panel on UI of odoo although they are still in my xml file on pycharm. what is the issue???
@SamirSELLAMI2 жыл бұрын
is the use of the _ underscore symbole in the beginning of a compute method name (or any Odoo Python method) have a meaning or it is just a naming convention?
@OdooMates2 жыл бұрын
there is people who defines computed function starting with an underscore and without underscore.
@SamirSELLAMI2 жыл бұрын
@@OdooMates I don’t remember well, but I read an article mentioned that the use of _underscore in Python has relation with public vs private methods. So in Odoo it’s only a manner of naming convention. Thanks Bro.
@OdooMates2 жыл бұрын
@@SamirSELLAMI yes _underscore method will be private and it cannot be accessed or triggered from outside, like what i can say, those functions cannot be called from xmlrpc for example
@SamirSELLAMI2 жыл бұрын
@@OdooMates ah okay thanks
@OdooMates2 жыл бұрын
Welcome brother
@alielnagar2 Жыл бұрын
nice
@OdooMates Жыл бұрын
Thanks
@ShadHastam Жыл бұрын
thanks
@OdooMates7 ай бұрын
Welcome
@malikkamil65962 жыл бұрын
i want to show field from sale order to stock picking how can i do that
@DonTimo122 жыл бұрын
Hi is it possible that there is a mistake in the calculation of the age field... there has not been taken in account that that today.month might be before the patients birthday in that year and the today.day might be before the patients birthday if today.month == rec.date_of_birth.month.
@abdullah-nasser- Жыл бұрын
Hi Odoo Mates Thanks for this tutorial, it's simple and clear I have question is there any difference if I wrote the _compute function with/out the `for record in self` because I made it like this, and it's working without any error @api.depends("DOB") # I named date_of_birth as DOB def _compute_age(self): today = date.today() self.age = today.year - self.DOB.year don't worry about the blank value of the DOB field, I defined a function to set it by default to 25 years back from current year.
@OdooMates Жыл бұрын
thanks for the support, if it is a non stored compute field, can you add this to list view and see if there is any error
@abdullah-nasser- Жыл бұрын
@@OdooMates yeah, it appears, the singleton but isn't this loop is exhausting for the server? I'm imagining if I have a 10000 records, is it going to loop through them on every action I do on the UI?
@Urbanbash-Lore Жыл бұрын
i very like your tutorials, but i see a small issue here correct me if im wrong. :) The python code is not thinking through. It is only looking at the year, but this creates an issue. For exampel: Patient A born 01.03.1994 Patient B born 01.09.1994 current date 01.07.1994 both will get the same age in the code. i guess most are aware of this but i needed it for my self to write this down :)
@HScreators99HScreators997 ай бұрын
you didn't define the exact date field because of this it will get error
@mohamedsobh26262 жыл бұрын
api run if i put it between class and field
@OdooMates2 жыл бұрын
yes, it will
@alimhanna95512 жыл бұрын
how can i use compute to set many2many value ?
@OdooMates2 жыл бұрын
self.m2m_field = record_set.ids
@aadhishesanlakshmanan73542 жыл бұрын
from datetime import date def _compute_age(self): for rec in self: today = date.today() if rec.date_of_birth(): rec.age = today.year - rec.date_of_birth else: rec.age = 1 Hi bro. This is my code. When i try to implement the above code i got a error, which is "date is not defined", kindly give me the solution for this. And for your reference "now I'm use odoo 13 version"
@OdooMates2 жыл бұрын
Add from datetime import date at the top file to import date package
@aadhishesanlakshmanan73542 жыл бұрын
def _compute_age(self): for rec in self: today = date.today() if rec.date_of_birth(): rec.age = today.year - rec.date_of_birth else: rec.age = 1 This is my code bro. age = fields.Integer(string="Age", compute='_compute_age') date_of_birth = fields.Date(string="Date of Birth", required=True) This is my fields bro. Also I'm import "from datetime import date" at the top. The error is 'type error :datetime.date' object is not callable Kindly give me the solution for this
thank you , I get this error AttributeError: 'Date' object has no attribute 'split' when use @api.depends(date_of_birth) , can you help please
@mohamedsobh26262 жыл бұрын
def _compute_gdays(self): for record in self: today = date.today() if record.start_date: record.gdays = today - record.start_date else: record.gdays = 1 AttributeError: 'agri.projects' object has no attribute '_compute_gdays'
@OdooMates2 жыл бұрын
did you restarted the service after adding the function ?