Reputation: 85
I want to create a journal entries from my custom module but I don't know which module I must inherit from account.payment or account.move and which steps I have to follow if I will choose one of them , I tried those 2 models but I had nothing the journal entries dos not created , I create order line class with currency and amount and I create input for payment date and I create the payment info in other page but I think I miss something here in payment info you can see it in the picture below .
class my_module(models.Model):
_name = 'my_module.models'
_inherit = ['mail.thread', 'ir.needaction_mixin','account.move']
name = fields.Char(string='my_module Reference')
field1 = fields.Monetary(string='Total Currency')
field2 = fields.Many2one('account.journal',string='Journal')
field3 = fields.One2many('my_module.currency','lines_id', string='currency Lines')
field4 = fields.Selection([('inbound', 'Inbound'), ('outbound',
'Outbound')], required=True)
and i found this method from account_asset model i think this one who do this job and that's it i didn't edit it yet because i don't know how to use it yet :
Upvotes: 0
Views: 1012
Reputation: 234
A new record for any model can be created from python by calling the create function of that model.
For example:
move = self.env['account.move'].create({'field_1': value, 'field_2': value})
Make sure you pass all required fields in account .move
Upvotes: 1