0

I want to merge my custom:modul iwth the account_accountant modul for customer invoices. I want to have some functions of my custom_modul in the form view page for customer invoices.

from odoo import fields, models, api


class Acc_Xinv(models.Model):
    _name = 'acc.xinv'
    _inherit = ['x.invoice', 'account.move']
        
    transaction_ids = fields.Many2many('account.move.transaction', 'transaction_channel_profile', '?', '?')


class XInvoice(models.Model):
    _name = 'x.invoice'
    _inherit = ['mail.thread', 'mail.activity.mixin']
    _description = "X-Invoice"
    _recname = 'name'
    _order = 'create_date desc'
    
    a lot of custom fields and custom functions: 
    ######

Error : enter image description here

I know I have to create a new many2many field to merge my two models, but in account.move here there is no transaction_ids.

My questions : What id should I put in many2many field? What does the error means, if there is no such many2many field?

Kenly
  • 24,317
  • 7
  • 44
  • 60
for-loop
  • 47
  • 1
  • 8
  • Is there a many2many field in `x.invoice` using the `account.move.transaction` model (comodel_name)? – Kenly Aug 10 '22 at 10:08
  • No the x.invoice modul doesnt have a relation with account.move.transaction yet at all. This custom modul doesnt depend on any other modul, until now when I wanted to put some features of the custom:modul in account modul. – for-loop Aug 10 '22 at 10:12
  • Did you fix it? – Kenly Aug 11 '22 at 12:25
  • Thank you very much Kenly. I have to put this on ice, so I didn't manage to continue with this. – for-loop Aug 12 '22 at 15:05

1 Answers1

1

This error happens when odoo try to create the join table using an existing table name and column names which mean you have somewhere a many2many field with the same definition.

To fix the issue try to change the relation name to something else, xinv_transaction_channel_profile for example

Kenly
  • 24,317
  • 7
  • 44
  • 60