Skip to content

Commit

Permalink
[TEST] l10n_br_account: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelsavegnago committed Dec 9, 2024
1 parent 8a0b137 commit 690393f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
40 changes: 24 additions & 16 deletions l10n_br_account/models/fiscal_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# Copyright (C) 2019 - TODAY Raphaël Valyi - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from odoo import fields, models
from odoo import _, fields, models
from odoo.exceptions import UserError

# from odoo.addons.account.models.account_invoice import TYPE2JOURNAL

Expand Down Expand Up @@ -66,27 +67,34 @@ def _change_action_view(self, action):
def action_create_new(self):
action = super().action_create_new()
if self.create_account_move:
action["res_model"] = "account.move"
action["view_id"] = self.env.ref("l10n_br_account.fiscal_invoice_form").id
action["context"] = self._change_action_view(action)["context"]
raise UserError(
_(
"This is a fiscal operation that generates account move, please "
"create the document through the Account App"
)
)
# action["res_model"] = "account.move"
# action["view_id"] = self.env.ref("l10n_br_account.fiscal_invoice_form").id
# action["context"] = self._change_action_view(action)["context"]
return action

def open_action(self):
action = super().open_action()
if self.create_account_move:
return self._change_action_view(action)
return action
# def open_action(self):
# action = super().open_action()
# if self.create_account_move:
# return self._change_action_view(action)
# return action

def _fiscal_document_object(self):
return self.env["account.move"]
# def _fiscal_document_object(self):
# return self.env["account.move"]

def _line_domain(self, company, partner, product):
domain = super()._line_domain(company=company, partner=partner, product=product)

domain += [
"|",
("fiscal_position_id", "=", partner.property_account_position_id.id),
("fiscal_position_id", "=", False),
]
if self.create_account_move:
domain += [
"|",
("fiscal_position_id", "=", partner.property_account_position_id.id),
("fiscal_position_id", "=", False),
]

return domain
4 changes: 2 additions & 2 deletions l10n_br_account/views/l10n_br_account_action.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
/>
<field
name="context"
eval="{'default_document_type_id': ref('l10n_br_fiscal.document_55')}"
eval="{'default_document_type_id': ref('l10n_br_fiscal.document_55'), 'create': False}"
/>
<field name="search_view_id" ref="l10n_br_account.fiscal_invoice_search" />
<field name="help" type="html">
Expand Down Expand Up @@ -52,7 +52,7 @@
/>
<field
name="context"
eval="{'default_document_type_id': ref('l10n_br_fiscal.document_SE')}"
eval="{'default_document_type_id': ref('l10n_br_fiscal.document_SE'), 'create': False}"
/>
<field name="search_view_id" ref="l10n_br_account.fiscal_invoice_search" />
<field name="help" type="html">
Expand Down
12 changes: 6 additions & 6 deletions l10n_br_account/views/l10n_br_account_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@
</record>

<!-- Incomming Documents -->
<record id="l10n_br_fiscal.document_in_menu" model="ir.ui.menu">
<!-- <record id="l10n_br_fiscal.document_in_menu" model="ir.ui.menu">
<field name="action" ref="fiscal_invoice_in_action" />
</record>
</record> -->

<!-- Outgoing Documents -->
<record id="l10n_br_fiscal.document_out_menu" model="ir.ui.menu">
<!-- <record id="l10n_br_fiscal.document_out_menu" model="ir.ui.menu">
<field name="action" ref="fiscal_invoice_out_action" />
</record>
</record> -->

<!-- All Documents -->
<!-- (we keep l10n_br_fiscal.document_all_menu
with l10n_br_fiscal.document object for low level fiscal detail)-->
<menuitem
<!-- <menuitem
id="document_all_menu"
action="fiscal_invoice_all_action"
name="All Documents"
groups="l10n_br_fiscal.group_user,l10n_br_fiscal.group_manager"
parent="l10n_br_fiscal.document_sub_menu"
sequence="25"
/>
/> -->

</odoo>

0 comments on commit 690393f

Please sign in to comment.