mirror of
https://gitlab.com/sonalarora/tra_backend.git
synced 2025-12-18 10:49:11 +02:00
work on intercompany
This commit is contained in:
19
intercompany_transaction_ept/models/account_invoice.py
Normal file
19
intercompany_transaction_ept/models/account_invoice.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from odoo import api, models, fields , _
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
|
||||
_inherit = 'account.move'
|
||||
_description = 'Account Invoice'
|
||||
|
||||
|
||||
intercompany_transfer_id = fields.Many2one('inter.company.transfer.ept', string="ICT", copy=False)
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(AccountInvoice, self).create(vals)
|
||||
order_id = self.env['sale.order'].search([('name', '=', res.origin)])
|
||||
if not order_id:
|
||||
order_id = self.env['purchase.order'].search([('name', '=', res.origin)])
|
||||
if order_id and order_id.intercompany_transfer_id:
|
||||
res.intercompany_transfer_id = order_id.intercompany_transfer_id.id
|
||||
return res
|
||||
Reference in New Issue
Block a user