Improvement on invoice lines and analytic accounts
This commit is contained in:
@@ -70,6 +70,28 @@ class AccountInvoice(models.Model):
|
||||
return res
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = 'account.invoice.line'
|
||||
|
||||
# In the 'account' module, we have related stored field for:
|
||||
# company_id, partner_id
|
||||
currency_id = fields.Many2one(
|
||||
related='invoice_id.currency_id', readonly=True, store=True)
|
||||
invoice_type = fields.Selection(
|
||||
related='invoice_id.type', store=True, readonly=True)
|
||||
date_invoice = fields.Date(
|
||||
related='invoice_id.date_invoice', store=True, readonly=True)
|
||||
commercial_partner_id = fields.Many2one(
|
||||
related='invoice_id.partner_id.commercial_partner_id',
|
||||
store=True, readonly=True)
|
||||
state = fields.Selection(
|
||||
related='invoice_id.state', store=True, readonly=True,
|
||||
string='Invoice State')
|
||||
invoice_number = fields.Char(
|
||||
related='invoice_id.move_id.name', store=True, readonly=True,
|
||||
string='Invoice Number')
|
||||
|
||||
|
||||
class AccountFiscalYear(models.Model):
|
||||
_inherit = 'account.fiscalyear'
|
||||
|
||||
@@ -110,6 +132,10 @@ class AccountAccount(models.Model):
|
||||
class AccountAnalyticAccount(models.Model):
|
||||
_inherit = 'account.analytic.account'
|
||||
|
||||
invoice_line_ids = fields.One2many(
|
||||
'account.invoice.line', 'account_analytic_id', 'Invoice Lines',
|
||||
readonly=True)
|
||||
|
||||
@api.multi
|
||||
def name_get(self):
|
||||
if self._context.get('analytic_account_show_code_only'):
|
||||
|
||||
Reference in New Issue
Block a user