Anyone here knows how to post data to 2 different instances of Odoo at the same time? Below is my codebase
for key,value in customers.items():
for val in value:
models.execute_kw(db,uid,password,'res.partner','create',[
{
"contact_type": val['contact_type'],
"mobile": val['mobile'],
"name": val['name'],
"phone": val['phone'],
"ref": val['ref'],
"state_id":val['state_id'],
"x_studio_after_sales_sc_suppor":val['sc_name'],
"x_studio_birthday": val['x_studio_birthday'],
"x_studio_genre": val['x_studio_genre'],
"x_studio_spoken_language":val['lang_name'],
"company_id":2,
}
])
I want to dynamically load customer information to the 2 instances by just changing the company_id field value; 1 for default instance and 2 for the second instance. My codebase so far is able to load data to the default instance, the second instance throws permission errors. Any ideas on how to resolve this?
edit:
In that case you have to check if your user has rights to write for second company. user -> Allowed Companies
Also all related objects have to be accessible to by second company. (i cant see any relations from your example)
Related
Background: I'm using python 3 (with Flask and Bootstrap) to create a website with fields to capture data. There is an API running from a HighQ database to take data from a record, and once the form is submitted, put updated / new data back into the same record in the HighQ database (and also to an SQL database). This is all working successfully.
This is a tool that is being used internally within the company I work for, and hosted on the intranet, so I haven't set up user logins as I want it to be as quick and easy as possible for the team to use this form and update records.
Issue: When two or more instances of the form are being used at the same time (whether it's on one persons computer, or if two people are testing on their own computers) the data submitted from one person's form will overwrite the destination record that the other person has called into their form. I'm struggling to find the solution that ensures each time the form is launched, it ringfences the data so that this does not happen.
I've tried a number of things to resolve this (including lots of stackoverflow searches):
Originally I used global variables to pass data across different routes. I thought the issue was that everyone launching the form could access the same global variables, so I changed the code to remove any global variables, and instead used a combination of taking content within each of the fields in the site, and saving it as a local variable within the route I needed it in, and for any variables that were not obtainable from a field, I saved them to the 'session'.
The problem is still persisting and i'm now at a loss on what to try next. Any help on this would be much appreciated.
I have a use-case of retrieving content that is created by a particular user. Whenever I try GETng it, I am getting all the data created by different user.
Scenario 1:
I have an admin user. I created a content type of stock-list with name and description field.
I created 5 rows of data as per stock-list content type.
Scenario 2:
I have another user say testA.
I have created 4 rows of stock-list content by logging in as testA.
Now I wanted to retrieve stock list created by userA. Supposing I have a public endpoint for getting GET /stock-lists, how can I GET that ?
Currently when I am firing GET /stock-lists, I am getting all the data created by admin and testA user combined.
Can anyone help ?
does the stock list have a relationship with a user.if not make a relationship of one user having many stocks then you can make a query by finding all the stocks with a specific user.
I am an interesting project, but I have a problem that I would like to solve before starting.
I am in the process of building an extranet for a franchise. The franchise therefore has several franchisees in several geographic sectors. They will have to connect from the same login page (same application). In this page there will be a region selector There will be a database per franchisee (constraint imposed)
Do you know a method so that depending on the region selector, the user connects to the chosen base?
for example:
region paca => base 1
region center => base 2
etc,
I know Laravel relatively well, but I have never had the problem so far. If anyone has an idea or would have had the same scenario, I would be very grateful if they would share their info.
Thank you in advance for your help
There is multiple ways to achieve what you want, it depend of what is duplicate.
Just, you have to store the information somewhere, and to have an object that say "option", for example:
"regionA": {
"db": "dbA",
"name": "Region A"
}
Just manage it as you want, that's why I write it in JSON.
Each region have a different server
You just redirect people on good website, and each website use it's own database
One server, but different schema in database
Use different connection, according to the region. For example, the region "A" use the database "software_a".
For example, one will do:
DB:connection("db_regionA")
Another will do:
DB:connection("db_regionB")
One database, one table, all rows says it's region
Just in SELECT request, such as:
SELECT * FROM mytable WHERE region = "A"
I am using load runner 9.5. I am facing a problem during Dyanmic data handling. Scenario is given below-
I have Library management application. Login-> Select book(data display based on User credential) -->Purchage and Logout.
Ex: Guest user: 50 Books display to choose
Admin : All Books display choose
Normal user : 100 Bokks display choose
Please help me How to handle these type of dynamic data based on user role. Is there need to create different script with different role ?
Please follow the below steps -
Record the same flow with the same user credential 2 times (Replica of first script)
Compare the scripts using W diff
Find the values which are different like purchase order, timestamp and user session.
Correlate the values which are highlighted in yellow means value which is different in each script.
Have you had the benefit of training in LoadRunner and a mentor for your first year of work in this field?
I am working on Notes in MS CRM 2011.
I have many roles over many entities.
I want role based security to notes for any entity records.
let me explain what i want:
Suppose i have an entity namely E1.
Role R1 and R2 has read and write access to E1.
But i want that user having role R2 can only upload and view notes for any record of entity E1.
Hope now my requirement is clear to all of you.
Please suggest me how can i achieve it using MS CRM 2011.
I can think of two ways to do this.
You can create a plugin on create/update of the annotation(note) and check if the note is related to entity E1 and check the roles of the user making the change and see if they only have the R2 role. If that is the case you can throw an InvalidPluginExecutionException with a message like 'You do not have permissions to edit/create these records'.
You can try using role based forms or JS to hide the notes area for R1 users.
You probably want to use a combination of #1 & #2. The users can still access the notes via advanced find and thus will be able to edit those notes. The plugin will prevent that fringe case as well.
*Edit
There are a couple more things that you might be able to deal with the advanced find records. You can remove the annotation entity from advanced find via the unsupported method described here.
Otherwise there is one more thing you can do if you want to prevent those results showing up at all, and you want to stay supported. You can write a plugin on Post-RetrieveMultiple of the annotation entity to strip out the results directly from the return result. There are a couple downsides to this though.
You are executing your plug-in every time the retrieve multiple is called on the entity. So this code will need to be as efficient as possible since that delay will be noticeable by the end user whenever they retrieve these records.
Things like advanced find will display odd results. For example if your paging is set to 50 records and you strip out 10, they will only see 40 records on their page and the total record count will include the records you are stripping out.
Through roles i don't know a way to do that, because you configure the access to notes generic, so applies to all entities. You have to access with Javascript navigating in DOM. Check a example:
document.getElementById("notescontrol").contentWindow.document.getElementById("NotesTable")
You can check this with the help of a develeper tool in your browser.