Public release from ruodoo-project: 19.0 - 2026-05-31 21:19:12 UTC

This commit is contained in:
CI Publish Bot
2026-05-31 21:19:21 +00:00
commit aa4214c195
1213 changed files with 183945 additions and 0 deletions

14
l10n_ru_act_rev/README.md Normal file
View File

@ -0,0 +1,14 @@
# Российская локализация - Акт сверки
name: l10n_ru_act_rev
## Описание
Добавление печатной формы акт сверки из контактов, с помощью которой можно легко отслеживать дебеторские и кредиторские проводки с клиентами.
### Для печати:
1. Выбираем меню Контакты - карточку конкретного партнера - Действия - "Печать акт сверки";
2. В визарде выбираем:
2.1. Компанию (для которой нужна сверка с выбранным контактом);
2.2. Период сверки;
2.3. Цель (один из режимом: все проведенные проводки или все проводки, включая черновики);
3. Кнопка "Печать"

View File

@ -0,0 +1,4 @@
from . import models
from . import report
from . import wizard
from . import controllers

View File

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
{
'name': "Российская локализация - Акт сверки",
'summary': """
Добавление отчета акт сверки""",
'description': """
Добавление формы акт сверки, находящегося в контактах, с помощью которого можно легко отслеживать дебеторские и кредиторские проводки с клиентами.
Для печати:
1. Выбираем меню Контакты - конкретного партнера - Действия - "Печать акт сверки";
2. В визарде выбираем:
2.1. Компанию (для которой нужна сверка с выбранным контактом);
2.2. Период сверки;
2.3. Цель (один из режимом: все проведенные проводки или все проводки, включая черновики);
3. Кнопка "Печать"
""",
'author': "MK.Lab",
'website': "https://www.inf-centre.ru/",
'category': 'Uncategorized',
'version': '0.1',
# any module necessary for this one to work correctly
"depends": ["account", "portal", "website", 'contacts', "l10n_ru_doc", 'l10n_ru_contract', 'l10n_ru_base'],
"data": [
"security/ir.model.access.csv",
"wizard/general_ledger_wizard_view.xml",
"report/layouts.xml",
"report/general_ledger.xml",
"views/account_account_views.xml",
"views/report_general_ledger.xml",
"views/portal_templates.xml",
],
"installable": True,
"application": True,
"auto_install": False,
# only loaded in demonstration mode
'demo': [
'demo/demo.xml',
],
}

View File

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import controllers

View File

@ -0,0 +1,89 @@
from odoo import http
from odoo.http import request
from datetime import datetime, date
class ActRevise(http.Controller):
@http.route(['/my/act_revise/<string:act>'], type='http', auth="public", website=True)
def print_report(self):
partner = request.env.user.partner_id.parent_id.id
partner_name = request.env.user.partner_id.parent_id.name
if not partner:
partner = request.env.user.partner_id.id
partner_name = request.env.user.partner_id.name
company = request.env.user.company_id.id
company_name = request.env.user.company_id.name
today = date.today()
d1 = today.strftime("%d.%m.%y")
wizard_data = {
"target_move": "posted",
"hide_account_at_0": True,
"foreign_currency": True,
"company_id": company,
"partner_ids": [partner],
"show_cost_center": True,
"centralize": True
}
wizard_record = request.env['general.ledger.act_revise.wizard'].sudo().create(wizard_data)
action = request.env.ref('l10n_ru_act_rev.action_general_ledger_wizard').read()[0]
action['res_id'] = wizard_record.id
action['context'] = dict(request.env.context)
return request.redirect('/web#action=' + str(action['id']) + '&id=' + str(wizard_record.id) + '&view_type=form')
# @http.route(['/my/act_revise/<string:act>'], type='http', auth="public", website=True)
# def print_report(self):
# partner = request.env.user.partner_id.parent_id.id
# partner_name = request.env.user.partner_id.parent_id.name
# if not partner:
# partner = request.env.user.partner_id.id
# partner_name = request.env.user.partner_id.name
# company = request.env.user.company_id.id
# company_name = request.env.user.company_id.name
# today = date.today()
# d1 = today.strftime("%d.%m.%y")
# # new_url = str('Акт Сверки ' + d1 + ' ' + company_name + '_' + partner_name)
# # new_url=str('AC ' + company +' - ' + partner + ' ' + d1)
# # if request.httprequest.full_path == '/my/act_revise/a?':
# # return werkzeug.utils.redirect('/my/act_revise/%s' % new_url)
# wizard_data = {"target_move": "posted",
# "hide_account_at_0": True,
# "foreign_currency": True,
# #"show_analytic_tags": True,
# "company_id": company,
# "partner_ids": [partner],
# #"show_partner_details": True,
# "show_cost_center": True,
# "centralize": True}
# t = request.env['general.ledger.act_revise.wizard'].sudo().create(wizard_data)
# data = t._prepare_report_general_ledger()
# name = t.get_report_filename()
# report_name = name.encode('cp1251')
# pdf, _ = request.env['ir.actions.report']._render_qweb_pdf(
# 'act_revise.action_print_report_general_ledger_qweb', res_ids=t.id, data=data)
# pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf)), ]
# return request.make_response(pdf, headers=pdfhttpheaders)
@http.route(['/my/act_revise_contact/<string:act>'], type='http', auth="public", website=True)
def print_report_contact(self, date_to, date_from, target_move, company, partner):
partner_id = int(partner) or 'default_partner_value'
company_id = int(company)
wizard_data = {"date_to": date_to,
"date_from": date_from,
"target_move": target_move,
"hide_account_at_0": True,
"foreign_currency": True,
#"show_analytic_tags": True,
"company_id": company_id,
"partner_ids": [partner_id],
#"show_partner_details": True,
"show_cost_center": True,
"centralize": True}
t = request.env['general.ledger.act_revise.wizard'].sudo().create(wizard_data)
data = t._prepare_report_general_ledger()
pdf, _ = request.env['ir.actions.report']._render_qweb_pdf(
'l10n_ru_act_rev.action_print_report_general_ledger_qweb', res_ids=t.id, data=data)
pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf)), ]
return request.make_response(pdf, headers=pdfhttpheaders)

View File

@ -0,0 +1,30 @@
<odoo>
<data>
<!--
<record id="object0" model="act_revise.act_revise">
<field name="name">Object 0</field>
<field name="value">0</field>
</record>
<record id="object1" model="act_revise.act_revise">
<field name="name">Object 1</field>
<field name="value">10</field>
</record>
<record id="object2" model="act_revise.act_revise">
<field name="name">Object 2</field>
<field name="value">20</field>
</record>
<record id="object3" model="act_revise.act_revise">
<field name="name">Object 3</field>
<field name="value">30</field>
</record>
<record id="object4" model="act_revise.act_revise">
<field name="name">Object 4</field>
<field name="value">40</field>
</record>
-->
</data>
</odoo>

View File

@ -0,0 +1,2 @@
from . import account_account
from . import ir_actions_report

View File

@ -0,0 +1,7 @@
from odoo import fields, models, _
class AccountAccount(models.Model):
_inherit = "account.account"
centralized = fields.Boolean(_("Централизованно"))

View File

@ -0,0 +1,10 @@
from odoo import api, models
class IrActionsReport(models.Model):
_inherit = "ir.actions.report"
@api.model
def _prepare_account_financial_report_context(self, data):
lang = data and data.get("account_financial_report_lang") or ""
return dict(self.env.context or {}, lang=lang) if lang else False

View File

@ -0,0 +1,2 @@
from . import general_ledger

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,286 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="l10n_ru_act_rev.general_ledger">
<t t-call="l10n_ru_act_rev.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="l10n_ru_act_rev.internal_layout">
<t t-call="l10n_ru_act_rev.report_general_ledger_base" />
</t>
</t>
</t>
</template>
<template id="l10n_ru_act_rev.report_general_ledger_base">
<t t-set="foreign_currency" t-value="foreign_currency" />
<t t-set="filter_partner_ids" t-value="filter_partner_ids" />
<div class="page">
<style type="text/css">
body { background: #ffffff; margin: 0; font-family: Arial; font-size: 10pt; font-style: normal; text-align: center;}
tbody, table, tr, td, th { border: none;}
tr.R0{ height: 15px; border: border: none; }
tr.R0 td.R0t{text-align: center; font-family: Tahoma; font-size: 14pt; font-weight: bold;}
tr.R0 td.R0j{text-align: justify }
tr.R0 td.R0l{text-align: left}
tr.R0 td.R0lb{font-weight: bold; text-align: left}
tr.R0 td.R0lbt{font-weight: bold; text-align: left; border-top: #000000 1px solid;}
tr.R0 td.R0lbox{text-align: left; border-left: #000000 1px solid; border-top: #000000 1px solid;
border-right: #000000 1px solid; border-bottom: #000000 1px solid; vertical-align: middle;}
tr.R0 td.R0cbox{text-align: center; border-left: #000000 1px solid; border-top: #000000 1px solid;
border-right: #000000 1px solid; border-bottom: #000000 1px solid; vertical-align: middle;}
tr.R0 td.R0lbbox{font-weight: bold; text-align: left; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid; vertical-align: middle;}
tr.R0 td.R0rbox{text-align: right; border-left: #000000 1px solid; border-top: #000000 1px solid;
border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0rbbox{font-weight: bold; text-align: right; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.Rcbox{text-align: center; border-left: #000000 1px solid; border-top: #000000 1px solid;
border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0cbbox{font-weight: bold; text-align: center; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0lboxf{background: #FFFFCC;text-align: left; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0lbboxf{background: #FFFFCC;font-weight: bold; text-align: left; border-left: #000000 1px
solid; border-top: #000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px
solid;}
tr.R0 td.R0rboxf{background: #FFFFCC;text-align: right; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0rbboxf{background: #FFFFCC;font-weight: bold; text-align: right; border-left: #000000 1px
solid; border-top: #000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px
solid;}
tr.R0 td.Rcboxf{background: #FFFFCC;text-align: center; border-left: #000000 1px solid; border-top:
#000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px solid;}
tr.R0 td.R0cbboxf{background: #FFFFCC;font-weight: bold; text-align: center; border-left: #000000 1px
solid; border-top: #000000 1px solid; border-right: #000000 1px solid; border-bottom: #000000 1px
solid; vertical-align: middle;}
tr.R0 td.R0print span img { position: absolute; width: 140px; top: -80px; left: -350px; }
tr.R0 td.R0print { overflow: visible; }
tr.R0 td.R0print span { position: relative; }
tr.R0 td.R0print{ text-align: left; }
tr.R0 td.R0fas { font-family: Arial; font-size: 7pt; font-style: normal; text-align: right; border-bottom: #000000 1px solid; }
tr.R0 td.R0fas { overflow: visible; }
tr.R0 td.R0fas span { position: relative; }
tr.R0 td.R0fas span img { position: absolute; width: 100px; top: -25px; left: 200px;}
</style>
<t t-set="lines" t-value='[]' />
<t t-set="total_debit_init_all" t-value='0.0'/>
<t t-set="total_credit_init_all" t-value='0.0'/>
<t t-foreach="general_ledger" t-as="account">
<t t-if="'list_grouped' in account">
<t t-foreach="account['list_grouped']" t-as="group_item">
<t
t-set="misc_domain"
t-value="[('account_id', '=', account['id']),('date', '&lt;', date_from)]"
/>
<t
t-set="misc_grouped_domain"
t-value="[('partner_id', '=', group_item['id'])]"
t-if="'partners' in account"
/>
<t t-set="misc_grouped_domain" t-value="[]" t-else="" />
<t t-set="debit_domain" t-value="[('debit', '&lt;&gt;', 0)]" />
<span
t-att-domain="misc_domain+debit_domain+misc_grouped_domain"
res-model="account.move.line"
>
<t t-set="total_debit_init" t-value="group_item['init_bal']['debit']" />
<t t-set="total_debit_init_all" t-value='total_debit_init_all+total_debit_init'/>
</span>
<t t-set="credit_domain" t-value="[('credit', '&lt;&gt;', 0)]" />
<span
t-att-domain="misc_domain+credit_domain+misc_grouped_domain"
res-model="account.move.line"
>
<t t-set="total_credit_init" t-value="group_item['init_bal']['credit']" />
<t t-set="total_credit_init_all" t-value='total_credit_init_all+total_credit_init'/>
</span>
<t t-set="lines" t-value='lines+group_item["move_lines"]' />
</t>
</t>
</t>
<t t-set="lines" t-value='o.sorted_lines(lines)'/>
<t t-set="total_debit" t-value='0.0' />
<t t-set="total_credit" t-value='0.0' />
<TABLE CELLSPACING="0">
<COL WIDTH="12%"/>
<COL WIDTH="14%"/>
<COL WIDTH="12%"/>
<COL WIDTH="12%"/>
<COL WIDTH="12%"/>
<COL WIDTH="12%"/>
<COL WIDTH="14%"/>
<COL WIDTH="12%"/>
<tr CLASS="R0">
<td colspan="8" CLASS="R0t">Акт сверки</td>
</tr>
<tr CLASS="R0">
<td colspan="8">взаимных расчетов за период: <t t-esc="o.get_data_format(date_from) or ''"/> - <t t-esc="o.get_data_format(date_to) or ''"/></td>
</tr>
<t t-set="pid" t-value="o.partner_ids[0].parent_id or o.partner_ids[0]"/>
<tr CLASS="R0">
<td colspan="8">между: <t t-esc="company_name"/> и <t t-esc="pid.name"/></td>
</tr>
<tr CLASS="R0">
<td colspan="8"><t t-if="o.get_contract()">по договору №<t t-esc="o.get_contract().name"/> от <t t-esc="o.get_contract().date_start"/></t></td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0j">Мы, нижеподписавшиеся, <t t-esc="company_name"/> с одной стороны, и <t t-esc="pid.name"/>, с другой стороны, составили данный акт сверки в том, что, состояние взаимных расчетов по данным учета следующее:</td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="4" CLASS="R0lbox">По данным <t t-esc="company_name"/>, руб</td>
<td colspan="4" CLASS="R0lbox">По данным <t t-esc="pid.name"/>, руб</td>
</tr>
<tr CLASS="R0">
<td CLASS="R0cbbox">Дата</td>
<td CLASS="R0cbbox">Документ</td>
<td CLASS="R0cbbox">Дебет</td>
<td CLASS="R0cbbox">Кредит</td>
<td CLASS="R0cbbox">Дата</td>
<td CLASS="R0cbbox">Документ</td>
<td CLASS="R0cbbox">Дебет</td>
<td CLASS="R0cbbox">Кредит</td>
</tr>
<tr CLASS="R0">
<t
t-set="misc_domain"
t-value="[('account_id', '=', account['id']),('date', '&lt;', date_from)]"
/>
<t
t-set="misc_grouped_domain"
t-value="[('partner_id', '=', group_item['id'])]"
t-if="'partners' in account"
/>
<t t-set="misc_grouped_domain" t-value="[]" t-else="" />
<td colspan="2" CLASS="R0lbox">Сальдо начальное</td>
<td CLASS="R0cbox"><span t-esc="'%0.2f'%(total_debit_init_all)"/></td>
<td CLASS="R0cbox"><span t-esc="'%0.2f'%(total_credit_init_all)"/></td>
<td colspan="2" CLASS="R0lbox">Сальдо начальное</td>
<td CLASS="R0cbox"></td>
<td CLASS="R0cbox"></td>
</tr>
<tr CLASS="R0" t-foreach="lines" t-as="line">
<t t-set="total_debit" t-value="total_debit+line['debit']" />
<t t-set="total_credit" t-value="total_credit+line['credit']" />
<td CLASS="R0cbox"><t t-esc="o.get_data_format(line['date']) or ''"/></td>
<td CLASS="R0lbox"><t t-raw="line['entry']"/></td>
<td CLASS="R0cbox"><t t-raw="'%0.2f'%(line['debit'])"/></td>
<td CLASS="R0cbox"><t t-raw="'%0.2f'%(line['credit'])"/></td>
<td CLASS="R0cbox"></td>
<td CLASS="R0lbox"></td>
<td CLASS="R0cbox"></td>
<td CLASS="R0cbox"></td>
</tr>
<tr CLASS="R0">
<td colspan="2" CLASS="R0lbbox">Обороты за период</td>
<td CLASS="R0cbbox"><t t-raw="'%0.2f'%(total_debit)"/>
</td>
<td CLASS="R0cbbox"><t t-raw="'%0.2f'%(total_credit)"/>
</td>
<td colspan="2" CLASS="R0lbbox">Обороты за период</td>
<td CLASS="R0cbbox"></td>
<td CLASS="R0cbbox"></td>
</tr>
<tr CLASS="R0">
<td colspan="2" CLASS="R0lbbox">Сальдо конечное</td>
<td CLASS="R0cbbox"><t t-raw="'%0.2f'%(total_debit_init_all+total_debit)"/></td>
<td CLASS="R0cbbox"><t t-raw="'%0.2f'%(total_credit_init_all+total_credit)"/></td>
<td colspan="2" CLASS="R0lbbox">Сальдо конечное</td>
<td CLASS="R0cbbox"></td>
<td CLASS="R0cbbox"></td>
</tr>
<t t-set="total_balance_fin" t-value='(total_debit_init_all+total_debit)-(total_credit_init_all+total_credit)'/>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="4" CLASS="R0l">По данным <t t-esc="company_name"/></td>
<td colspan="4" CLASS="R0l">По данным <t t-esc="pid.name"/></td>
</tr>
<tr CLASS="R0">
<td colspan="4" CLASS="R0lb">на <t t-esc="o.get_data_format(date_to) or ''"/> задолженность в пользу <t t-if="total_balance_fin>=0"><t t-esc="company_name"/></t><t t-else=""><t t-esc="pid.name"/></t> <t t-esc="'%0.2f'%(abs(total_balance_fin))"/> руб. (<t t-esc="o.rubles(abs(total_balance_fin)) or ''"/>)"
</td>
<td colspan="4" CLASS="R0lb">на <t t-esc="o.get_data_format(date_to) or ''"/> задолженность в пользу <t t-if="total_balance_fin>=0"><t t-esc="company_name"/></t><t t-else=""><t t-esc="pid.name"/></t> <t t-esc="'%0.2f'%(abs(total_balance_fin))"/> руб. (<t t-esc="o.rubles(abs(total_balance_fin)) or ''"/>)"
</td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="4" CLASS="R0l">От <t t-esc="company_name"/></td>
<td colspan="4" CLASS="R0l">От <t t-esc="pid.name"/></td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="4" CLASS="R0lb"><t t-esc="o.company_id.chief_id.function or ''"/></td>
<td colspan="4" CLASS="R0lb">Директор</td>
</tr>
<tr CLASS="R0">
<td colspan="8" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="2" CLASS="R0fas"><SPAN><t t-raw="o.company_id.print_facsimile and o.img(o.company_id.chief_id.facsimile) or ''"/></SPAN></td>
<td colspan="2" CLASS="R0lb"><t t-esc="o.initials(o.company_id.chief_id.name) or ''"/></td>
<td colspan="2" CLASS="R0lb"></td>
<td colspan="2" CLASS="R0lb"></td>
</tr>
<tr CLASS="R0">
<td colspan="2" CLASS="R0lbt">М.П.</td>
<td colspan="2" CLASS="R0print"><SPAN><t t-raw="o.company_id.print_stamp and (o.company_id.print_anywhere or context.get('mark_invoice_as_sent', False)) and o.img(o.company_id.stamp) or ''"/></SPAN></td>
<td colspan="2" CLASS="R0lbt">М.П.</td>
<td colspan="2" CLASS="R0lb"></td>
</tr>
</TABLE>
</div>
</template>
<!-- <report-->
<!-- id="action_print_report_general_ledger_qweb"-->
<!-- model="general.ledger.report.wizard"-->
<!-- string="Акт сверки"-->
<!-- report_type="qweb-pdf"-->
<!-- menu="False"-->
<!-- name="act_revise.general_ledger"-->
<!-- file="act_revise.general_ledger"-->
<!-- print_report_name=" 'Акт сверки - %s' %s (object.get_report_filename()) or ''"-->
<!-- />-->
<record id="action_print_report_general_ledger_qweb" model="ir.actions.report">
<field name="name">Акт сверки</field>
<field name="model">general.ledger.act_revise.wizard</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">l10n_ru_act_rev.general_ledger</field>
<field name="report_file">l10n_ru_act_rev.general_ledger</field>
<field name="print_report_name">'Акт сверки - %s' % (object.get_report_filename() or '')</field>
<field name="binding_model_id" ref="model_general_ledger_act_revise_wizard"/>
</record>
<record id="report_qweb_paperformat" model="report.paperformat">
<field name="name">Account financial report qweb paperformat</field>
<field name="default" eval="True" />
<field name="format">custom</field>
<field name="page_height">297</field>
<field name="page_width">210</field>
<field name="orientation">Landscape</field>
<field name="margin_top">12</field>
<field name="margin_bottom">8</field>
<field name="margin_left">5</field>
<field name="margin_right">5</field>
<field name="header_line" eval="False" />
<field name="header_spacing">10</field>
<field name="dpi">110</field>
</record>
<record id="action_print_report_general_ledger_qweb" model="ir.actions.report">
<field name="paperformat_id" ref="report_qweb_paperformat" />
</record>
</odoo>

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="l10n_ru_act_rev.html_container">
<t t-set="body_classname" t-value="'container'" />
<t t-call="web.report_layout">
<t t-out="0" />
</t>
</template>
<template id="l10n_ru_act_rev.internal_layout">
<div class="article o_account_financial_reports_page">
<t t-out="0" />
</div>
<div class="footer">
<div class="row">
<div class="col-6 custom_footer">
<span
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d %H:%M')"
/>
</div>
<div class="col-6 text-right custom_footer">
<ul class="list-inline">
<li class="list-inline-item">
<span class="page" />
</li>
<li class="list-inline-item">/</li>
<li class="list-inline-item">
<span class="topage" />
</li>
</ul>
</div>
</div>
</div>
</template>
</odoo>

View File

@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_general_ledger_act_revise_wizard,general.ledger.act_revise.wizard,model_general_ledger_act_revise_wizard,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_general_ledger_act_revise_wizard general.ledger.act_revise.wizard model_general_ledger_act_revise_wizard base.group_user 1 1 1 1

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="view_account_form" model="ir.ui.view">
<field name="name">account.account.form.inherit</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='active']" position="after">
<field name="centralized" />
</xpath> </field>
</record>
</odoo>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="portal_my_home_act_revise" name="Portal My Home : act revise" inherit_id="portal.portal_my_home" priority="40">
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
<a t-attf-href="/my/act_revise/a">
<button type="button" class="btn btn-primary btn-md o_website_form_send">Печатать акт сверки</button>
</a>
</xpath>
</template>
</odoo>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="report_general_ledger">
<div class="o_act_revise_page">
<t t-call="l10n_ru_act_rev.report_buttons" />
<t t-call="l10n_ru_act_rev.report_general_ledger_base" />
</div>
</template>
</odoo>

View File

@ -0,0 +1,2 @@
from . import abstract_wizard
from . import general_ledger_wizard

View File

@ -0,0 +1,38 @@
from odoo import models, fields
class AbstractWizard(models.AbstractModel):
_name = "act_revise.abstract_wizard"
_description = "Abstract Wizard"
def _get_partner_ids_domain(self):
return [
"&",
"|",
("company_id", "=", self.company_id.id),
("company_id", "=", False),
"|",
("parent_id", "=", False),
("is_company", "=", True),
]
def _default_partners(self):
context = self.env.context
if context.get("active_ids") and context.get("active_model") == "res.partner":
partners = self.env["res.partner"].browse(context["active_ids"])
corp_partners = partners.filtered("parent_id")
partners -= corp_partners
partners |= corp_partners.mapped("commercial_partner_id")
return partners.ids
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.company.id,
required=False,
string="Компания",
)
def button_export_pdf(self):
self.ensure_one()
report_type = "qweb-pdf"
return self._export(report_type)

View File

@ -0,0 +1,897 @@
import logging
import time
from ast import literal_eval
from odoo import _, api, fields, models
from odoo.tools import date_utils,pycompat
from pytils import dt,numeral
from datetime import datetime, date
import re
import urllib
from odoo.exceptions import UserError
class GeneralLedgerReportWizard(models.TransientModel):
"""General ledger report wizard."""
_name = "general.ledger.act_revise.wizard"
_description = "General Ledger Report Wizard"
_inherit = "act_revise.abstract_wizard"
# date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(string="Начало даты", required=True, default=lambda self: self._init_date_from())
date_to = fields.Date(string="Конец даты", required=True, default=fields.Date.context_today)
fy_start_date = fields.Date(compute="_compute_fy_start_date")
target_move = fields.Selection(
[("posted", "Все проведенные проводки"), ("all", "Все проводки")],
string="Цель операции",
required=True,
default="posted",
)
account_ids = fields.Many2many(
comodel_name="account.account", string=_("Filter accounts")
)
centralize = fields.Boolean(string=_("Activate centralization"), default=True)
hide_account_at_0 = fields.Boolean(
string=_("Hide account ending balance at 0"),
help=_("Use this filter to hide an account or a partner "
"with an ending balance at 0. "
"If partners are filtered, "
"debits and credits totals will not match the trial balance."),
)
receivable_accounts_only = fields.Boolean()
payable_accounts_only = fields.Boolean()
partner_ids = fields.Many2many(
comodel_name="res.partner",
string=_("Filter partners"),
default=lambda self: self._default_partners(),
)
account_journal_ids = fields.Many2many(
comodel_name="account.journal", string=_("Filter journals")
)
cost_center_ids = fields.Many2many(
comodel_name="account.analytic.account", string=_("Filter cost centers")
)
not_only_one_unaffected_earnings_account = fields.Boolean(readonly=True)
foreign_currency = fields.Boolean(
string=_("Show foreign currency"),
help=_("Display foreign currency for move lines, unless "
"account currency is not setup through chart of accounts "
"will display initial and final balance in that currency."),
default=lambda self: self._default_foreign_currency(),
)
account_code_from = fields.Many2one(
comodel_name="account.account",
help="Starting account in a range",
)
account_code_to = fields.Many2one(
comodel_name="account.account",
help="Ending account in a range",
)
grouped_by = fields.Selection(
selection=[("", "None"), ("partners", "Partners"), ("taxes", "Taxes")],
default="partners",
)
show_cost_center = fields.Boolean(
string="Show Analytic Account",
default=True,
)
domain = fields.Char(
string="Journal Items Domain",
default=[],
help="This domain will be used to select specific domain for Journal " "Items",
)
# def _print_report(self, report_type):
# self.ensure_one()
# data = self._prepare_report_general_ledger()
# report = self.env["ir.actions.report"].search(
# [("report_name", "=", "act_revise.general_ledger"), ("report_type", "=", report_type)], limit=1, )
# if self.partner_ids[0].parent_id:
# partner = int(self.partner_ids[0].parent_id.id)
# else:
# partner = int(self.partner_ids[0].id)
# return {
# 'type': 'ir.actions.act_url',
# 'url': '/my/act_revise_contact/%s?date_to=%s&date_from=%s&target_move=%s&company=%s&partner=%s' % (
# urllib.parse.quote(self.get_report_filename()), self.date_to, self.date_from, self.target_move,
# self.company_id.id, partner),
# 'target': 'new',
# }
def _get_account_move_lines_domain(self):
domain = literal_eval(self.domain) if self.domain else []
return domain
@api.onchange("account_code_from", "account_code_to")
def on_change_account_range(self):
if (
self.account_code_from
and self.account_code_from.code.isdigit()
and self.account_code_to
and self.account_code_to.code.isdigit()
):
start_range = self.account_code_from.code
end_range = self.account_code_to.code
self.account_ids = self.env["account.account"].search(
[("code", ">=", start_range), ("code", "<=", end_range)]
)
if self.company_id:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_ids == self.company_id
)
def _init_date_from(self):
"""set start date to begin of current year if fiscal year running"""
today = fields.Date.context_today(self)
company = self.company_id or self.env.company
last_fsc_month = company.fiscalyear_last_month
last_fsc_day = company.fiscalyear_last_day
if (
today.month < int(last_fsc_month)
or today.month == int(last_fsc_month)
and today.day <= last_fsc_day
):
return time.strftime("%Y-01-01")
else:
return False
def _default_foreign_currency(self):
return self.env.user.has_group("base.group_multi_currency")
@api.depends("date_from")
def _compute_fy_start_date(self):
for wiz in self:
if wiz.date_from:
date_from, date_to = date_utils.get_fiscal_year(
wiz.date_from,
day=self.company_id.fiscalyear_last_day,
month=int(self.company_id.fiscalyear_last_month),
)
wiz.fy_start_date = date_from
else:
wiz.fy_start_date = False
@api.onchange("company_id")
def onchange_company_id(self):
"""Handle company change."""
count = self.env["account.account"].search_count(
[
("account_type", "=", "equity_unaffected"),
("company_ids", "=", self.company_id.id),
]
)
self.not_only_one_unaffected_earnings_account = count != 1
# if (
# self.company_id
# and self.date_range_id.company_id
# and self.date_range_id.company_id != self.company_id
# ):
# self.date_range_id = False
if self.company_id and self.account_journal_ids:
self.account_journal_ids = self.account_journal_ids.filtered(
lambda p: p.company_id == self.company_id or not p.company_id
)
if self.company_id and self.partner_ids:
self.partner_ids = self.partner_ids.filtered(
lambda p: p.company_id == self.company_id or not p.company_id
)
if self.company_id and self.account_ids:
if self.receivable_accounts_only or self.payable_accounts_only:
self.onchange_type_accounts_only()
else:
self.account_ids = self.account_ids.filtered(
lambda a: a.company_ids == self.company_id
)
if self.company_id and self.cost_center_ids:
self.cost_center_ids = self.cost_center_ids.filtered(
lambda c: c.company_id == self.company_id
)
res = {
"domain": {
"account_ids": [],
"partner_ids": [],
"account_journal_ids": [],
"cost_center_ids": [],
# "date_range_id": [],
}
}
if not self.company_id:
return res
else:
res["domain"]["account_ids"] += [("company_ids", "=", self.company_id.id)]
res["domain"]["account_journal_ids"] += [
("company_ids", "=", self.company_id.id)
]
res["domain"]["partner_ids"] += self._get_partner_ids_domain()
res["domain"]["cost_center_ids"] += [
("company_id", "=", self.company_id.id)
]
# res["domain"]["date_range_id"] += [
# "|",
# ("company_id", "=", self.company_id.id),
# ("company_id", "=", False),
# ]
return res
# @api.onchange("date_range_id")
# def onchange_date_range_id(self):
# """Handle date range change."""
# if self.date_range_id:
# self.date_from = self.date_range_id.date_start
# self.date_to = self.date_range_id.date_end
# @api.constrains("company_id", "date_range_id")
# def _check_company_id_date_range_id(self):
# for rec in self.sudo():
# if (
# rec.company_id
# and rec.date_range_id.company_id
# and rec.company_id != rec.date_range_id.company_id
# ):
# raise ValidationError(
# _(
# "The Company in the General Ledger Report Wizard and in "
# "Date Range must be the same."
# )
# )
@api.onchange("receivable_accounts_only", "payable_accounts_only")
def onchange_type_accounts_only(self):
"""Handle receivable/payable accounts only change."""
if self.receivable_accounts_only or self.payable_accounts_only:
domain = [("company_ids", "=", self.company_id.id)]
if self.receivable_accounts_only and self.payable_accounts_only:
domain += [
("account_type", "in", ("asset_receivable", "liability_payable"))
]
elif self.receivable_accounts_only:
domain += [("account_type", "=", "asset_receivable")]
elif self.payable_accounts_only:
domain += [("account_type", "=", "liability_payable")]
self.account_ids = self.env["account.account"].search(domain)
else:
self.account_ids = None
@api.onchange("partner_ids")
def onchange_partner_ids(self):
"""Handle partners change."""
if self.partner_ids:
self.receivable_accounts_only = self.payable_accounts_only = True
else:
self.receivable_accounts_only = self.payable_accounts_only = False
@api.depends("company_id")
def _compute_unaffected_earnings_account(self):
for record in self:
record.unaffected_earnings_account = self.env["account.account"].search(
[
("account_type", "=", "equity_unaffected"),
("company_ids", "=", record.company_id.id),
]
)
unaffected_earnings_account = fields.Many2one(
comodel_name="account.account",
compute="_compute_unaffected_earnings_account",
store=True,
)
# def _print_report(self, report_type):
# self.ensure_one()
# data = self._prepare_report_general_ledger()
# report_name = "act_revise.general_ledger"
# return (
# self.env["ir.actions.report"]
# .search(
# [("report_name", "=", report_name), ("report_type", "=", report_type)],
# limit=1,
# )
# .report_action(self, data=data)
# )
def _print_report(self, report_type):
self.ensure_one()
data = self._prepare_report_general_ledger()
report = self.env["ir.actions.report"].search(
[("report_name", "=", "l10n_ru_act_rev.general_ledger"), ("report_type", "=", report_type)], limit=1, )
if self.partner_ids[0].parent_id:
partner = int(self.partner_ids[0].parent_id.id)
else:
partner = int(self.partner_ids[0].id)
account_data = self.env['account.move.line'].sudo().search([
('partner_id', '=', partner),
('account_id.account_type', 'in', ('liability_payable', 'asset_receivable')),
('account_id.non_trade', '=', False),
('date', '<=', self.date_to),
('date', '>=', self.date_from)
])
if self.target_move == 'posted' and not account_data.filtered(lambda p: p.parent_state == 'posted') or not account_data:
raise UserError(f'Проводок для формирования акта по введенным условиям не найдено.')
return {
'type': 'ir.actions.act_url',
'url': '/my/act_revise_contact/%s?date_to=%s&date_from=%s&target_move=%s&company=%s&partner=%s' % (
urllib.parse.quote(self.get_report_filename()), self.date_to, self.date_from, self.target_move,
self.company_id.id, partner),
'target': 'new',
}
def _prepare_report_general_ledger(self):
self.ensure_one()
return {
"wizard_id": self.id,
"date_from": self.date_from,
"date_to": self.date_to,
"only_posted_moves": self.target_move == "posted",
"hide_account_at_0": self.hide_account_at_0,
"foreign_currency": self.foreign_currency,
"company_id": self.company_id.id,
"account_ids": self.account_ids.ids,
"partner_ids": self.partner_ids.ids,
"grouped_by": self.grouped_by,
"cost_center_ids": self.cost_center_ids.ids,
"show_cost_center": self.show_cost_center,
"journal_ids": self.account_journal_ids.ids,
"centralize": self.centralize,
"fy_start_date": self.fy_start_date,
"unaffected_earnings_account": self.unaffected_earnings_account.id,
"account_financial_report_lang": self.env.lang,
"domain": self._get_account_move_lines_domain(),
}
def _export(self, report_type):
"""Default export is PDF."""
return self._print_report(report_type)
def _get_atr_from_dict(self, obj_id, data, key):
try:
return data[obj_id][key]
except KeyError:
return data[str(obj_id)][key]
def numer(self, name):
if name:
numeration = re.findall('\d+$', name)
if numeration: return numeration[0]
return name
def get_data_format(self, date):
if date and date != 'False':
return dt.ru_strftime(u'%d.%m.%Y г.', date=datetime.strptime(str(date), "%Y-%m-%d"), inflected=True)
return ''
def initials(self, fio):
if fio:
return (fio.split()[0] + ' ' + ''.join([fio[0:1] + '.' for fio in fio.split()[1:]])).strip()
return ''
def rubles(self, sum):
"Transform sum number in rubles to text"
text_rubles = numeral.rubles(int(sum))
copeck = round((sum - int(sum)) * 100)
text_copeck = numeral.choose_plural(int(copeck), (u"копейка", u"копейки", u"копеек"))
return ("%s %02d %s") % (text_rubles, copeck, text_copeck)
def img(self, img, type='png', width=0, height=0):
if width:
width = "width='%spx'" % (width)
else:
width = " "
if height:
height = "height='%spx'" % (height)
else:
height = " "
toreturn = "<img %s %s src='data:image/%s;base64,%s' />" % (
width,
height,
type,
str(pycompat.to_text(img)))
return toreturn
def get_contract(self):
partner = int(self.partner_ids[0].id)
contract = self.env['partner.contract.customer'].search(
[('partner_id', '=', partner), ('state', '=', 'signed')], limit=1)
if contract:
return contract
def get_function_partner(self, partner):
director = self.env['res.partner'].search([('parent_id', '=', partner), ('type', '=', 'director')], limit=1)
if director:
if director.function:
return director.function or 'отсутствует'
def get_name_partner(self, partner):
director = self.env['res.partner'].search([('parent_id', '=', partner), ('type', '=', 'director')], limit=1)
if director:
return director.name or 'отсутствует'
def get_report_filename(self):
today = date.today()
d1 = today.strftime("%d-%m-%Y")
if self.partner_ids[0].parent_id:
p = ''.join(self.partner_ids[0].parent_id.name)
else:
p = ''.join(self.partner_ids[0].name)
# return 'Акт Сверки '+ d1 + ' ' + self.company_id.name+'_'+p
return str(self.company_id.id) + ' - ' + ' ' + d1
def sorted_lines(self, list):
list = sorted(list, key=lambda k: k.get('date'), reverse=False)
return list
#
# import time
# from ast import literal_eval
# from odoo import _, api, fields, models
# from odoo.tools import date_utils,pycompat
# from pytils import dt,numeral
# from datetime import datetime, date
# import re
# import urllib
#
# class GeneralLedgerReportWizard(models.TransientModel):
# """General ledger report wizard."""
#
# _name = "general.ledger.act_revise.wizard"
# _description = "General Ledger Report Wizard"
# _inherit = "act_revise.abstract_wizard"
#
# # date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
# date_from = fields.Date(string="Начало даты", required=True, default=lambda self: self._init_date_from())
# date_to = fields.Date(string="Конец даты", required=True, default=fields.Date.context_today)
# fy_start_date = fields.Date(compute="_compute_fy_start_date")
# target_move = fields.Selection(
# [("posted", "Все проведенные проводки"), ("all", "Все проводки")],
# string="Цель операции",
# required=True,
# default="posted",
# )
# account_ids = fields.Many2many(
# comodel_name="account.account", string=_("Filter accounts")
# )
# centralize = fields.Boolean(string=_("Activate centralization"), default=True)
# hide_account_at_0 = fields.Boolean(
# string=_("Hide account ending balance at 0"),
# help=_("Use this filter to hide an account or a partner "
# "with an ending balance at 0. "
# "If partners are filtered, "
# "debits and credits totals will not match the trial balance."),
# )
# receivable_accounts_only = fields.Boolean()
# payable_accounts_only = fields.Boolean()
# partner_ids = fields.Many2many(
# comodel_name="res.partner",
# string=_("Filter partners"),
# default=lambda self: self._default_partners(),
# )
# account_journal_ids = fields.Many2many(
# comodel_name="account.journal", string=_("Filter journals")
# )
# cost_center_ids = fields.Many2many(
# comodel_name="account.analytic.account", string=_("Filter cost centers")
# )
#
# not_only_one_unaffected_earnings_account = fields.Boolean(readonly=True)
# foreign_currency = fields.Boolean(
# string=_("Show foreign currency"),
# help=_("Display foreign currency for move lines, unless "
# "account currency is not setup through chart of accounts "
# "will display initial and final balance in that currency."),
# default=lambda self: self._default_foreign_currency(),
# )
# account_code_from = fields.Many2one(
# comodel_name="account.account",
# help="Starting account in a range",
# )
# account_code_to = fields.Many2one(
# comodel_name="account.account",
# help="Ending account in a range",
# )
# grouped_by = fields.Selection(
# selection=[("", "None"), ("partners", "Partners"), ("taxes", "Taxes")],
# default="partners",
# )
# show_cost_center = fields.Boolean(
# string="Show Analytic Account",
# default=True,
# )
# domain = fields.Char(
# string="Journal Items Domain",
# default=[],
# help="This domain will be used to select specific domain for Journal " "Items",
# )
#
# # def _print_report(self, report_type):
# # self.ensure_one()
# # data = self._prepare_report_general_ledger()
# # report = self.env["ir.actions.report"].search(
# # [("report_name", "=", "act_revise.general_ledger"), ("report_type", "=", report_type)], limit=1, )
# # if self.partner_ids[0].parent_id:
# # partner = int(self.partner_ids[0].parent_id.id)
# # else:
# # partner = int(self.partner_ids[0].id)
# # return {
# # 'type': 'ir.actions.act_url',
# # 'url': '/my/act_revise_contact/%s?date_to=%s&date_from=%s&target_move=%s&company=%s&partner=%s' % (
# # urllib.parse.quote(self.get_report_filename()), self.date_to, self.date_from, self.target_move,
# # self.company_id.id, partner),
# # 'target': 'new',
# # }
#
# def _get_account_move_lines_domain(self):
# domain = literal_eval(self.domain) if self.domain else []
# return domain
#
# @api.onchange("account_code_from", "account_code_to")
# def on_change_account_range(self):
# if (
# self.account_code_from
# and self.account_code_from.code.isdigit()
# and self.account_code_to
# and self.account_code_to.code.isdigit()
# ):
# start_range = self.account_code_from.code
# end_range = self.account_code_to.code
# self.account_ids = self.env["account.account"].search(
# [("code", ">=", start_range), ("code", "<=", end_range)]
# )
# if self.company_id:
# self.account_ids = self.account_ids.filtered(
# lambda a: a.company_id == self.company_id
# )
#
# def _init_date_from(self):
# """set start date to begin of current year if fiscal year running"""
# today = fields.Date.context_today(self)
# company = self.company_id or self.env.company
# last_fsc_month = company.fiscalyear_last_month
# last_fsc_day = company.fiscalyear_last_day
#
# if (
# today.month < int(last_fsc_month)
# or today.month == int(last_fsc_month)
# and today.day <= last_fsc_day
# ):
# return time.strftime("%Y-01-01")
# else:
# return False
#
# def _default_foreign_currency(self):
# return self.env.user.has_group("base.group_multi_currency")
#
# @api.depends("date_from")
# def _compute_fy_start_date(self):
# for wiz in self:
# if wiz.date_from:
# date_from, date_to = date_utils.get_fiscal_year(
# wiz.date_from,
# day=self.company_id.fiscalyear_last_day,
# month=int(self.company_id.fiscalyear_last_month),
# )
# wiz.fy_start_date = date_from
# else:
# wiz.fy_start_date = False
#
# @api.onchange("company_id")
# def onchange_company_id(self):
# """Handle company change."""
# count = self.env["account.account"].search_count(
# [
# ("account_type", "=", "equity_unaffected"),
# ("company_id", "=", self.company_id.id),
# ]
# )
# self.not_only_one_unaffected_earnings_account = count != 1
# # if (
# # self.company_id
# # and self.date_range_id.company_id
# # and self.date_range_id.company_id != self.company_id
# # ):
# # self.date_range_id = False
# if self.company_id and self.account_journal_ids:
# self.account_journal_ids = self.account_journal_ids.filtered(
# lambda p: p.company_id == self.company_id or not p.company_id
# )
# if self.company_id and self.partner_ids:
# self.partner_ids = self.partner_ids.filtered(
# lambda p: p.company_id == self.company_id or not p.company_id
# )
# if self.company_id and self.account_ids:
# if self.receivable_accounts_only or self.payable_accounts_only:
# self.onchange_type_accounts_only()
# else:
# self.account_ids = self.account_ids.filtered(
# lambda a: a.company_id == self.company_id
# )
# if self.company_id and self.cost_center_ids:
# self.cost_center_ids = self.cost_center_ids.filtered(
# lambda c: c.company_id == self.company_id
# )
# res = {
# "domain": {
# "account_ids": [],
# "partner_ids": [],
# "account_journal_ids": [],
# "cost_center_ids": [],
# # "date_range_id": [],
# }
# }
# if not self.company_id:
# return res
# else:
# res["domain"]["account_ids"] += [("company_id", "=", self.company_id.id)]
# res["domain"]["account_journal_ids"] += [
# ("company_id", "=", self.company_id.id)
# ]
# res["domain"]["partner_ids"] += self._get_partner_ids_domain()
# res["domain"]["cost_center_ids"] += [
# ("company_id", "=", self.company_id.id)
# ]
# # res["domain"]["date_range_id"] += [
# # "|",
# # ("company_id", "=", self.company_id.id),
# # ("company_id", "=", False),
# # ]
# return res
#
# # @api.onchange("date_range_id")
# # def onchange_date_range_id(self):
# # """Handle date range change."""
# # if self.date_range_id:
# # self.date_from = self.date_range_id.date_start
# # self.date_to = self.date_range_id.date_end
#
# # @api.constrains("company_id", "date_range_id")
# # def _check_company_id_date_range_id(self):
# # for rec in self.sudo():
# # if (
# # rec.company_id
# # and rec.date_range_id.company_id
# # and rec.company_id != rec.date_range_id.company_id
# # ):
# # raise ValidationError(
# # _(
# # "The Company in the General Ledger Report Wizard and in "
# # "Date Range must be the same."
# # )
# # )
#
# @api.onchange("receivable_accounts_only", "payable_accounts_only")
# def onchange_type_accounts_only(self):
# """Handle receivable/payable accounts only change."""
# if self.receivable_accounts_only or self.payable_accounts_only:
# domain = [("company_id", "=", self.company_id.id)]
# if self.receivable_accounts_only and self.payable_accounts_only:
# domain += [
# ("account_type", "in", ("asset_receivable", "liability_payable"))
# ]
# elif self.receivable_accounts_only:
# domain += [("account_type", "=", "asset_receivable")]
# elif self.payable_accounts_only:
# domain += [("account_type", "=", "liability_payable")]
# self.account_ids = self.env["account.account"].search(domain)
# else:
# self.account_ids = None
#
# @api.onchange("partner_ids")
# def onchange_partner_ids(self):
# """Handle partners change."""
# if self.partner_ids:
# self.receivable_accounts_only = self.payable_accounts_only = True
# else:
# self.receivable_accounts_only = self.payable_accounts_only = False
#
# @api.depends("company_id")
# def _compute_unaffected_earnings_account(self):
# for record in self:
# record.unaffected_earnings_account = self.env["account.account"].search(
# [
# ("account_type", "=", "equity_unaffected"),
# ("company_id", "=", record.company_id.id),
# ]
# )
#
# unaffected_earnings_account = fields.Many2one(
# comodel_name="account.account",
# compute="_compute_unaffected_earnings_account",
# store=True,
# )
#
# # def _print_report(self, report_type):
# # self.ensure_one()
# # data = self._prepare_report_general_ledger()
# # report_name = "act_revise.general_ledger"
# # return (
# # self.env["ir.actions.report"]
# # .search(
# # [("report_name", "=", report_name), ("report_type", "=", report_type)],
# # limit=1,
# # )
# # .report_action(self, data=data)
# # )
# def _print_report(self, report_type):
# self.ensure_one()
# data = self._prepare_report_general_ledger()
# report = self.env["ir.actions.report"].search(
# [("report_name", "=", "act_revise.general_ledger"), ("report_type", "=", report_type)], limit=1, )
# # report.report_name='Test'
# # report.headers.add('Content-Disposition', 'attachment; filename="Test.pdf";')
# # pdf, _ = request.env.ref('act_revise.action_print_report_general_ledger_qweb').sudo().render_qweb_pdf(self,data=data)
# # pdfhttpheaders = [('Content-Type', 'application/pdf'), ('Content-Length', len(pdf)),('Content-Disposition', 'attachment; filename="%s";' % report_name),]
# # return request.make_response(pdf, headers=pdfhttpheaders)
# # return (
# # self.env["ir.actions.report"]
# # .search(
# # [("report_name", "=", "act_revise.general_ledger"), ("report_type", "=", report_type)],
# # limit=1,
# # )
# # report.report_action(self, data=data)
# # )
# # name='Test'
# if self.partner_ids[0].parent_id:
# partner = int(self.partner_ids[0].parent_id.id)
# else:
# partner = int(self.partner_ids[0].id)
# account_data = self.env['account.move.line'].sudo().search([
# ('partner_id', '=', partner.id),
# ('account_id.account_type', 'in', ('liability_payable', 'asset_receivable')),
# ('account_id.non_trade', '=', False),
# ('date', '<=', self.date_to),
# ('date', '>=', self.date_from)
# ])
# if not account_data:
# raise UserError(f'Проводок для формирования акта по введенным условиям не найдено.')
# return {
# 'type': 'ir.actions.act_url',
# 'url': '/my/act_revise_contact/%s?date_to=%s&date_from=%s&target_move=%s&company=%s&partner=%s' % (
# urllib.parse.quote(self.get_report_filename()), self.date_to, self.date_from, self.target_move,
# self.company_id.id, partner),
# 'target': 'new',
# }
#
# def _prepare_report_general_ledger(self):
# self.ensure_one()
# return {
# "wizard_id": self.id,
# "date_from": self.date_from,
# "date_to": self.date_to,
# "only_posted_moves": self.target_move == "posted",
# "hide_account_at_0": self.hide_account_at_0,
# "foreign_currency": self.foreign_currency,
# "company_id": self.company_id.id,
# "account_ids": self.account_ids.ids,
# "partner_ids": self.partner_ids.ids,
# "grouped_by": self.grouped_by,
# "cost_center_ids": self.cost_center_ids.ids,
# "show_cost_center": self.show_cost_center,
# "journal_ids": self.account_journal_ids.ids,
# "centralize": self.centralize,
# "fy_start_date": self.fy_start_date,
# "unaffected_earnings_account": self.unaffected_earnings_account.id,
# "account_financial_report_lang": self.env.lang,
# "domain": self._get_account_move_lines_domain(),
# }
#
# def _export(self, report_type):
# """Default export is PDF."""
# return self._print_report(report_type)
#
# def _get_atr_from_dict(self, obj_id, data, key):
# try:
# return data[obj_id][key]
# except KeyError:
# return data[str(obj_id)][key]
#
# def numer(self, name):
# if name:
# numeration = re.findall('\d+$', name)
# if numeration: return numeration[0]
# return name
#
# def get_data_format(self, date):
# if date and date != 'False':
# return dt.ru_strftime(u'%d.%m.%Y Рі.', date=datetime.strptime(str(date), "%Y-%m-%d"), inflected=True)
# return ''
#
# def initials(self, fio):
# if fio:
# return (fio.split()[0] + ' ' + ''.join([fio[0:1] + '.' for fio in fio.split()[1:]])).strip()
# return ''
#
# def rubles(self, sum):
# "Transform sum number in rubles to text"
# text_rubles = numeral.rubles(int(sum))
# copeck = round((sum - int(sum)) * 100)
# text_copeck = numeral.choose_plural(int(copeck), (u"копейка", u"копейки", u"копеек"))
# return ("%s %02d %s") % (text_rubles, copeck, text_copeck)
#
# def img(self, img, type='png', width=0, height=0):
# if width:
# width = "width='%spx'" % (width)
# else:
# width = " "
# if height:
# height = "height='%spx'" % (height)
# else:
# height = " "
# toreturn = "<img %s %s src='data:image/%s;base64,%s' />" % (
# width,
# height,
# type,
# str(pycompat.to_text(img)))
# return toreturn
#
# def get_contract(self):
# partner = int(self.partner_ids[0].id)
# contract = self.env['partner.contract.customer'].search(
# [('partner_id', '=', partner), ('state', '=', 'signed')], limit=1)
# if contract:
# return contract
#
# def get_function_partner(self, partner):
# director = self.env['res.partner'].search([('parent_id', '=', partner), ('type', '=', 'director')], limit=1)
# if director:
# if director.function:
# return director.function or 'отсутствует'
#
# def get_name_partner(self, partner):
# director = self.env['res.partner'].search([('parent_id', '=', partner), ('type', '=', 'director')], limit=1)
# if director:
# return director.name or 'отсутствует'
#
# def get_report_filename(self):
# today = date.today()
# d1 = today.strftime("%d-%m-%Y")
# if self.partner_ids[0].parent_id:
# p = ''.join(self.partner_ids[0].parent_id.name)
# else:
# p = ''.join(self.partner_ids[0].name)
# # return 'Акт Сверки '+ d1 + ' ' + self.company_id.name+'_'+p
# return str(self.company_id.id) + ' - ' + ' ' + d1
#
# def sorted_lines(self, list):
# list = sorted(list, key=lambda k: k.get('date'), reverse=False)
# return list

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- GENERAL LEDGER -->
<record id="general_ledger_wizard" model="ir.ui.view">
<field name="name">Акт сверки</field>
<field name="model">general.ledger.act_revise.wizard</field>
<field name="arch" type="xml">
<form>
<group name="main_info">
<field
name="company_id"
options="{'no_create': True}"
groups="base.group_multi_company"
/>
</group>
<div invisible= "not_only_one_unaffected_earnings_account==True" >
<group name="filters">
<group name="date_range">
<!-- <field name="date_range_id" />-->
<field name="date_from" />
<field name="date_to" />
<field name="fy_start_date" invisible="1" />
<field name="target_move" widget="radio" />
</group>
<group name="other_filters" invisible="1">
<field name="grouped_by" />
<field name="centralize" />
<field name="hide_account_at_0" />
<field name="foreign_currency" />
<field name="show_cost_center" />
</group>
</group>
<notebook invisible="1">
<page string="Filter accounts">
<group name="account_filter" col="4">
<label for="account_ids" colspan="4" />
<field name="receivable_accounts_only" />
<field name="payable_accounts_only" />
<label for="account_code_from" string="From Code" />
<div>
<div class="o_row">
<field
name="account_code_from"
class="oe_inline"
options="{'no_create': True}"
/>
<span class="oe_inline">To</span>
<field
name="account_code_to"
class="oe_inline"
options="{'no_create': True}"
/>
</div>
</div>
<field
name="account_ids"
nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"
colspan="4"
/>
</group>
</page>
<page string="Filter partners">
<field
name="partner_ids"
nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"
/>
</page>
<page
string="Filter analytic accounts"
groups="analytic.group_analytic_accounting"
>
<field
name="cost_center_ids"
nolabel="1"
widget="many2many_tags"
options="{'no_create': True}"
/>
</page>
<page string="Additional Filtering">
<style>
.o_domain_show_selection_button {display: none}
</style>
<field
name="domain"
widget="domain"
options="{'model': 'account.move.line', 'in_dialog': True}"
context="{'skip_search_count': 1}"
/>
</page>
</notebook>
</div>
<div invisible= "not_only_one_unaffected_earnings_account==False" >
<field
name="not_only_one_unaffected_earnings_account"
invisible="1"
/>
<group />
<h4>
General Ledger can be computed only if selected company have
only one unaffected earnings account.
</h4>
<group />
</div>
<footer>
<div invisible= "not_only_one_unaffected_earnings_account==True">
<button
name="button_export_pdf"
string="Печать"
type="object"
/>
<button string="Отмена" class="oe_link" special="cancel" />
</div>
<div invisible= "not_only_one_unaffected_earnings_account==False" >
<button string="Отмена" class="oe_link" special="cancel" />
</div>
</footer>
</form>
</field>
</record>
<!-- <act_window-->
<!-- id="action_general_ledger_wizard"-->
<!-- name="Акт сверки"-->
<!-- res_model="general.ledger.act_revise.wizard"-->
<!-- view_mode="form"-->
<!-- view_id="general_ledger_wizard"-->
<!-- target="new"-->
<!-- />-->
<!-- &lt;!&ndash;Add to res.partner action&ndash;&gt;-->
<!-- <act_window-->
<!-- id="act_action_general_ledger_wizard_partner_relation"-->
<!-- name="Печатать акт сверки"-->
<!-- res_model="general.ledger.act_revise.wizard"-->
<!-- binding_model="res.partner"-->
<!-- view_mode="form"-->
<!-- context="{-->
<!-- 'default_receivable_accounts_only':1,-->
<!-- 'default_payable_accounts_only':1,-->
<!-- }"-->
<!-- groups="account.group_account_manager"-->
<!-- target="new"-->
<!-- />-->
<record id="action_general_ledger_wizard" model="ir.actions.act_window">
<field name="name">Акт сверки</field>
<field name="res_model">general.ledger.act_revise.wizard</field>
<field name="view_mode">form</field>
<field name="view_id" ref="general_ledger_wizard"/>
<field name="target">new</field>
</record>
<record id="act_action_general_ledger_wizard_partner_relation" model="ir.actions.act_window">
<field name="name">Печатать акт сверки</field>
<field name="res_model">general.ledger.act_revise.wizard</field>
<field name="binding_model_id" ref="base.model_res_partner"/>
<field name="view_mode">form</field>
<field name="context">{'default_receivable_accounts_only': 1, 'default_payable_accounts_only': 1}</field>
<field name="group_ids" eval="[(6, 0, [ref('account.group_account_manager')])]"/>
<field name="target">new</field>
</record>
</odoo>