Skip to content

Commit

Permalink
[FIX+MIG] l10n_br_stock_account: Adapt View v16
Browse files Browse the repository at this point in the history
  • Loading branch information
mbcosta committed Dec 17, 2024
1 parent 44dde66 commit 9fd6061
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 28 deletions.
28 changes: 4 additions & 24 deletions l10n_br_stock_account/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,10 @@ def _amount_all(self):
picking._compute_amount()

@api.model
def fields_view_get(
self, view_id=None, view_type="form", toolbar=False, submenu=False
):
order_view = super().fields_view_get(view_id, view_type, toolbar, submenu)

if view_type == "form":
view = self.env["ir.ui.view"]

sub_form_view = order_view["fields"]["move_ids_without_package"]["views"][
"form"
]["arch"]

sub_form_node = self.env["stock.move"].inject_fiscal_fields(sub_form_view)

sub_arch, sub_fields = view.postprocess_and_fields(
sub_form_node, "stock.move"
)

order_view["fields"]["move_ids_without_package"]["views"]["form"] = {
"fields": sub_fields,
"arch": sub_arch,
}

return order_view
def _get_view(self, view_id=None, view_type="form", **options):
arch, view = super()._get_view(view_id, view_type, **options)
arch = self.env["stock.move"].inject_fiscal_fields(arch)
return arch, view

def _put_in_pack(self, move_line_ids, create_package_level=True):
package = super()._put_in_pack(move_line_ids, create_package_level)
Expand Down
9 changes: 5 additions & 4 deletions l10n_br_stock_account/views/stock_picking.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
name="fiscal"
string="Fiscal"
attrs="{'invisible': ['|', ('invoice_state', 'in', [False, 'none']), ('parent.fiscal_operation_id', '=', False)]}"
colspan="4"
colspan="2"
>
<field name="invoice_state" readonly="1" force_save="1" />
<field name="fiscal_operation_type" invisible="1" />
Expand Down Expand Up @@ -118,9 +118,10 @@
<field name="partner_id" invisible="1" />
<field name="company_id" invisible="1" />
</group>
<group colspan="4">
<group>
<notebook
attrs="{'invisible': ['|', ('invoice_state', 'in', [False, 'none']), ('parent.fiscal_operation_id', '=', False)], 'readonly': [('invoice_state', '=', 'invoiced')]}"
colspan="2"
>
<group name="fiscal_fields" invisible="1">
<field
Expand Down Expand Up @@ -161,14 +162,14 @@
<group
name="invoice_lines"
string="Invoicing"
colspan="4"
groups="base.group_no_one"
attrs="{'invisible': [('invoice_state', 'in', [False, 'none'])]}"
>
<field
name="invoice_line_ids"
readonly="1"
nolabel="1"
colspan="2"
/>
</group>
</page>
Expand All @@ -193,7 +194,7 @@
<group
name="invoice_lines"
string="Invoicing"
colspan="4"
colspan="2"
groups="base.group_no_one"
attrs="{'invisible': ['|', ('fiscal_operation_line_id', '!=', False), ('invoice_state', 'in', [False, 'none'])]}"
>
Expand Down

0 comments on commit 9fd6061

Please sign in to comment.