Най-накрая, след като се опитвах и опитвах в продължение на няколко дни, реших, използвах този код:
def _get_salario_diario(self, cr, uid, ids, field_name, arg, context=None):
res= {}
for record in self.browse(cr, uid, ids, context=context):
res[record.id]= record.month_wage / 30
return res
_columns = {
'month_wage': fields.float('Salario Mensual Bs.', digits=(16,2)),
'diary_wage': fields.function(_get_salario_diario, method=True, type='float', string='Salario Diario Bs.', store=True),
}
def onchange_month_wage(self, cr, uid, ids, month_wage, context=None):
vals = {}
if month_wage > 0:
vals['diary_wage'] = salario_mensual / 30
return {'value': vals}
и в моя xml файл
<field name='month_wage' on_change="onchange_month_wage(month_wage)"/>
<field name='diary_wage'/>
това реши проблема ми и модулът ми работи правилно, надявам се да помогне на всеки, който има нужда от него.
В края на краищата много ви благодаря за помощта!
person
GioV
schedule
09.02.2015
field1
поле, когато се промениfield2
ще се актуализира. Благодаря - person Bhavesh Odedra   schedule 16.01.2015