[FIX] account,account_accountant: fix the demo tour
This commit fixes the account_accountant demo tour. Some attributes in the html have changed and the reconciliation widget was refactored. Fix the broken account_tour_upload_bill view. Fix the test of account_accountant_tour (missing import in __init__) closes odoo/odoo#104110 X-original-commit: 8414a5a77be5fbcc6f66ba2acf160f43748c891e Related: odoo/enterprise#33210 Signed-off-by: William André (wan) <wan@odoo.com> Signed-off-by: Julien Van Roy <juvr@odoo.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models, _, Command
|
||||
from odoo import fields, models, _, Command, tools
|
||||
import base64
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -77,16 +77,7 @@ class AccountTourUploadBill(models.TransientModel):
|
||||
if self.selection == 'upload':
|
||||
return purchase_journal.with_context(default_journal_id=purchase_journal.id, default_move_type='in_invoice').create_document_from_attachment(attachment_ids=self.attachment_ids.ids)
|
||||
elif self.selection == 'sample':
|
||||
bodies = self.env['ir.actions.report']._prepare_html(self.preview_invoice)[0]
|
||||
sample_pdf = self.env['ir.actions.report']._run_wkhtmltopdf(bodies)
|
||||
|
||||
invoice_date = fields.Date.today() - timedelta(days=12)
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'type': 'binary',
|
||||
'name': 'INV-%s-0001.pdf' % invoice_date.strftime('%Y-%m'),
|
||||
'res_model': 'mail.compose.message',
|
||||
'datas': base64.encodebytes(sample_pdf),
|
||||
})
|
||||
partner = self.env['res.partner'].search([('name', '=', 'Deco Addict')], limit=1)
|
||||
if not partner:
|
||||
partner = self.env['res.partner'].create({
|
||||
@@ -113,7 +104,19 @@ class AccountTourUploadBill(models.TransientModel):
|
||||
})
|
||||
],
|
||||
})
|
||||
bill.with_context(no_new_invoice=True).message_post(attachment_ids=[attachment.id])
|
||||
# In case of test environment, don't create the pdf
|
||||
if tools.config['test_enable'] or tools.config['test_file']:
|
||||
bill.with_context(no_new_invoice=True).message_post()
|
||||
else:
|
||||
bodies = self.env['ir.actions.report']._prepare_html(self.preview_invoice)[0]
|
||||
content = self.env['ir.actions.report']._run_wkhtmltopdf(bodies)
|
||||
attachment = self.env['ir.attachment'].create({
|
||||
'type': 'binary',
|
||||
'name': 'INV-%s-0001.pdf' % invoice_date.strftime('%Y-%m'),
|
||||
'res_model': 'mail.compose.message',
|
||||
'datas': base64.encodebytes(content),
|
||||
})
|
||||
bill.with_context(no_new_invoice=True).message_post(attachment_ids=[attachment.id])
|
||||
|
||||
return self._action_list_view_bill(bill.ids)
|
||||
else:
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
<sheet>
|
||||
<h2>With Odoo, you won't have to record bills manually</h2>
|
||||
<p>We process bills automatically so that you only have to validate them. Choose how you want to test our artificial intelligence engine:</p>
|
||||
<group class="col-md-12" >
|
||||
<group class="col-md-4">
|
||||
<field name="selection" widget="radio" nolabel="1"/>
|
||||
<group col="6">
|
||||
<group colspan="2">
|
||||
<field name="selection" widget="radio" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<group class="col-md-8" style="width:100%;" attrs="{'invisible': [('selection', '!=', 'sample')]}">
|
||||
<field name="preview_invoice" widget="html" nolabel = "1"/>
|
||||
<group colspan="4" attrs="{'invisible': [('selection', '!=', 'sample')]}">
|
||||
<field name="preview_invoice" widget="html" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<group class="col-md-8" style="width:100%;" attrs="{'invisible': [('selection', '!=', 'upload')]}">
|
||||
<group colspan="4" attrs="{'invisible': [('selection', '!=', 'upload')]}">
|
||||
<field name="attachment_ids" widget="many2many_binary" string="Attach a file" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
Reference in New Issue
Block a user