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

i have tried below code for onchange function but return some unreadable code

class sales_targets(models.Model):
    _name = 'sale.target'

    category = fields.Selection([
        ('normal', 'Product'), ('cloud', 'Cloud EYE'), ('tech', 'Technical Support Group'), ('db', 'Database'),
        ('odoo', 'Odoo'), ('can', 'CAN'), ('tod', 'TOD'), ('rental', 'Rental'), ('tec', 'TEC'), ('top', 'TOP'),
        ('tor', 'TOR'), ('tos', 'TOS'),
        ('aws', 'AWS')], 'Category', default='normal',
        help="A category of the view type is a virtual category that can be used as the parent of another category to create a hierarchical structure.")
    team_ids=fields.Many2many('crm.team','team_target_rel','target_ids','team_id','Sales Team')
    from_date=fields.Date('Budget From Date')
    to_date = fields.Date('Budget To Date')
    no_call=fields.Float('No of Calls')
    target_line=fields.One2many('target.line','target_id','Target Line', copy=True)




    @api.multi
    @api.onchange('team_ids')
    def _onchange_tem_salesperson(self):
        print ".....",self.id,self._origin

above code onchange function result is

...... <odoo.models.NewId object at 0x7f72aff2b290> sale.target()
Awatar
Odrzuć
Najlepsza odpowiedź

Hello!


@api.onchange
def _onchange_tem_salesperson(self):
      present_record_id=self._ids

      print present_record_id
     

Awatar
Odrzuć

Does not work. Still outputs <odoo.models.NewId object at 0x7f72aff2b290>

Najlepsza odpowiedź

Hello KLN,

AFAI you can't use a x_2many fields in onchange you canr refer to this issue for more info : https://github.com/odoo/odoo/issues/2693

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
lip 21
21049
1
mar 20
4433
0
sie 22
2277
1
lip 22
19957
0
kwi 22
2942