[IMP] account_reconcile_oca: Allow to define the statement directly
parent
69055e8de7
commit
60f3c69907
|
@ -11,6 +11,5 @@ class AccountBankStatement(models.Model):
|
|||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_reconcile_oca.account_bank_statement_action_edit"
|
||||
)
|
||||
print(action)
|
||||
action["res_id"] = self.id
|
||||
return action
|
||||
|
|
|
@ -769,3 +769,25 @@ class AccountBankStatementLine(models.Model):
|
|||
if vals["partner_id"] is False and self.partner_name:
|
||||
vals["partner_id"] = (False, self.partner_name)
|
||||
return vals
|
||||
|
||||
def add_statement(self):
|
||||
self.ensure_one()
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id(
|
||||
"account_reconcile_oca.account_bank_statement_action_edit"
|
||||
)
|
||||
previous_line_with_statement = self.env["account.bank.statement.line"].search(
|
||||
[
|
||||
("internal_index", "<", self.internal_index),
|
||||
("journal_id", "=", self.journal_id.id),
|
||||
("state", "=", "posted"),
|
||||
("statement_id", "!=", self.statement_id.id),
|
||||
("statement_id", "!=", False),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
action["context"] = {
|
||||
"default_journal_id": self.journal_id.id,
|
||||
"default_balance_start": previous_line_with_statement.statement_id.balance_end_real,
|
||||
"split_line_id": self.id,
|
||||
}
|
||||
return action
|
||||
|
|
|
@ -6,9 +6,23 @@
|
|||
flex-flow: row wrap;
|
||||
height: 100%;
|
||||
.o_kanban_renderer.o_kanban_ungrouped .o_kanban_record {
|
||||
&:hover {
|
||||
.o_reconcile_create_statement {
|
||||
opacity: 100;
|
||||
}
|
||||
}
|
||||
margin: 0 0 0;
|
||||
min-width: fit-content;
|
||||
width: 100%;
|
||||
.o_reconcile_create_statement {
|
||||
position: absolute;
|
||||
height: 4px;
|
||||
margin: 0;
|
||||
padding: 2px 0 0 0;
|
||||
border: 0;
|
||||
top: -14px;
|
||||
opacity: 0;
|
||||
}
|
||||
> div {
|
||||
border-right: thick solid rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<field name="balance_start" />
|
||||
<field name="balance_end_real" />
|
||||
<field name="attachment_ids" widget="many2many_binary" />
|
||||
<field name="line_ids" invisible="1" />
|
||||
</group>
|
||||
</sheet>
|
||||
|
||||
|
|
|
@ -17,6 +17,20 @@
|
|||
<field name="to_check" />
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div
|
||||
t-if="!record.statement_id.raw_value"
|
||||
class="o_reconcile_create_statement text-center"
|
||||
>
|
||||
<a
|
||||
role="button"
|
||||
class="btn btn-secondary btn-sm"
|
||||
tabindex="-1"
|
||||
type="object"
|
||||
name="add_statement"
|
||||
>
|
||||
Statement
|
||||
</a>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="oe_kanban_card oe_kanban_global_click"
|
||||
style="width:100%"
|
||||
|
|
Loading…
Reference in New Issue