Allow to only use completion or import

This commit is contained in:
Matthieu Dietrich
2016-04-28 10:29:05 +02:00
parent a1a6447297
commit 1ac711e6ef
5 changed files with 37 additions and 18 deletions

View File

@@ -18,8 +18,8 @@ The main change is that, in order to import financial data, this information
is now imported directly as a Journal Entry.
Most of the information present in the "statement profile" is now located in
the account journal (with an added boolean parameter which allows to use
this journal for importation).
the account journal (with 2 boolean parameters which allows to use
this journal for importation and/or auto-completion).
Financial data can be imported using a standard .csv or .xls file (you'll find
it in the 'data' folder). It respects the journal to pass the entries.
@@ -60,8 +60,6 @@ both.
Known issues / Roadmap
======================
* ...
Bug Tracker
===========

View File

@@ -41,11 +41,6 @@ class AccountJournal(models.Model):
last_import_date = fields.Datetime(
string="Last Import Date")
launch_import_completion = fields.Boolean(
string="Launch completion after import",
help="Tic that box to automatically launch the completion "
"on each imported file using this profile.")
partner_id = fields.Many2one(
comodel_name='res.partner',
string='Bank/Payment Office partner',
@@ -60,11 +55,19 @@ class AccountJournal(models.Model):
"debit/credit account (eg. an intermediat bank account "
"instead of default debitors).")
used_for_completion = fields.Boolean(
string="Journal used for completion")
rule_ids = fields.Many2many(
comodel_name='account.move.completion.rule',
string='Auto-completion rules',
rel='as_rul_st_prof_rel')
launch_import_completion = fields.Boolean(
string="Launch completion after import",
help="Tic that box to automatically launch the completion "
"on each imported file using this profile.")
def _get_rules(self):
# We need to respect the sequence order
return sorted(self.rule_ids, key=attrgetter('sequence'))

View File

@@ -344,6 +344,9 @@ class AccountMove(models.Model):
_name = 'account.move'
_inherit = ['account.move', 'mail.thread']
used_for_completion = fields.Boolean(
related='journal_id.used_for_completion',
readonly=True)
completion_logs = fields.Text(string='Completion Log', readonly=True)
def write_completion_log(self, error_msg, number_imported):

View File

@@ -4,15 +4,23 @@
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<field name="journal_id" position="after">
<field name="used_for_completion" invisible="1"/>
</field>
<button name="button_cancel" position="after">
<button name="button_auto_completion" string="Auto Completion" states='draft' type="object" class="oe_highlight" groups="account.group_account_invoice"/>
<button name="button_auto_completion"
string="Auto Completion"
type="object"
class="oe_highlight"
groups="account.group_account_invoice"
attrs="{'invisible': ['|', ('used_for_completion','=',False), ('state','not in', ['draft'])]}"/>
</button>
<xpath expr="/form/sheet/notebook/page/field[@name='line_ids']/tree/field[@name='credit']" position="after">
<field name="already_completed"/>
</xpath>
<xpath expr="/form/sheet/notebook" position="inside">
<page string="Completion Logs" attrs="{'invisible':[('completion_logs','=',False)]}">
<field name="completion_logs" colspan="4" nolabel="1" attrs="{'invisible':[('completion_logs','=',False)]}"/>
<field name="completion_logs" colspan="4" nolabel="1"/>
</page>
</xpath>
</field>

View File

@@ -7,18 +7,21 @@
<field name="arch" type="xml">
<field name="loss_account_id" position="after">
<field name="used_for_import"/>
<field name="used_for_completion"/>
</field>
<notebook position="inside">
<page string="Import related infos" attrs="{'invisible': [('used_for_import', '=', False)]}">
<group>
<field name="launch_import_completion" attrs="{'required': ['used_for_import', '=', True]}"/>
<field name="launch_import_completion" attrs="{'invisible': ['|',
('used_for_import', '=', False),
('used_for_completion', '=', False)]}"/>
<field name="last_import_date" readonly="1"/>
<field name="import_type" attrs="{'required': ['used_for_import', '=', True]}"/>
<field name="import_type" attrs="{'required': [('used_for_import', '=', True)]}"/>
</group>
<group>
<field name="commission_account_id" attrs="{'required': ['used_for_import', '=', True]}"/>
<field name="receivable_account_id" attrs="{'required': ['used_for_import', '=', True]}"/>
<field name="partner_id" attrs="{'required': ['used_for_import', '=', True]}"/>
<field name="commission_account_id" attrs="{'required': [('used_for_import', '=', True)]}"/>
<field name="receivable_account_id" attrs="{'required': [('used_for_import', '=', True)]}"/>
<field name="partner_id" attrs="{'required': [('used_for_import', '=', True)]}"/>
</group>
<group>
<button name="%(account_statement_base_import.move_importer_action)d"
@@ -26,8 +29,12 @@
type="action" icon="gtk-ok"
colspan = "2"/>
</group>
<separator colspan="4" string="Auto-Completion Rules"/>
<field name="rule_ids" colspan="4" nolabel="1"/>
</page>
<page string="Auto-Completion related infos" attrs="{'invisible': [('used_for_completion', '=', False)]}">
<group>
<separator colspan="4" string="Auto-Completion Rules"/>
<field name="rule_ids" colspan="4" nolabel="1"/>
</group>
</page>
</notebook>
</field>