Create Model/DB View Using Query In Odoo || Combine Multiple Model Into One Model || Odoo Training

  Рет қаралды 12,836

Odoo Mates

Odoo Mates

Күн бұрын

Steps to create database table using query in Odoo. Combine multiple model data into single database table in Odoo. How to create model using query in Odoo. Steps of creating database view in Odoo. Combine datas from multiple model into single model in odoo using database View.
Part 2: • Create Model From Mult...
E-Learning Module: apps.odoo.com/...
Website: www.odoomates....
Github: github.com/odo...
Email : odoomates@gmail.com
Facebook: / odoomate
Twitter: / odoomates
Support Us in Ko Fi : ko-fi.com/odoo...

Пікірлер: 70
@RuslanSkiraUkraine
@RuslanSkiraUkraine 2 жыл бұрын
The hard topic I think and very interesting. Great that you downloaded the video as it is without cutting issues.
@OdooMates
@OdooMates 2 жыл бұрын
❤️ so I hope this video will help you get data from the different models
@abdelhalimkaddourguettaoui4591
@abdelhalimkaddourguettaoui4591 3 жыл бұрын
This was awesome thank you brother for this video.
@OdooMates
@OdooMates 3 жыл бұрын
Welcome :)
@supreetrandom651
@supreetrandom651 3 жыл бұрын
Very very helpful. Thanks a lot
@OdooMates
@OdooMates 3 жыл бұрын
Welcome bro
@abhinavm.s1410
@abhinavm.s1410 3 жыл бұрын
Good one👍
@OdooMates
@OdooMates 3 жыл бұрын
thanks bro :)
@dudutlesmono1804
@dudutlesmono1804 3 жыл бұрын
This is great tutorial. Thanks you. Please make tutorial about actions.client.
@OdooMates
@OdooMates 3 жыл бұрын
sure we will add it to list :)
@usmanfarzand4078
@usmanfarzand4078 3 жыл бұрын
Thank you its solve my prlbm
@OdooMates
@OdooMates 3 жыл бұрын
@@usmanfarzand4078 welcome brother
@ahmedhassen8901
@ahmedhassen8901 Жыл бұрын
Does this work on odoo 10 ? The tree view is empty in my case
@obehobeh9984
@obehobeh9984 3 жыл бұрын
Interesting. What happens if this request is executed by different users with different sales date parameters?
@OdooMates
@OdooMates 3 жыл бұрын
expected to have same result, as the query doesn't respect the access rights
@hafizhafizullah2458
@hafizhafizullah2458 2 жыл бұрын
thank you for your video. What if I want to display a binary field from ir_attachment in model view using sql query?
@OdooMates
@OdooMates 2 жыл бұрын
you can try as follows, add binary field in model of sql view, fetch the value to this field from the query
@hafizhafizullah2458
@hafizhafizullah2458 2 жыл бұрын
@@OdooMates thank you for your response. Will try the same and will be back accordingly.
@hafizhafizullah2458
@hafizhafizullah2458 2 жыл бұрын
@@OdooMates I have added a binary field but how can I fetch data into it. as binary field is not showing in my model whereas it is showing in ir_attachment as a record with res_id as my my model record ID. but from which field in ir_attachment, I could extract that binary field so that I could get my required file?
@OdooMates
@OdooMates 2 жыл бұрын
@@hafizhafizullah2458
@hafizhafizullah2458
@hafizhafizullah2458 2 жыл бұрын
@@OdooMates can you please upload video for fetching binary field in model view please
@syamaas9621
@syamaas9621 3 жыл бұрын
👍👍👍
@OdooMates
@OdooMates 3 жыл бұрын
thanks :)
@umerfarooq4026
@umerfarooq4026 3 жыл бұрын
Sir have you any lecture on js widget
@OdooMates
@OdooMates 3 жыл бұрын
not yet brother
@umerfarooq4026
@umerfarooq4026 3 жыл бұрын
@@OdooMates plz make some material on widget and other Odoo js
@HiPh0Plover1
@HiPh0Plover1 3 жыл бұрын
why would you wanna do that ? is it to save time and code lines by using something already existing in code ?
@OdooMates
@OdooMates 3 жыл бұрын
are you asking about the reasons to create such a view ?
@HiPh0Plover1
@HiPh0Plover1 3 жыл бұрын
@@OdooMates yes i want to know why would a dev do that using query ? is it to actually save a lot of time and not code it from scratch ?
@OdooMates
@OdooMates 3 жыл бұрын
@@HiPh0Plover1 it helps different purpose, like for creating pivot views, graph views, then creating qweb reports, the one who creates the reports can take data from one place rather than here and there. Also we can combine data from multiple models into a single table
@DharmeshTechZone
@DharmeshTechZone 3 жыл бұрын
Sir can you please make video on how to pass contex,withcontext in model use in another method or view
@OdooMates
@OdooMates 3 жыл бұрын
we will add in the upcoming videos brother
@Leonardo-dd7hj
@Leonardo-dd7hj 8 ай бұрын
i try this, i run the select * from in postgres, and it return some data, but it doesnt show any data in the odoo view
@malikkamil6596
@malikkamil6596 2 жыл бұрын
hello sir i created a discount on invoice after tax how i can create journal entry for that
@OdooMates
@OdooMates 2 жыл бұрын
there is a module from oca which adds discount in invoice, can you refer that module
@kaoutherayadi5771
@kaoutherayadi5771 3 жыл бұрын
thank you good explain but i have AttributeError: module 'odoo.api' has no attribute 'model_cr' i use odoo 13
@OdooMates
@OdooMates 3 жыл бұрын
you can remove that line if you are using odoo 13 and above
@OdooMates
@OdooMates 3 жыл бұрын
just remove: @api.model_cr
@kaoutherayadi5771
@kaoutherayadi5771 3 жыл бұрын
ok i remove it and it workes but i have another problem i uninstalled asset module as you do with om_hospital but i have 500 error TypeError: Model 'account.asset.asset' does not exist in registry.
@OdooMates
@OdooMates 3 жыл бұрын
@@kaoutherayadi5771 why you uninstall asset module ?
@kaoutherayadi5771
@kaoutherayadi5771 3 жыл бұрын
@@OdooMates because i see my data in terminal but i don't find it in my view
@zurabegadze7123
@zurabegadze7123 2 жыл бұрын
how can I run psql command in windows terminal ?
@OdooMates
@OdooMates 2 жыл бұрын
www.pgadmin.org/download/pgadmin-4-windows/
@OdooMates
@OdooMates 2 жыл бұрын
kzbin.info/www/bejne/iojGlHRjqbuUb6c
@hieunguyenngoc1816
@hieunguyenngoc1816 3 жыл бұрын
i inherit model crm_lead and query to display result query to pivot view but query does'nt work, can i inherit a model and using query to display pivot view?
@OdooMates
@OdooMates 3 жыл бұрын
as crm.lead is a normal model, better you add a new model and add the query to show the results
@OdooMates
@OdooMates 3 жыл бұрын
If you are generating data for the pivot view, ie actually for the model itself, you have to select the data from some tables right ? If you change the crm.lead to a model that comes from query, where will u enter the leads ?
@hieunguyenngoc1816
@hieunguyenngoc1816 3 жыл бұрын
@@OdooMates so it is impossible to inherit a model and query to show result to pivot view?
@OdooMates
@OdooMates 3 жыл бұрын
its possible, my question is, if you keep the same model, how will you record data into the crm.lead model. Thats why suggested you to create new model
@sanjanafarial4516
@sanjanafarial4516 3 жыл бұрын
Does anybody know how to do it in Odoo 13? "drop_view_if_exists" doesn't seem to be working on odoo 13 (I have _auto set to False).
@OdooMates
@OdooMates 3 жыл бұрын
Hi, it is there in odoo13, if you search inside the odoo source code, you can see a lot of usage of drop_view_if_exists
@PacoArronaC
@PacoArronaC 3 жыл бұрын
Thanks for teach, I need extra help ; what would be the where clause if I only want the records that match a field of a model of the actual view. Here is my case; I need to display all the item prices that match the category of the product in the form, so I think I can use this video aproach but I do not know how to call the product.category_id field as filter on the product.prices.item query where clause.
@OdooMates
@OdooMates 3 жыл бұрын
you can left join to product_category , using the categ_id field in the product template model
@PacoArronaC
@PacoArronaC 3 жыл бұрын
@@OdooMates ok in other words my model is the new: show.prices.product which will take the values from the sql query from product.price.items , now I need to filter just the records that match the categ_id of the form product template, I am not sure that the filed product.categ_id has the right value from the form, and I think it should by in the where clause.
@OdooMates
@OdooMates 3 жыл бұрын
@@PacoArronaC can you share your query
@PacoArronaC
@PacoArronaC 3 жыл бұрын
@@OdooMates yes of course an thanks for you attention; My problem is what to put on the last field of the where clause, as I am on the product_template_form , it may be use product.template.categ_id instead of categ_id.id: ---- class pricess(models.Model): _name = 'price.xprod' _auto = False _description = 'Precios_por_producto' costo = fields.Float() precio = fields.Float() porc = fields.Float() @api.model_cr def init(self): tools.drop_view_if_exist(self.cr_,'price_xprod') self.cr.excecute(""" create or replace view price_xprod as( select row_numbre() over as id, line.costo as costo, line.precio as precio, line.porc as porc from( select p.standard_price, i.price, i.price_discount from product_price_item i left join product.template p on (p.categ_id = i.categ_id) where i.categ_id = categ_id.id ) line ) """ )
@OdooMates
@OdooMates 3 жыл бұрын
@@PacoArronaC is there any error on running this query ?
@banothsandhya3367
@banothsandhya3367 2 жыл бұрын
How to make tree view with qweb in odoo v12
@malikkamil6596
@malikkamil6596 2 жыл бұрын
help help help ValueError: Expected singleton: stock.picking(8, 7) when one value is selected it works fine but when 2 products selectd in batch-transfer it gives error # -*- coding: utf-8 -*- from odoo import models, fields, api class StockPicking(models.Model): _inherit = 'stock.picking' def button_validate(self): """This function is inherit for effective date change""" transfer_date = self.date_done res = super(StockPicking, self).button_validate() self.date_done = transfer_date if self.move_lines: self.move_lines.update({'date': self.date_done}) if self.move_lines.account_move_ids: for record in self.move_lines.account_move_ids: pick_date = (self.date_done).date() record.button_draft() record.name = False record.update({'date': pick_date}) record.action_post() if self.move_line_ids: for line in self.move_line_ids: line.date = self.date_done return res
@OdooMates
@OdooMates 2 жыл бұрын
kzbin.info/www/bejne/iKeXZaF8i9OSa7c
@xions192
@xions192 Жыл бұрын
It don't add me new records to the view. Any idea? I'm in Odoo v14.🥲
@OdooMates
@OdooMates Жыл бұрын
normally it has to add, did you followed same coding or ?
@xions192
@xions192 Жыл бұрын
@@OdooMates I already managed to fix it. I had a mistake in the SELECT query. Thank you 😁
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 39 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 689 М.
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 103 М.
What changed in the ORM for Odoo 17
30:11
Odoo
Рет қаралды 7 М.
Adding fields  sale order line
6:30
Nicholas Kosinski
Рет қаралды 9 М.