跳至内容
菜单
此问题已终结

need to override account_invoice model default value of  journal_id field. I'm trying to do it like this:

class
account_invoice(models.Model):      _inherit = 'account.invoice'
    @api.model

    def _default_journal(self): 
        return None                   
    @api.model
    def _default_currency(self):
        inv_type = self._context.get('type', 'out_invoice')        

         inv_types = inv_type  if isinstance(inv_type, list) else [inv_type]         
        company_id = self._context.get('company_id', self.env.user.company_id.id)         
        domain = [ ('type', 'in', filter(None, map(TYPE2JOURNAL.get, inv_types))), ('company_id', '=', company_id), ]       

        journal = self.env['account.journal'].search(domain, limit=1) 

       return journal.currency or journal.company_id.currency_id.


But  def _default_currency is never override and its call from the odoo native model

形象
丢弃

Can you please try by defining journal_id field in account.invoice model again with that default function ?

相关帖文 回复 查看 活动
4
6月 19
8315
1
8月 23
4000
0
4月 23
3017
1
3月 23
2526
0
4月 22
2779