Auto refresh tree view odoo 15 - odoo-15

I am using odoo 15 version. Assuming there is user A and User B.
User A is already landed on customer invoice tree view And after few seconds User B create a new invoice from its login id.
User A should see this new invoice on tree view without refreshing tree view.
is there any way the tree view automatically gets refreshed when a new records created?

Automatically refreshing the tree view for one user when another user changes a record is not possible in any simple way as far as I'm aware. This would most likely require major JavaScript and Python changes to the Odoo 15 codebase.
I recently worked on a development where a client wanted similar functionality but we decided that the result was not worth the time required for such a change.

Related

Is there any way to revoke access from modules after a particular time?

We want to make the modules readonly. After clicking on the parent menus, all the submenus should also be readonly.
Tried fields_view_get() but there are too many forms to write the method for!
So is there any other way to do it. We are disabling the modules forever based on a particular date.
Please help.
The algorithm that you can follow to achieve this will depend on what kind of access do your users have to your server. If they do not have access to the Settings menu, then what you can do is have a cron job run every X minutes that validates their subscription for your modules.
If the cron job finds that the their subscription is invalid and you want to make some menus unclickable or some views read only you can run the following query against the database to find out what views does a particular module create:
select * from ir_model_data where module = 'your_module_name';
The ir_model_data model actually contains all the keys for data your module contains. All the menus, views, groups etc you created using XML files (or not) are there.
Once you get all the records in your cursor you can cr.fetchall() and then loop on the return value. Each record will have a model and an res_id. When you see that you have a menu or a view that interests you you can set its active field to false to completely hide the view or menu.
When you loop on your results and find a field (that is a record that has model='ir.model.fields', you can set the readonly field to True so that this field is readonly. You can do this for every field.
As you can understand this approach is not bullet proof. If your users have access to the settings (ie. admin rights) then you must not use Odoo's cron jobs and rather configure a cron job to be run from your Operating System to invoke an external Python script that will do the process described above.
Also, if you set the views/menus/fields readonly, they might be rendered as readonly on the web browser, but there is nothing stopping an end user for crafting a rpc request and sending inappropriate json data.
If the users have SSH access to your server there is not much you can do.

How to run process on multiple records?

I want to create an on-demand process of some kind in Dynamics CRM 2013 that will run on multiple records of the same type. The process will create an equal number of records of another type, and all will relate to the same parent record. I can imagine how a workflow would be used to create the new child records but I am not sure how I could create the parent record and associate it with the child records.
If you're running on multiple records, then I presume your are starting from a gridview of some sort. If that's the case, then the solution is easy. Just create a custom ribbon button that accepts the selected records as a parameter, and runs a custom javascript. That will accomplish what you need in a nice elegant solution.
Because it's running javascript, you will have full control to be able to do everything you need. One of the features of ribbon buttons, is they can receive the selected records in a parameter as an array.
But if you don't want to do all the work in javascript, you can have the script pass the parameters to a custom Workflow or Action.
As its already been mentioned, a workflow won't be able to do this alone, because it can only run on a single record, and cannot accept multiple records as an input parameter.
Jason I think the point here is to automate the process. Lee you are correct in your assessment that creating the work order with a workflow step is easy to do while creating the child work order items is either difficult or impossible. Even if you managed to hack this together with several workflows triggered by different events during the process the end result would be a UX/maintenance nightmare.
The simplest and best solution is to have piece of plugin logic that you trigger with your workflow. This plugin code would create a new work order and associated work order items based on the context of the service you run the workflow against. If you would like for this action to be triggered by a database operation instead of manually triggered this would be simple to do as well.
You aren't going to be able to do this via a CRM dialog because it can only run against one record. You can accomplish this fairly easily by leveraging existing CRM functionality:
If it doesn't already exist, create a field in your service entity (the Work Order Item) called new_MasterWorkOrder (or something similar) which is link to a Master Work Order entity.
Create your master record - this would be your Overall Work Order.
From your Work Order Item record entry listing, select all the items you want to add to the Master Work Order record created in the previous step. Alternately, you could use an Advanced Find to locate the target records.
Click the Edit button to initiate the CRM bulk/multi-record edit form.
In the new_MasterWorkOrder field, select the Overall Work Order previously created.
Save.
Once the process complete, all of the Work Order Items you selected will now be linked to your Overall Work Order.
It sounds like you might a need a step before this to create a Work Order Item from selected Service entities. You should be able to accomplish this easily by having a workflow which runs takes in a Service entity as a parameter and builds a Work Order Item from it. Once you have these built you can link them to an Overall Work Order using the process above.

How do i generate Model & CRUD automatically

i want to generate Model and CRUD automatically when my new table created.
i am creating new table(xyz_uid) dynamically after successful registration of user. and i am inserting some data related to that particular user. this thing is working fine for me.
i creating separate table for each user because for every user table attributes may different and i tried to keep one table instead of making new table for every user but it's smashing everything in my project.
i want to generate Model and CRUD of that user so i can do future transaction with that table.
i know how to generate Gii manually from ?r=gii. but here i want to generate automatically from back end.
i tried to search about this in Yii forum and in google also. but i didn't found anything.
is there any extension or anything which will generate it automatically.
will it be good idea to create model and CRUD for every table? or shall i communicate with table directly using CDbCommand?
you may use giix-core.
While You install the giix-core it's create the model and basemodel so if u have any changes in DB every time u can create the basemodel not a model.
so it's easy working and u can use method override.
Note: Please make sure you can not write any code in BaseModel
for more please refer following link...
http://www.yiiframework.com/forum/index.php/topic/13154-giix-%E2%80%94-gii-extended/

How to update app content downloading data?

I'm about to build an app in which there's an image giving information about weekly events that needs to be updated every week. I cannot update the app every week on the apple store and compel the user to update so often the app, so i was thinking to update automatically the app. I saw an app doing this: it update the content every time the user wanted to look at the need-to-be-updated content AND if he was connected to the internet. If he was online the content displayed would be the last one downloaded. How they could do this this? The only thing i could saw on the app is that when it was downloading the updated content it displayed the the typical wheel (http://spie.org/images/global/SearchWheel_Frame1.gif).
I'm using a sqllite database to store data. In fact, i have to update some strings of data inside the database...

Building a ColdFusion Application with Version Control

We have a CMS built entirely in house. I'm the new web developer guy with literally 4 weeks of ColdFusion Experience. What I want to do is add version control to our dynamic pages. Something like what Wordpress does. When you modify a page in Wordpress it makes some database entires and keeps a copy of each page when you save it. So if you create a page and modifiy it 6 times, all in one day you have 7 different versions to roll back if necessary. Is there a easy way to do something similar in Coldfusion?
Please note I'm not talking about source control or version control of actual CFM files, all pages are done on the backend dynamically using SQL.
sure you can. just stash the page content in another database table. you can do that with ColdFusion or via a trigger in the database.
One way (there are many) to do this is to add a column called "version" and a column called "live" in the table where you're storing all of your cms pages.
The column called live is option but might make it easier for your in some ways when starting out.
The column "version" will tell you what revision number of a document in the CMS you have. By a process of elimination you could say the newest one (highest version #) would be the latest and live one. However, you may need to override this some time and turn an old page live, which is what the "live" setting can be set to.
So when you click "edit" on a page, you would take that version that was clicked, and copy it into a new higher version number. It stays as a draft until you click publish (at which time it's written as 'live')..
I hope that helps. This kind of an approach should work okay with most schema designs but I can't say for sure either without seeing it.
Jas' solution works well if most of the changes are to one field, for example the full text of a page of content.
However, if you have many fields, and people only tend to change one or two at a time, a new entry in to the table for each version can quickly get out of hand, with many almost identical versions in the history.
In this case what i like to do is store the changes on a per field basis in a table ChangeHistory. I include the table name, row ID, field name, previous value, new value, and who made the change and when.
This acts as a complete change history for any field in any table. I'm also able to view changes by record, by user, or by field.
For realtime page generation from the database, your best bet are "live" and "versioned" tables. Reason being keeping all data, live and versioned, in one table will negatively impact performance. So if page generation relies on a single SELECT query from the live table you can easily version the result set using ColdFusion's Web Distributed Data eXchange format (wddx) via the tag <cfwddx>. WDDX is a serialized data format that works particularly well with ColdFusion data (sorta like Python's pickle, albeit without the ability to deal with objects).
The versioned table could be as such:
PageID
Created
Data
Where data is the column storing the WDDX.
Note, you could also use built-in JSON support as well for version serialization (serializeJSON & deserializeJSON), but cfwddx tends to be more stable.