Auto Fill some fields in Odoo 11 - odoo-10

I work on transportation module related to sale.order module
I added transportation tab on sale.order module where it pool its data from the built-in module (available in odoo 11)called fleet.vehicle
I want that when I select vehicle name,
other fields in the tab are filled automatically such as chassis number, license plate,....
my code is below(it does not work)
#api.onchange("model_id")
def onchange_lines(self):
if self.model_id:
cr = self.pool.cursor()
check=self.pool['fleet.vehicle'].search(cr, self.env.uid,['model_id','=',self.model_id])
for record in check:
if record:
self.vin_sn=record[vin_sn]
I work on ubuntu and odoo11
please help
thanks

You have to make your onchange on selection field of vehicle name. Not on model_id. After that in onchange first check if you are getting vehicle then you can get related field value in self or else create browseable object and return value whatever you want.

Related

Servicenow - Service Catalog Reference Field - Insert different column than the display value

Let me describe my problem:
I have a table for all my IT-Services. I reference to this table more than once, for different purposes. Most of the time I need to reference to the name of the service. That's why I keep the name as displayed value.
One Column of that table is a service_id (custom field) which is for example "Service_004". Now in a catalog request Item the User has to fill in the service_id in a reference field.
But since I have the name as displayed value, and I need it in other forms, I am unable to reference to the service_id.
Using the variable attributes field I managed to let the service be found using the autocomplete function. But in the reference field I still get the servicename. I know that I can change the display value in the dictionary, but this breaks other functions. So what I need is to change the display value just for one reference field.
Also I tried to create a new table called IT-Services2 with reference to my table IT-Services. Then I switched the display to true in the new table for my service_id, but this will even change it in the parent table.
Perhaps an onChange client script utilizing g_form.setLabelOf() ?
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#setLabelOf
Maybe I'm not fully understanding your question...
I ran into this issue before, what you can do is create select box variable and use an on load client script to populate the list with the service_id(s) from the table you are referencing.
I would write a script include to pull the data from the table and call it from the client script via GlideAjax.

Joomla Component Dynamic Custom Field based on other Field Value

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.

compute and confirm all payslips of a batch once

I am working on Odoo and I have generated payslips of all employees and now I want to compute and confirm all the payslips of batch once.
Is there any option in Odoo 8 ?
I search a lot but i did not found any thing.
Is it possible or not in odoo?
Yes it totally possible in ODOO 8.0 as well as OpenERP 7.0 and you have develop your own customize module from your side.
Your customized Module can do the following things :
1.Add new wizard and based on the wizard that have 2 different field from the start date and end date or using as the accounting period and many2one field from your side.
2.Add the new for employees into that wizard as many2many for that wizrd
3.add the button for print your payslip
hear the payslip will print based on selected date or selected accounting period and your selected employee list (as defined as many2many)

Update Custom user attribute using Rally User Management

I have created a custom field for user in Rally called 'Info'. I have a excel which contains 2 columns userID and Info. I am trying to use the 'update_user_attributes.rb' ruby script from Rally User Management. But it seems to update only the Last name field and not the custom attribute Info. Kindly help me with this
The update_user_attributes.rb script only includes a select list of extended User Attributes, since it currently doesn't poll for and handle any/all Subscription-Specific Custom Fields for the User Object (these will vary from customer to customer, or subscription to subscription).
This Gist contains a custom version of update_user_attributes.rb that adds a handler for an Info field that is at Column 14 of an input tab-delimited text file. You may use it in replacement of the default update_user_attributes.rb script. It will populate the content from Column 14 into a custom field called "Info" that must exist on the User Object (if it doesn't, the customized updater script will fail).
You may wish to file a GitHub Issue for the User Mgmt Toolkit to request an enhancement to allow for configuration of a user-specified list of Custom Fields on Users.

Jomsocial - How to add an extra field on the first page of Jomoscial registration

I am struggling to do a hack in the default Jomsocial Registration.Problem is that, if you see the default jomsocial registration page it has all the fields that are there in default core joomla registration page.i.e Name,Username,E-mail,Password,Verify Password.
But I want to add an extra-field on this jomsocial page.Right now if i add a extra field using custom profile then user has to click next and go to next page which is long process and giving high bounce rate on my user registration.
So can you please advice me on the same and one more thing is it like if say we add a field in Joomla default registration page it will automatically come to jomsocial first page..
Will be thankful,if someone can help me to solve this problem.
You can add custom registration field on the first page by following the process (works with joomla 2.5) :
Step 1 : You have to add the field so that it appears on the first page (front end), for that go to components\com_community\templates\default\register.index.php
Now just add the field as other fields are there, for example(FIELD is taken as field name to be added)
See example here : Click Here!
you may copy and paste other field details and then edit for your own, the label tag shows how the label will appear at the front end, the input field shows the input field, you can adjust the size, but should not change the id, name (as would be required while collecting the data) and the value (other then replacing the previous field name with the new field name where ever it appears!), class can be edited as required, like removing 'required' will make the field optional to be filled, validate-FIELD is used if you want to validate the field using some script for the values entered, span is for displaying the error msg... now when you have added the field so that it appears in front page, you will have to do some work so that the data is actually taken to the database when the form is submitted! So we go for ---
Step 2 : when the form is submitted, the data is not stored in prefix_users table, but an object is created which stores the temporary information and then it is stored in com_community\models\register.php , now to change the object and add one more field so that the object contains the value of our field also, we have to add one line in it, you will see code like
$obj = new stdClass();
$obj->name = $data['jsname'];
$obj->firstname = isset( $data['jsfirstname'] ) ? $data['jsfirstname'] : '';
$obj->lastname = isset( $data['jslastname'] ) ? $data['jslastname'] : '';
$obj->token = $token;
$obj->username = $data['jsusername'];
$obj->FIELD = $data['jsFIELD'];
$obj->email = $data['jsemail'];
$obj->password = $data['jspassword'];
$obj->created = $nowDate;
$obj->ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ?
in the above code, in the 7th line i have added my field so that the object also stores our field when the form is submitted, now we must add one field in the table where this object is actually stored for a moment, that table is prefix_community_register
The table is like -
1 id int(10)
2 token varchar(200)
3 name varchar(255)
4 firstname varchar(180)
5 lastname varchar(180)
6 username varchar(150)
7 email varchar(100)
8 password varchar(100)
9 created datetime
10 ip varchar(25)
11 FIELD int(11)
11th field of the table is the field we are adding, it must be of same name as field inside the object (eg. if the object has $obj->age , the name of the field in table must be 'age' too!), so now finally we need to store the same data permanently in the prefix_users table, so create a field in the table with the same name and attributes, when the registration is complete, the value will be stored in the users table too, then you can use that field where ever you want ;)
Go to Administrator--> component --> Jom social--> Custom profile --> New Field .
Here you can easily add your New field..!!
I think it will be help you..!!
I actually use Jom Social and Joomla. I have used them for quite sometime and here is the link to the answer to this question.
I am not sure if it has changed in 3.0 JomSocial but this should help.
Jomsocial Custom Profile - Display email used on first page of registration onto the second page of registration
Also keep in mind you can always create your own registration page and then allow users to fill in the secondary profile information from their edit profile page. Just redirect to edit-profile once logged in.
A good component to use to build custom forms and such is http://fabrikar.com.
Hope this information helps

Resources