Search code examples
odooodoo-10openerp-8

How can I get static account, partner and other values in odoo 10?


I want to get specific(static) account and partner to do new account.move and account.move.line. How I can do this?

I have other custions about this. I put it in the code comments.

self.journal_entry = self.env['account.move'].create({

                    'journal_id': journal, #i dont understand this value
                    'partner_id': self.container.partner.id, #i need this value static
                    'date': fields.Date.context_today(self)

                    })
credit_line = self.env['account.move.line'].create({

                'move_id': self.journal_entry.id, #its this autoincrement?
                'account_id': self.product.revenue_account, # i need this value static
                'partner_id': self.container.partner.id, # i need this value static
                'name': 'Finish '+self.job_name, # i'm generate this value
                'credit': self.cost # i have this value
             })

Solution

  • journal_id - journal Entry

    partner_id - container.partner.id - where you can set default partner id.

    move_id - id of journal - Journal (line_ids = fields.One2many('account.move.line', 'move_id', string='Journal Items', states={'posted': [('readonly', True)]}, copy=True))

    It's not incremented

    account_id = fields.Many2one('account.account', string='Account', required=True, index=True, ondelete="cascade", domain=[('deprecated', '=', False)], default=lambda self: self._context.get('account_id', False))