Unique and Mandatory Email-id while adding new lead in OpenERP7 - odoo

I am new in OpenERP and have a task to achieve.
I want to keep Email-id unique and mandatory while adding new lead in CRM. I would like to know which is the best way to achieve it.
Thank You

you have to use _constraint for the field email address where it checks for the uniqueness of the field. use required=True for making it required for each data.
Cheers,
Parthiv

Related

SAP Business One I Query inventory base on user defined field

I am running a query on a product. I need a field that will look at the user defined field which contains another product and check that stock level. Any help would be great.
What is the main objective?
Are you trying to check on that item because that item is the material/component? or act like a substitution?
Using UDF is quite not feasible as you have to get the link to the Item Master Data, and I have not figured out yet how to do that.
But if you are using it as substitution, why don't you use Alternative Item in Inventory > Item Management > Alternative Items? It will show on Sales Quotation for you to display it to customer. Or during Sales Order, you can get it displayed for alternative should your main item is shortage.
If you are using those item as a component, I suggest you use Bill of Material. During Production Order you will be able to see those component's availability in qty, and also you can have more than one, unlike UDF.
Hope this helps.
I think the key part you're missing here is the naming convention which SAP adpots for user defined fields.
Correct me if I'm wrong, but it seems that you're capable of querying these fields from a SQL point of view.
UDFs by defuault, will have their column name prefixed with "U_".
For example, the UDF 'AnotherProduct' will be referred to in SQL as 'U_AnotherProduct'.
Hope this helps, if not, please explain your problem in some more detail.

Adding lookups to given view

I'm just getting into Yii. I have a simple relational db. I have a "client" table related to "orders" table (client:id to orders:client_id). If I build my CRUD for orders i naturally see client_id, however I'd rather add a lookup for client name somehow
I have found how to do this on new and update _forms by adding a dropDownList. The list based views seem a little more complex. I can see that actionIndex() in the controller is gathering data and passing it to index.php, finally through to _view, but I can't find any help on where and how I should break into this with my lookup returning the client name
I'd appreciate any help
thanks
Check the Yii documentation about relations. You will need to create a relation in your orders table, lets call it client, Then in your list view where it generates client_id you can put client.name instead. Now you will need to make sure that you have the appropriate label because in the generated model it will only have a label for client_id, and you need a label for client.name. Yii will guess, or you can add it, or you can modify the label for client_id, and instead of using client.name in the view you can use
array(
'name'=>'client_id',
'value'=>$model->client->name,
)
I tend to gravitate towards more explicit definitions rather than shortcuts, but to each his own.

renaming routes in rails 3

I'm new to this, so I'm not expecting that anyone tell me how to do it, just whether it's possible. If so, I'll continue to melt my brain with the docs.
I've been asked to change /markets/4/articles/32
to /markets/111111/articles/999999 where 111111 is in the remoteID field of the markets table and 999999 is in the remoteID field of the articles table.
The reason for this is that an external system will be creating the new records in the RoR app and inserting ITS id into the remoteID field. The next time it goes to update the record, it won't know the RoR ids without creating some kind of lookup.
From what I've seen, it can't be done. Maybe I'm just not looking hard enough?
Thanks,
Kelp
It should be possible, it probably can be changed to something like:
/markets/:market_remote_id/articles/:article_remote_id
It will then be available as params[:market_remote_id] and params[:article_remote_id] in your controller
Have a look at http://guides.rubyonrails.org/routing.html#dynamic-segments for the full story

Rails 3 find model attribute with foreign key in another model

I have two models, Reports(belongs to client) and Clients(has many reports). A Client has an attribute or column called "specialty". What I'm trying to do is to be able to call and display the Client.specialty attribute for that particular #client when inside the show page of a #client's Report. In my Report model I do have a "client_id" foreign key. I have no idea how to do this, I've gone about this far:
#report.client_id
This obviously displays a number, but I don't know how to go any further, In my noob ways I want to do something like this:
#report.client_id.specialty
But that doesn't work obviously. How do I do this?
why not the following?
#report.client.specialty

Rails: cannot change email after signed up?

i have a User model and some common columns, such as name, email, password, etc.
and here is the thing:
i donot want a user changing his email address after signed up, what should i do?
just don't include the email field in the update form?
and i think the attr_accessible is not for this use either.
what do you suggest? thanks a lot.
What you need is
attr_readonly
The documentation says the following
Attributes listed as readonly will be used to create a new record but update operations will ignore these fields.
So, a new record can be created with an email but you can never change it (without a hack) after the record has been created.