mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of account_payment_analytic for 11.0
This commit is contained in:
1
account_payment_analytic/models/__init__.py
Normal file
1
account_payment_analytic/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import account_payment
|
||||
29
account_payment_analytic/models/account_payment.py
Normal file
29
account_payment_analytic/models/account_payment.py
Normal file
@@ -0,0 +1,29 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class AccountAbstractPayment(models.AbstractModel):
|
||||
_inherit = 'account.abstract.payment'
|
||||
|
||||
account_analytic_id = fields.Many2one('account.analytic.account', string='Analytic Account')
|
||||
|
||||
|
||||
class AccountRegisterPayment(models.TransientModel):
|
||||
_inherit = 'account.register.payments'
|
||||
|
||||
@api.multi
|
||||
def _prepare_payment_vals(self, invoices):
|
||||
res = super(AccountRegisterPayment, self)._prepare_payment_vals(invoices)
|
||||
if self.account_analytic_id:
|
||||
res['account_analytic_id'] = self.account_analytic_id.id
|
||||
return res
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = 'account.payment'
|
||||
|
||||
def _get_shared_move_line_vals(self, debit, credit, amount_currency, move_id, invoice_id=False):
|
||||
res = super(AccountPayment, self)._get_shared_move_line_vals(debit, credit, amount_currency, move_id, invoice_id=invoice_id)
|
||||
if self.account_analytic_id:
|
||||
# Note the field name is not an accident! res is `account.move.line`
|
||||
res['analytic_account_id'] = self.account_analytic_id.id
|
||||
return res
|
||||
Reference in New Issue
Block a user