Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
3312 Weergaven

I have this code: 


class ResCompany(models.Model):
    _inherit = "res.company"
   code_default = fields.Many2one(comodel_name='info.code', string='Default code', help="Default to the documents")

And in my invoice I want to have the default defined in the company:

class AccountInvoice(models.Model):
_inherit = "account.invoice"
@api.depends('company_id')
@api.model
def default_code(self):
if self.company_id:
return self.company_id.cae_default.id
code = fields.Many2one('info.code', string='Code', default=default_code, help="Code to the documents",) 


But when the code enter the function default_code the self.company_id  is empty! I also done a onchange but I realy need a default funtion ... 


Any help ? 

Thanks

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
1
mrt. 15
4811
2
mrt. 15
4534
2
jan. 23
2427
1
aug. 22
5344
1
jan. 19
3885