Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][14.0][FIX] account_move magic button on fiscal document fix #3261 #3263

Draft
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def open_fiscal_document(self):
action = self.env["ir.actions.act_window"]._for_xml_id(xmlid)

if len(self.fiscal_document_ids) == 1:
form_view = [(self.env.ref("l10n_br_fiscal.document_form").id, "form")]
form_view = [(self.env.ref("l10n_br_account.l10n_br_fiscal_document_form_inherit").id, "form")]
if "views" in action:
action["views"] = form_view + [
(state, view) for state, view in action["views"] if view != "form"
Expand Down
7 changes: 7 additions & 0 deletions l10n_br_account/models/fiscal_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,10 @@
if self.move_ids:
self.move_ids.button_draft()
return result

def open_account_moves(self):
""""""
self.ensure_one()
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
action["domain"] = [("id", "in", self.move_ids.ids)]
return action

Check warning on line 189 in l10n_br_account/models/fiscal_document.py

View check run for this annotation

Codecov / codecov/patch

l10n_br_account/models/fiscal_document.py#L186-L189

Added lines #L186 - L189 were not covered by tests
20 changes: 18 additions & 2 deletions l10n_br_account/views/document_view.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="nfe_document_form_inherit" model="ir.ui.view">
<field name="name">l10n_br_nfe.document.form.inherit</field>
<record id="l10n_br_fiscal_document_form_inherit" model="ir.ui.view">
<field name="name">l10n_br_fiscal.document.form2</field>
<field name="model">l10n_br_fiscal.document</field>
<field name="inherit_id" ref="l10n_br_fiscal.document_form" />

<field name="mode">primary</field>
<field name="priority">1</field>

<field name="arch" type="xml">
<field name="state_fiscal" position="after">
<field name="move_ids" invisible="1" />
</field>
<div name="button_box" position="inside">
<button
name="open_account_moves"
title="Open Account Moves"
type="object"
class="oe_stat_button"
icon="fa-pencil-square-o"
attrs="{'invisible': [('move_ids', '=', [])]}"
>
<span>Account Moves</span>
</button>
</div>
</field>
</record>

Expand Down
Loading