5bc8527f98
* [MIG] account_move_template: to 10.0 All working, removed feature of transitory account, I think that feature is redundant because it can be solved with python code lines and/or a proper server action per client, beside it was not properly documented. - All code refactored more new api oriented. - Tested with enterprise and all views fixed. - Removed all licences on files and moved as usual to where they belong. * [FIX] removed tax from view. The taxes should be triggered from the account itself and not wired into the template. * [FIX] account_move_template: Activities in just for saas-x comming on v100, for now I left it commented to simply uncomment it on v11 * [FIX] account_move_template: Cleanup translations, not useful after refactor * [REF] account_move_template: Removing all reference to taxes. * [IMP] account_move_template: Translating * [FIX] account_move_template: Fixing lints.
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2015-2017 See manifest
|
|
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
|
|
|
from odoo import models, fields, api
|
|
|
|
|
|
class AccountMoveTemplate(models.Model):
|
|
_name = 'account.move.template'
|
|
_inherit = ['account.document.template',
|
|
# 'mail.activity.mixin', TODO: uncomment for saas-15
|
|
'mail.thread']
|
|
|
|
@api.model
|
|
def _company_get(self):
|
|
return self.env['res.company']._company_default_get(
|
|
object='account.move.template'
|
|
)
|
|
|
|
company_id = fields.Many2one(
|
|
'res.company',
|
|
required=True,
|
|
change_default=True,
|
|
default=_company_get,
|
|
)
|
|
template_line_ids = fields.One2many(
|
|
'account.move.template.line',
|
|
inverse_name='template_id',
|
|
)
|
|
|
|
@api.multi
|
|
def action_run_template(self):
|
|
self.ensure_one()
|
|
action = self.env.ref(
|
|
'account_move_template.action_wizard_select_template').read()[0]
|
|
action.update({'context': {'default_template_id': self.id}})
|
|
return action
|
|
|
|
|
|
class AccountMoveTemplateLine(models.Model):
|
|
_name = 'account.move.template.line'
|
|
_inherit = 'account.document.template.line'
|
|
|
|
journal_id = fields.Many2one('account.journal', required=True)
|
|
account_id = fields.Many2one(
|
|
'account.account',
|
|
required=True,
|
|
ondelete="cascade"
|
|
)
|
|
move_line_type = fields.Selection(
|
|
[('cr', 'Credit'), ('dr', 'Debit')],
|
|
required=True
|
|
)
|
|
analytic_account_id = fields.Many2one(
|
|
'account.analytic.account',
|
|
ondelete="cascade"
|
|
)
|
|
template_id = fields.Many2one('account.move.template')
|
|
|
|
_sql_constraints = [
|
|
('sequence_template_uniq', 'unique (template_id,sequence)',
|
|
'The sequence of the line must be unique per template !')
|
|
]
|