Create external reference id - odoo

I have duplicated a new group in OpenERP 6.1.1 .
Now I need to create an external reference id for it since I need to refer it in a view.
Normally, I guess, I should have created the group using an xml file but now I have already been using the group and assigned users to it so I don't wan't to redo the whole thing again.
Is there a simpler way ? Please suggest. Thanks in advance.

You can manually insert a row in the table ir_model_data. name is the external id and res_id is integer id. Other required fields are module and model.

Related

Xcart - How to delete rows from table in Xcart

I am using X-Cart for my project, I need help in how to perform delete query in X-cart. Currently, I am using the below code but it showing me an error.
Can anyone help me in this??
$products = \XLite\Core\Database::getRepo('\XLite\Module\XCExample\FormDemo\Model\NewScroll')->createQueryBuilder('p');
$products->delete('xc_news_scroll p');
$products->getResult();
If you want to remove some object, then you should go:
\XLite\Core\Database::getRepo('\XLite\Module\XCExample\FormDemo\Model\NewScroll')->delete($newScrollObjectToRemove);
If you want to remove some column from the database schema, you need to edit the model class of the entities stored in the table and remove this property there. After that, you will need to re-deploy the store.
Best,
Tony

Function Module to copy purchase order to another order

I'm creating documents using the function module BAPI_PO_CREATE1 and modifying documents using BAPI_PO_CHANGE to update some parts of the purchase order.
I need to create two orders with the same purchase order lines, one for purchasing and another for transferring.
I can do it calling BAPI_PO_CREATE1 twice with the same POITEMs. Is there a function module to create a copy of a purchase order using a reference number (PO_NUMBER) and a modified header?
I think you could use BAPI_PO_CREATE1 using fields PREQ_NO and PREQ_ITEM from POITEM structure.
Just ensure you have update structure POITEMX with these fields...
Try it out and let me know.

How to retrieve group notification_key or delete existing group?

Documentation is very poor concerning anything but the basic example and I cannot find how to retreive group notification_key or, alternatevly, delete a group using its notification_key_name and then create it again so that I could store its notification_key.
The reason I need this is that I forgot to store the notification_key the first time I created a group for a notification_key_name, for which I used a combination of app name and username. When I try to create a group with the same notification_key_name, I get a response that group already exists. I could probably change the key_name into something else (and in retrospect I should have used something like test-johndoe while testing), but it would be much better to somehow retreive the group key or just delete the entire group and create it again. How do I do that?

Table structure for Messages System

Hi i need to design a messaging system like facebook. I was thinking to build table similar
(source: serviciipeweb.ro)
where i can store olderMessage in another table so i can make quicker query in Message Main table...
but i cant resolve the problem about deleting messaging. If a user delete a message the other one should still read it.
How can i build it?
I googled but i didnt find anything.
P.S: I must use SQL-SERVER
Thanks
Create two fields in your Message table:
DeletedByFrom
DeletedByTo
Filter your results on this:
where DeletedByFrom = False
So you only get the rows that weren't deleted (in this case by the 'From' user)

Getting last inserted id from a table not part of the current controller I am in

I need to get the last inserted ID from a table which is not part of the current model nor the current database connection: right now I am in table (pdtlisting) but I want to get the last inserted id from table (deallisting). How can i get it?
try this..
Its for mySql..
LAST_INSERT_ID()
OR
Its for Php..
mysql_insert_id()
All the last_insert_id functions (be they PHP wrappers or the native mySQL one) typically refer to the last ID created using the current database connection. The last login was probably not created during the same request you are showing the table in, so this method won't work for you.
Use a normal SELECT to find out the newest login instead - e.g. by using ORDER by creationtime DESC LIMIT 1.
OR
In Yii you can find the last inserted id like this ..
Yii::app()->db->getLastInsertID();
also you can refer this link..
http://www.yiiframework.com/doc/api/1.0/CActiveRecord#primaryKey-detail