Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4458 Widoki

I want to pass a variable to calculate a function field.

However, in the following code values stays empty (None) in def _get_mainproject.

How to solve this?

class xx_project_task(osv.osv):
     _inherit = "project.task"
    
     def _get_mainproject(self, cr, uid, ids, name, values, context):
         [some code here to get the main project, differs depending on the value of 'trigger']

     _columns = { 'xx_mainproject': fields.function(_get_mainproject, type="char", string='Main project',size=250,
             store={
                 'account.analytic.account': (lambda self, cr, uid, ids, name, values={'trigger':'account'}
                     , c={}: self.search(cr,uid,[(1,'=',1)]),['parent_id'], 10),
                 'project.task': (lambda self, cr, uid, ids, name, values={'trigger':'task'}
                     , c={}: ids,['project_id'], 20)
                  }
         ),}

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 25
193
0
lip 25
205
1
maj 25
763
0
mar 25
921
0
mar 25
833