Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

¿Como puedo poner un valor automatico en un campo float? / How I can put an automatic float value in a field?

By
Giovanny Vizcaya
on 10/2/14, 11:56 AM 627 views

Buenos días, estoy realizando unas listas de nóminas del IVSS (Seguro social venezolano) y quisiera ver si me pueden ayudar con este problema:

Al insertar el valor del campo "Salario diario", quiero que automáticamente se generen los valores de los campos "Salario semanal" (Salario diario x 7) y "Salario mensual (Salario Diario x 30), he buscado muchas maneras y las ya conocidas me dan errores y no genera los valores automáticamente.

Good Morning, i'm doing some IVSS (Venezuelan Social Security) payroll lists and i want to know if you can help me whit this issue:

By inserting the value of the "daily salary" field, I want automatically the values ​​of the fields "weekly salary" (Daily salary x 7) and "Monthly Salary (Daily salary x 30) are written, I have searched many ways and the known gives me errors and not automatically generates values​​.

0
Boris Ghelman
On 10/2/14, 8:48 PM

Hi Giovanny , maybe this link works :
https://www.odoo.com/forum/help-1/question/default-user-get-function-8740

( me puedes contactar para cambiar informacion y conocimientos 4142502020)

Para ilustrarlo mejor usa este codigo, como referencia , pero debes cambiarle el def para tu requerimiento

 

Call the function for the field price_unit in the view xml

<xpath expr="//field[@name='price_unit']" position="attributes"> <attribute name="on_change">check_margin(product_id,price_unit)</attribute> </xpath>

and in the class, define the function to process it.

def check_margin(self, cr, uid, ids, product_id, unit_price, context=None): res = {} warning = {} sale_price = None if product_id: sale_price = self.pool.get('product.product').browse(cr, uid,product_id).list_price if unit_price is None: pass elif unit_price < sale_price: warning = { 'title': _("Warning"), 'message': _('Unit price given, is less than the sales price of the selected product. Please change (or contact your sales manager to change) the sales price of the selected product.'), } res = {'value': {'price_unit':sale_price}} elif unit_price >= sale_price: res = {'value': {'price_unit':unit_price}} pass return {'value': res.get('value'), 'warning':warning}

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/2/14, 11:56 AM
Seen: 627 times
Last updated: 3/16/15, 8:10 AM