如何使用自定义模块创建没有发票的日记账分录?(见下图)

2024-04-30 04:28:56 发布

您现在位置:Python中文网/ 问答频道 /正文

我想从自定义模块创建日记条目,但不知道必须从哪个模块继承帐户.付款或者帐户.移动如果我选择其中一个,我必须遵循哪一个步骤,我尝试了这两个模型,但是我没有日记账分录没有创建,我用货币和金额创建订单行类,然后创建输入付款日期,我在其他页面创建付款信息,但我想我错过了付款信息,你可以在下面的图片中看到。在

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)

我从account_asset model中找到了这个方法,我想这位做这项工作的人,就这样,我还没有编辑它,因为我还不知道如何使用它:

Payment info image


Tags: 模块name模型信息fieldsstringmodelsmy
1条回答
网友
1楼 · 发布于 2024-04-30 04:28:56

通过调用模型的create函数,可以从python创建任何模型的新记录。在

例如:

move = self.env['account.move'].create({'field_1': value, 'field_2': value})

确保您传递了帐户中所有必需的字段。移动

相关问题 更多 >