简体   繁体   English

如何传输发票中的数据以在 odoo v15 中注册付款?

[英]How to transfer data in invoice to register payment in odoo v15?

I add fields in 'acoount_move' and in 'account_register_payment'.我在“acoount_move”和“account_register_payment”中添加字段。

so, I want to show what is in the field 'acoount_move' in the field 'account_register-payment'.所以,我想在“account_register-payment”字段中显示“acoount_move”字段中的内容。

You can override the action_register_payment method您可以覆盖action_register_payment方法

def action_register_payment(self):
    ''' Open the account.payment.register wizard to pay the selected journal entries.
    :return: An action opening the account.payment.register wizard.
    '''
    return {
        'name': _('Register Payment'),
        'res_model': 'account.payment.register',
        'view_mode': 'form',
        'context': {
            'active_model': 'account.move',
            'active_ids': self.ids,
        },
        'target': 'new',
        'type': 'ir.actions.act_window',
    }

Pass the field value in the context and prefix the field name with default_ so the field in the payment register wizard will be automatically set for you.在上下文中传递字段值,并在字段名称前加上default_ ,以便自动为您设置支付注册向导中的字段。

In the following example, we suppose you have a reference (char field) in the account move model and you want to pass its value to the payment wizard, we take into consideration that the action_register_payment method is multi-record (self could be a recordset with multiple account moves)在下面的示例中,我们假设您在帐户 move model 中有一个引用(char 字段)并且您想将其值传递给支付向导,我们考虑到action_register_payment方法是多记录的(self 可以是一个记录集多个帐户移动)

Example:例子:

def action_register_payment(self):
    res = super(AccountMove, self).action_register_payment()
    res['context']['default_reference'] = ', '.join(rec.reference for rec in self)
    return res

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM