2
0

account_move_template: Migration to 11.0

This commit is contained in:
Raf Ven 2018-03-05 20:31:53 +01:00 committed by Abraham Anes
parent 48603ddf7f
commit 1fd226a7ea
10 changed files with 213 additions and 190 deletions

View File

@ -1,3 +1,8 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
=====================================================
Account Move Template - Templates for Journal Entries
=====================================================
@ -22,10 +27,15 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
Credits
-------
=======
Images
------
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Authors:
~~~~~~~~
--------
* Davide Corio <davide.corio@agilebg.com>
* Lorenzo Battistini <lorenzo.battistini@agilebg.com>
@ -33,8 +43,24 @@ Authors:
* Franco Tampieri <franco.tampieri@agilebg.com>
Contributors:
~~~~~~~~~~~~~
-------------
* Jalal ZAHID <j.zahid@auriumtechnologies.com> (port to v10)
* Alex Comba <alex.comba@agilebg.com> (Port to V8)
* Guewen Baconnier <guewen.baconnier@camptocamp.com>
* Raf Ven <raf.ven@dynapps.be> (port to v11)
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 See manifest
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

View File

@ -1,17 +1,20 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 See manifest
# Copyright 2018 Raf Ven <raf.ven@dynapps.be>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
'name': "Account Move Template",
'version': '10.0.2.0.0',
'version': '11.0.1.0.0',
'category': 'Generic Modules/Accounting',
'summary': "Templates for recurring Journal Entries",
'author': "Agile Business Group,Odoo Community Association (OCA), Aurium "
"Technologies,Vauxoo",
'website': 'https://github.com/OCA/account-financial-tools',
'license': 'AGPL-3',
'depends': ['account_accountant', 'analytic'],
'depends': [
'account',
'analytic',
],
'data': [
'security/ir.model.access.csv',
'view/move_template.xml',

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 See manifest
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

View File

@ -1,11 +1,10 @@
# -*- 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, exceptions, _
from odoo.tools.safe_eval import safe_eval
from functools import partial
import re
from odoo import models, fields, api, exceptions, _
from odoo.tools.safe_eval import safe_eval
class AccountDocumentTemplate(models.Model):

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Copyright 2015-2017 See manifest
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

View File

@ -1,120 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_move_template_line_tree" model="ir.ui.view">
<field name="name">account.move.template.line.tree</field>
<field name="model">account.move.template.line</field>
<field name="arch" type="xml">
<tree string="Journal Entry Template Line">
<field name="sequence"/>
<field name="name"/>
<field name="journal_id"/>
<field name="account_id" />
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="type"/>
<field name="python_code" />
<field name="move_line_type"/>
</tree>
</field>
</record>
<record id="view_move_template_line_tree" model="ir.ui.view">
<field name="name">account.move.template.line.tree</field>
<field name="model">account.move.template.line</field>
<field name="arch" type="xml">
<tree>
<field name="sequence"/>
<field name="name"/>
<field name="journal_id"/>
<field name="account_id" />
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
<field name="type"/>
<field name="python_code" />
<field name="move_line_type"/>
</tree>
</field>
</record>
<record id="view_move_template_line_form" model="ir.ui.view">
<field name="name">account.move.template.line.form</field>
<field name="model">account.move.template.line</field>
<field name="arch" type="xml">
<form string="Journal Entry Template Line">
<sheet>
<record id="view_move_template_line_form" model="ir.ui.view">
<field name="name">account.move.template.line.form</field>
<field name="model">account.move.template.line</field>
<field name="arch" type="xml">
<form string="Journal Entry Template Line">
<sheet>
<group>
<group>
<group>
<field name="name"/>
<field name="sequence"/>
<field name="journal_id"/>
<field name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
</group>
<group>
<field name="type"/>
<field name="move_line_type"/>
</group>
<field name="name"/>
<field name="sequence"/>
<field name="journal_id"/>
<field name="account_id"/>
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
</group>
<label for="python_code" string="Python Code"
attrs="{'invisible': [('type', '!=', 'computed')]}" nolabel="1"/>
<field name="python_code" colspan="4" attrs="{'readonly': [('type', '!=', 'computed')]}" nolabel="1"/>
<div class="oe_account_help">You can refer to other lines using their
sequence number (e.g. 'L(1)' for first line).
Examples of code: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1)
+ L(2) + L(3)'; '1250'</div>
</sheet>
</form>
</field>
</record>
<record id="view_move_template_form" model="ir.ui.view">
<field name="name">account.move.template.form</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<form string="Journal Entry Template">
<header>
<button string="Test template"
name="action_run_template"
class="btn-primary"
type="object"/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
<group>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
<field name="type"/>
<field name="move_line_type"/>
</group>
<field nolabel="1" name="template_line_ids"/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<!--<field name="activity_ids"
widget="mail_activity"/> TODO: uncomment on saas-15-->
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<record id="view_move_template_tree" model="ir.ui.view">
<field name="name">account.move.template.tree</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<tree string="Journal Entry Template">
<field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_move_template_search" model="ir.ui.view">
<field name="name">account.move.template.search</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<search string="Journal Entry Template">
<group>
<separator orientation="vertical"/>
<field name="name"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
<label for="python_code" string="Python Code"
attrs="{'invisible': [('type', '!=', 'computed')]}" nolabel="1"/>
<field name="python_code" colspan="4" attrs="{'readonly': [('type', '!=', 'computed')]}" nolabel="1"/>
<div class="oe_account_help">You can refer to other lines using their
sequence number (e.g. 'L(1)' for first line).
Examples of code: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1)
+ L(2) + L(3)'; '1250'</div>
</sheet>
</form>
</field>
</record>
<record id="action_move_template_form" model="ir.actions.act_window">
<field name="name">Move Templates</field>
<field name="res_model">account.move.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_move_template_search"/>
</record>
<record id="view_move_template_form" model="ir.ui.view">
<field name="name">account.move.template.form</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<form string="Journal Entry Template">
<header>
<button string="Test template"
name="action_run_template"
class="btn-primary"
type="object"/>
</header>
<sheet>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1><field name="name"/></h1>
</div>
<group>
<field name="company_id" widget='selection' groups="base.group_multi_company"/>
</group>
<field nolabel="1" name="template_line_ids"/>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<!--<field name="activity_ids"
widget="mail_activity"/> TODO: uncomment on saas-15-->
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
</record>
<menuitem
action="action_move_template_form"
id="menu_action_move_template_form" sequence="300"
parent="account.menu_finance_configuration"
groups="account.group_account_manager"/>
<record id="view_move_template_tree" model="ir.ui.view">
<field name="name">account.move.template.tree</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="company_id" groups="base.group_multi_company"/>
</tree>
</field>
</record>
<record id="view_move_template_search" model="ir.ui.view">
<field name="name">account.move.template.search</field>
<field name="model">account.move.template</field>
<field name="arch" type="xml">
<search string="Journal Entry Template">
<group>
<separator orientation="vertical"/>
<field name="name"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
<record id="action_move_template_form" model="ir.actions.act_window">
<field name="name">Move Templates</field>
<field name="res_model">account.move.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_move_template_search"/>
</record>
<menuitem
action="action_move_template_form"
id="menu_action_move_template_form" sequence="300"
parent="account.menu_finance_configuration"
groups="account.group_account_manager"/>
</odoo>

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)

View File

@ -1,9 +1,8 @@
# -*- 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
import time
from odoo import models, fields, api
class WizardSelectMoveTemplate(models.TransientModel):
@ -14,7 +13,7 @@ class WizardSelectMoveTemplate(models.TransientModel):
line_ids = fields.One2many(
'wizard.select.move.template.line', 'template_id')
state = fields.Selection(
[('template_selected', 'Template selected')], 'State')
[('template_selected', 'Template selected')])
@api.multi
def load_lines(self):
@ -59,7 +58,7 @@ class WizardSelectMoveTemplate(models.TransientModel):
move = self._create_move(name, journal.id, partner)
moves = moves + move
for line in self.template_id.template_line_ids.filtered(
lambda j: j.journal_id == journal):
lambda l, j=journal: l.journal_id == j):
lines.append((0, 0,
self._prepare_line(line, amounts, partner)))
move.write({'line_ids': lines})

View File

@ -1,80 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="wizard_select_template" model="ir.ui.view">
<field name="name">Select Move Template</field>
<field name="model">wizard.select.move.template</field>
<field name="arch" type="xml">
<form string="Move Template" >
<field name="state" invisible="1"/>
<record id="wizard_select_template" model="ir.ui.view">
<field name="name">Select Move Template</field>
<field name="model">wizard.select.move.template</field>
<field name="arch" type="xml">
<form string="Move Template" >
<field name="state" invisible="1"/>
<group>
<group>
<group>
<field name="template_id" widget="selection"
attrs="{'invisible':[('state','=','template_selected')]}"/>
</group>
<group>
<field name="partner_id" attrs="{'invisible':[('state','=','template_selected')]}"/>
</group>
<field name="template_id" widget="selection"
attrs="{'invisible':[('state','=','template_selected')]}"/>
</group>
<separator
string="Modify the lines before create them or edit them after creation."
attrs="{'invisible':[('state','!=','template_selected')]}"/>
<field name="line_ids" nolabel="1" attrs="{'invisible':[('state','!=','template_selected')]}"/>
<footer>
<button name="load_template" class="btn-primary" string="Load" type="object" colspan="1" attrs="{'invisible':[('state','!=','template_selected')]}" />
<button name="load_lines" class="btn-primary" string="Next" type="object" attrs="{'invisible':[('state','=','template_selected')]}" />
<button special="cancel" string="Cancel" class="btn-default"/>
</footer>
</form>
</field>
</record>
<record id="wizard_select_template_line" model="ir.ui.view">
<field name="name">Select Move Template Line</field>
<field name="model">wizard.select.move.template.line</field>
<field name="arch" type="xml">
<form string="Move Template Line">
<group>
<field name="sequence" invisible="1"/>
<field name="name" />
<field name="account_id" />
<field name="move_line_type" />
<field name="amount" />
<field name="partner_id" attrs="{'invisible':[('state','=','template_selected')]}"/>
</group>
</form>
</field>
</record>
</group>
<separator
string="Modify the lines before create them or edit them after creation."
attrs="{'invisible':[('state','!=','template_selected')]}"/>
<field name="line_ids" nolabel="1" attrs="{'invisible':[('state','!=','template_selected')]}"/>
<footer>
<button name="load_template" class="btn-primary" string="Load" type="object" colspan="1" attrs="{'invisible':[('state','!=','template_selected')]}" />
<button name="load_lines" class="btn-primary" string="Next" type="object" attrs="{'invisible':[('state','=','template_selected')]}" />
<button special="cancel" string="Cancel" class="btn-default"/>
</footer>
</form>
</field>
</record>
<record id="wizard_select_template_line_tree" model="ir.ui.view">
<field name="name">Select Move Template Line</field>
<field name="model">wizard.select.move.template.line</field>
<field name="arch" type="xml">
<tree string="Move Template Line" editable="bottom">
<record id="wizard_select_template_line" model="ir.ui.view">
<field name="name">Select Move Template Line</field>
<field name="model">wizard.select.move.template.line</field>
<field name="arch" type="xml">
<form string="Move Template Line">
<group>
<field name="sequence" invisible="1"/>
<field name="name" />
<field name="account_id" />
<field name="move_line_type" />
<field name="amount" />
</tree>
</field>
</record>
</group>
</form>
</field>
</record>
<record id="action_wizard_select_template" model="ir.actions.act_window">
<field name="name">Select Move Template</field>
<field name="res_model">wizard.select.move.template</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_select_template"/>
<field name="target">new</field>
</record>
<record id="wizard_select_template_line_tree" model="ir.ui.view">
<field name="name">Select Move Template Line</field>
<field name="model">wizard.select.move.template.line</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="sequence" invisible="1"/>
<field name="name" />
<field name="account_id" />
<field name="move_line_type" />
<field name="amount" />
</tree>
</field>
</record>
<act_window name="Create Move from Template"
res_model="wizard.select.move.template"
src_model="account.move"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_wizard_select_template_by_move"
view_id="wizard_select_template"/>
<record id="action_wizard_select_template" model="ir.actions.act_window">
<field name="name">Select Move Template</field>
<field name="res_model">wizard.select.move.template</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="wizard_select_template"/>
<field name="target">new</field>
</record>
<menuitem name="Create Move from Template" action="action_wizard_select_template" id="menu_action_wizard_select_template" sequence="10" parent="account.menu_finance_entries"/>
<act_window name="Create Move from Template"
res_model="wizard.select.move.template"
src_model="account.move"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_wizard_select_template_by_move"
view_id="wizard_select_template"/>
<menuitem name="Create Move from Template" action="action_wizard_select_template" id="menu_action_wizard_select_template" sequence="10" parent="account.menu_finance_entries"/>
</odoo>