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 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?
@@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
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?
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 ?
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
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 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 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 ) """ )
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
The hard topic I think and very interesting. Great that you downloaded the video as it is without cutting issues.
❤️ so I hope this video will help you get data from the different models
This was awesome thank you brother for this video.
Welcome :)
Very very helpful. Thanks a lot
Welcome bro
Good one👍
thanks bro :)
This is great tutorial. Thanks you. Please make tutorial about actions.client.
sure we will add it to list :)
Thank you its solve my prlbm
@@usmanfarzand4078 welcome brother
👍👍👍
thanks :)
Interesting. What happens if this request is executed by different users with different sales date parameters?
expected to have same result, as the query doesn't respect the access rights
Does this work on odoo 10 ? The tree view is empty in my case
how can I run psql command in windows terminal ?
www.pgadmin.org/download/pgadmin-4-windows/
ua-cam.com/video/TWccA-tVa9E/v-deo.html
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
thank you good explain but i have AttributeError: module 'odoo.api' has no attribute 'model_cr' i use odoo 13
you can remove that line if you are using odoo 13 and above
just remove: @api.model_cr
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.
@@kaoutherayadi5771 why you uninstall asset module ?
@@OdooMates because i see my data in terminal but i don't find it in my view
thank you for your video. What if I want to display a binary field from ir_attachment in model view using sql query?
you can try as follows, add binary field in model of sql view, fetch the value to this field from the query
@@OdooMates thank you for your response. Will try the same and will be back accordingly.
@@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?
@@hafizhafizullah2458
@@OdooMates can you please upload video for fetching binary field in model view please
why would you wanna do that ? is it to save time and code lines by using something already existing in code ?
are you asking about the reasons to create such a view ?
@@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 ?
@@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
Sir can you please make video on how to pass contex,withcontext in model use in another method or view
we will add in the upcoming videos brother
Sir have you any lecture on js widget
not yet brother
@@OdooMates plz make some material on widget and other Odoo js
hello sir i created a discount on invoice after tax how i can create journal entry for that
there is a module from oca which adds discount in invoice, can you refer that module
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?
as crm.lead is a normal model, better you add a new model and add the query to show the results
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 ?
@@OdooMates so it is impossible to inherit a model and query to show result to pivot view?
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
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.
you can left join to product_category , using the categ_id field in the product template model
@@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.
@@PacoArronaC can you share your query
@@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
) """ )
@@PacoArronaC is there any error on running this query ?
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).
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
How to make tree view with qweb in odoo v12
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
ua-cam.com/video/Rv44nFVn_5U/v-deo.html
It don't add me new records to the view. Any idea? I'm in Odoo v14.🥲
normally it has to add, did you followed same coding or ?
@@OdooMates I already managed to fix it. I had a mistake in the SELECT query. Thank you 😁