I want to declare my view file that its struct is loaded from database. I know in order I have to declare it on openerp.py file. But I have many user, and I want each of theme when access to my module (form view - for instance) will have difference view (fields), I am mentions to fields on database, not by "how to hide some fields for some user?". Is there any solution for this? Thanks
You can use Field Access Right.
As of OpenERP 7.0, you can create field level access rights. You can achieve this by adding the groups attribute in your field definition in the module:
_columns = { 'my_field': fields.char('My field', groups="base.group_erp_manager,base.group_system") }`
It's still valid in Odoo 8. Check Odoo documentation about security
https://www.odoo.com/documentation/8.0/reference/security.html
There is one solution I'm thinking of but haven't try it yet:
Override _views_get_fnc in 'ir.actions.act_window' model. This function return {action_id: (view_id, view_mode)}. Here you can query for view_id based on the user.
Related
I was looking at this post: Magento 2 Add a custom input field on chackout forrm and save it
I have tried the same way but I am not sure how this part came
$customField = $shippingAddressExtensionAttributes->getFiscalCode();
$shippingAddress->setFiscalCode($customField);
Where is this getFiscalCode?
It's a Custom AttributeCode.
the getFiscalCode() method is an accessor method that is used to identity fields such as the one that is created with the extension attribute fiscal_code mentioned in the example.
It is not just extension attributes, but all collection models in magento use the following camel casing structure where for example the column entity_id in database table, can be accessed via either $modelCollection->getEntityId() or $modelCollection->setEntityId($valueOfEntityId)
This is a good read to understand the idea Magento 2: CRUD Models for Database Access
I want to filter many2one field using a domain in the create view. What I'm trying is send a list to the view as a functional field and use it in the domain. (That list will change according to user) It will look as follows,
<field name="filter_ids" invisible="True"/>
<field name="department_id" domain="[('id','in',filter_ids)]">
What type of functional field should I use for this purpose?
Or any idea to dynamically change (one user to another) the domain of a many2one field?
I tried many ways using on_change, fields_view_get and so many others. On_change calls on load but it doesn't filter values onload. fields_view_get add the domain but it apply for all form views including update view which should not happen according to the requirements. please help :)
1-You can use fields_view_get then
2- set
so you don't get the field in your edit view
3- use another field which should behave as you want it on the edit view
I am creating a new Joomla Component. I am able to create custom fields for the component backend forms - but I am not able to create Dynamic Custom Fields.
What I would like to do is have a field that is dynamical populated based on the value of a previous field. The easiest way to explain this is the simple country,state,city breakdown.
Field 1 = Country
Field 2 = State (Based on what the user selected as as Country in Field 1)
Field 3 = City (Based on what the user selected as State in Field 2)
The fields would of course need to be refreshed, reset as the user picks a different country etc.
The data to populate the fields would also all need to come from a database based on the previous fields value.
I am guessing this needs to be done via ajax or javascript or something? But wondering if there is an official way? Especially since there are database calls involved.
Please let me know if there is anything I can explain better..
David
I ended up just creating text fields but then validating the input to make sure the values added are correct.
I have a form generated with the sonata admin bundle. I want to enable a live search tip for my user on an input field. The proposition should come from a category table in the DB.
For example, if I have a field called company, when a user writes "a", I should suggest all companies whose name contains "a".
Use JQuery Autocomplete. On server side create controller action that will return suggestions through AJAX.
See example - http://jqueryui.com/autocomplete/#remote-jsonp
I followed this tutorial on how to build a component for joomla 2.5, but now I am stuck.
What I want to do:
Besided thoses field defined in admin\models\forms\.xml I want to dynamically add form fields. The field list should be read from database.
I have a:
main table #__tours(id, title),
field list table #__tourfields(id,lable,description,position)
field value table #__tourfieldvalues(tourid,fieldid,fieldvalue)
#__tourfields contains a list of additional fields, that the user may want to specify for each entry in #__tours. #__tourfieldvalues would contain the values for the additional fields.
So now I need to figure out how to add input boxes to the edit form for each row in #__tourfields, read the values in #__tourfieldvalues for the currently to display entry of #__tours.
How can I do this?
This is very complex question. Subject to small book :)
In general you have to create class for every field type and initiate this class for every field in #__tourfields. This class have to extend JFormField and have getInput() method overridden.
Then in cycle you fetch your fields.
Something like this. But I believe you have to have more specific question. This one sounds like "How to create CMS like Joomla from scratch?"