mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Automatic block period account
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
'data': [
|
||||
'wizard/cash_daily_report.xml',
|
||||
'data/menus.xml',
|
||||
'data/cron_jobs.xml',
|
||||
],
|
||||
'qweb': [],
|
||||
'test': [
|
||||
|
||||
23
cash_daily_report/data/cron_jobs.xml
Normal file
23
cash_daily_report/data/cron_jobs.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<data noupdate="0">
|
||||
|
||||
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
|
||||
<record model="ir.cron" id="period_lock_date">
|
||||
<field name="name">Automatic Period Lock Date</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="interval_type">days</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False" />
|
||||
<field name="state">code</field>
|
||||
<field name="model_id" ref="model_cash_daily_report_wizard" />
|
||||
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 05:00:00')"/>
|
||||
<field name="code">model.automatic_period_lock_date()</field>
|
||||
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
</odoo>
|
||||
@@ -32,6 +32,18 @@ class CashDailyReportWizard(models.TransientModel):
|
||||
FILENAME = 'cash_daily_report.xls'
|
||||
_name = 'cash.daily.report.wizard'
|
||||
|
||||
@api.model
|
||||
def automatic_period_lock_date(self):
|
||||
# The secong month day close the mont previous
|
||||
days = 2
|
||||
closeday = datetime.today().replace(day=days)
|
||||
if datetime.date.today() == closeday:
|
||||
company = self.env['res.company'].search([])
|
||||
lastday = datetime.date.today() - datetime.timedelta(days)
|
||||
company.write({
|
||||
'period_lock_date': lastday
|
||||
})
|
||||
|
||||
@api.model
|
||||
@api.model
|
||||
def _get_default_date_start(self):
|
||||
@@ -145,7 +157,7 @@ class CashDailyReportWizard(models.TransientModel):
|
||||
else:
|
||||
total_dates[v_payment.payment_date][v_payment.journal_id.name] += amount
|
||||
|
||||
worksheet.write(k_payment+offset, 0, v_payment.name)
|
||||
worksheet.write(k_payment+offset, 0, v_payment.create_uid.login)
|
||||
worksheet.write(k_payment+offset, 1, v_payment.communication)
|
||||
worksheet.write(k_payment+offset, 2, where)
|
||||
worksheet.write(k_payment+offset, 3, v_payment.payment_date,
|
||||
@@ -178,7 +190,7 @@ class CashDailyReportWizard(models.TransientModel):
|
||||
else:
|
||||
total_dates[v_payment.date][v_payment.journal_id.name] += -v_line.amount
|
||||
|
||||
worksheet.write(k_line+offset, 0, v_payment.name)
|
||||
worksheet.write(k_line+offset, 0, v_payment.create_uid.login)
|
||||
worksheet.write(k_line+offset, 1, v_line.reference)
|
||||
worksheet.write(k_line+offset, 2, v_line.partner_id.name)
|
||||
worksheet.write(k_line+offset, 3, v_payment.date,
|
||||
@@ -194,7 +206,6 @@ class CashDailyReportWizard(models.TransientModel):
|
||||
if k_line:
|
||||
line = k_line + offset
|
||||
|
||||
|
||||
result_journals = {}
|
||||
# NORMAL PAYMENTS
|
||||
if total_account_payment != 0:
|
||||
|
||||
Reference in New Issue
Block a user