mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[FIX] move all unported addons into __unported__ folder instead of adding _unported suffix
This commit is contained in:
committed by
Iryna Vushnevska
parent
ee6766a4e4
commit
8c1631e635
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
# #
|
||||
# Author: Leonardo Pistone
|
||||
# Copyright 2014 Camptocamp SA
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU Affero General Public License as #
|
||||
# published by the Free Software Foundation, either version 3 of the #
|
||||
# License, or (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU Affero General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Affero General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
"""Wizard to mark account moves for batch posting."""
|
||||
from . import move_marker # noqa
|
||||
@@ -1,128 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
# #
|
||||
# Author: Leonardo Pistone
|
||||
# Copyright 2014 Camptocamp SA
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU Affero General Public License as #
|
||||
# published by the Free Software Foundation, either version 3 of the #
|
||||
# License, or (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU Affero General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Affero General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
"""Wizards for batch posting."""
|
||||
|
||||
from openerp.osv import fields, orm
|
||||
from openerp.addons.connector.session import ConnectorSession
|
||||
from openerp.addons.connector.queue.job import job
|
||||
|
||||
|
||||
class AccountMoveMarker(orm.TransientModel):
|
||||
|
||||
"""Wizard to mark account moves for batch posting."""
|
||||
|
||||
_name = "account.move.marker"
|
||||
_inherit = "account.common.report"
|
||||
_description = "Mark Journal Items for batch posting"
|
||||
|
||||
_columns = {
|
||||
'action': fields.selection([
|
||||
('mark', 'Mark for posting'),
|
||||
('unmark', 'Unmark for posting'),
|
||||
], "Action", required=True),
|
||||
'eta': fields.integer('Seconds to wait before starting the jobs')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'action': 'mark',
|
||||
}
|
||||
|
||||
def button_mark(self, cr, uid, ids, context=None):
|
||||
"""Create a single job that will create one job per move.
|
||||
|
||||
Return action.
|
||||
|
||||
"""
|
||||
session = ConnectorSession(cr, uid, context=context)
|
||||
for wizard_id in ids:
|
||||
# to find out what _classic_write does, read the documentation.
|
||||
wizard_data = self.read(cr, uid, wizard_id, context=context,
|
||||
load='_classic_write')
|
||||
wizard_data.pop('id')
|
||||
|
||||
if context.get('automated_test_execute_now'):
|
||||
process_wizard(session, self._name, wizard_data)
|
||||
else:
|
||||
process_wizard.delay(session, self._name, wizard_data)
|
||||
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
def process_wizard(self, cr, uid, ids, context=None):
|
||||
"""Choose the correct list of moves to mark and then validate."""
|
||||
for wiz in self.browse(cr, uid, ids, context=context):
|
||||
|
||||
move_obj = self.pool['account.move']
|
||||
|
||||
domain = [('state', '=', 'draft')]
|
||||
|
||||
if wiz.filter == 'filter_period':
|
||||
period_pool = self.pool['account.period']
|
||||
period_ids = period_pool.search(cr, uid, [
|
||||
('date_start', '>=', wiz.period_from.date_start),
|
||||
('date_stop', '<=', wiz.period_to.date_stop),
|
||||
], context=context)
|
||||
|
||||
domain.append((
|
||||
'period_id',
|
||||
'in',
|
||||
period_ids
|
||||
))
|
||||
elif wiz.filter == 'filter_date':
|
||||
domain += [
|
||||
('date', '>=', wiz.date_from),
|
||||
('date', '<=', wiz.date_to),
|
||||
]
|
||||
|
||||
if wiz.journal_ids:
|
||||
domain.append((
|
||||
'journal_id',
|
||||
'in',
|
||||
[journal.id for journal in wiz.journal_ids]
|
||||
))
|
||||
|
||||
move_ids = move_obj.search(cr, uid, domain, context=context)
|
||||
|
||||
if wiz.action == 'mark':
|
||||
move_obj.mark_for_posting(cr, uid, move_ids, eta=wiz.eta,
|
||||
context=context)
|
||||
|
||||
elif wiz.action == 'unmark':
|
||||
move_obj.unmark_for_posting(cr, uid, move_ids, context=context)
|
||||
|
||||
|
||||
@job
|
||||
def process_wizard(session, model_name, wizard_data):
|
||||
"""Create jobs to validate Journal Entries."""
|
||||
|
||||
wiz_obj = session.pool[model_name]
|
||||
new_wiz_id = wiz_obj.create(
|
||||
session.cr,
|
||||
session.uid,
|
||||
wizard_data,
|
||||
session.context
|
||||
)
|
||||
|
||||
wiz_obj.process_wizard(
|
||||
session.cr,
|
||||
session.uid,
|
||||
ids=[new_wiz_id],
|
||||
context=session.context,
|
||||
)
|
||||
@@ -1,60 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_move_marker" model="ir.ui.view">
|
||||
<field name="name">Mark Jornal Items for Batch Posting</field>
|
||||
<field name="model">account.move.marker</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Report Options" version="7.0">
|
||||
<label string=""/> <!-- binding for inherited views -->
|
||||
<group col="4">
|
||||
<field name="chart_account_id" widget='selection' on_change="onchange_chart_id(chart_account_id, context)"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="fiscalyear_id" domain="[('company_id','=',company_id)]"/>
|
||||
<field name="action"/>
|
||||
</group>
|
||||
<notebook tabpos="up" colspan="4">
|
||||
<page string="Filters" name="filters">
|
||||
<group>
|
||||
<field name="filter" on_change="onchange_filter(filter, fiscalyear_id)"/>
|
||||
</group>
|
||||
<group string="Dates" attrs="{'invisible':[('filter', '!=', 'filter_date')], 'required':[('filter', '=', 'filter_date')]}">
|
||||
<field name="date_from" />
|
||||
<field name="date_to" />
|
||||
</group>
|
||||
<group string="Periods" attrs="{'invisible':[('filter','!=','filter_period')], 'required':[('filter', '=', 'filter_period')]}">
|
||||
<field name="period_from" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
|
||||
<field name="period_to" domain="[('fiscalyear_id', '=', fiscalyear_id)]"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Journals" name="journal_ids">
|
||||
<field name="journal_ids"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<footer>
|
||||
<button name="button_mark" string="Mark" type="object" default_focus="1" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_move_marker" model="ir.actions.act_window">
|
||||
<field name="name">Mark Jornal Items for Batch Posting</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">account.move.marker</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<!-- replace existing menuitem -->
|
||||
<record id="account.menu_validate_account_moves" model="ir.ui.menu">
|
||||
<field name="name">Mark Journal Items for Batch Posting</field>
|
||||
<field name="action" ref="action_account_move_marker" />
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user