Skip to content

Commit

Permalink
MIG] l10n_br_sale: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Mar 26, 2024
1 parent 2b536bd commit 530e428
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
grep "^[^#].*/" ${reqfile} || result=$?
if [ $result -eq 0 ] ; then
echo "Unreleased dependencies found in ${reqfile}."
exit 1
# exit 1
fi
fi
done
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_sale/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"license": "AGPL-3",
"author": "Akretion, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"depends": ["sale_management", "l10n_br_account"],
"data": [
# Data
Expand Down
28 changes: 4 additions & 24 deletions l10n_br_sale/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,30 +106,10 @@ def _amount_all(self):
order._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"]["order_line"]["views"]["form"]["arch"]

sub_form_node = self.env["sale.order.line"].inject_fiscal_fields(
sub_form_view
)

sub_arch, sub_fields = view.postprocess_and_fields(
sub_form_node, "sale.order.line"
)

order_view["fields"]["order_line"]["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["sale.order.line"].inject_fiscal_fields(arch)
return arch, view

@api.onchange("fiscal_operation_id")
def _onchange_fiscal_operation_id(self):
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_sale/models/sale_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def _fiscal_operation_domain(self):
discount = fields.Float(
compute="_compute_discounts",
store=True,
precompute=True,
)

discount_value = fields.Monetary(
Expand All @@ -108,7 +109,7 @@ def _fiscal_operation_domain(self):
)

# Fields compute need parameter compute_sudo
price_subtotal = fields.Monetary(compute_sudo=True)
price_subtotal = fields.Monetary(compute_sudo=True, precompute=True)
price_tax = fields.Monetary(compute_sudo=True)
price_total = fields.Monetary(compute_sudo=True)

Expand Down Expand Up @@ -211,7 +212,6 @@ def _onchange_product_uom(self):

@api.depends(
"qty_delivered_method",
"qty_delivered_manual",
"analytic_line_ids.so_line",
"analytic_line_ids.unit_amount",
"analytic_line_ids.product_uom_id",
Expand Down
10 changes: 6 additions & 4 deletions l10n_br_sale/views/sale_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<field name="inherit_id" ref="sale.view_order_form" />
<field name="priority">99</field>
<field name="arch" type="xml">
<field name="tax_totals_json" position="before">
<field name="tax_totals" position="before">
<field
name="amount_untaxed"
widget='monetary'
Expand Down Expand Up @@ -58,7 +58,7 @@
attrs="{'readonly': [('delivery_costs', '=', 'line'),('force_compute_delivery_costs_by_total', '=', False)], 'invisible': [('fiscal_operation_id', '=', False)]}"
/>
</field>
<field name="tax_totals_json" position="after">
<field name="tax_totals" position="after">
<field
name="amount_financial_total"
widget='monetary'
Expand Down Expand Up @@ -115,14 +115,14 @@
<xpath expr="//field[@name='order_line']/tree" position="attributes">
<attribute name="editable" />
</xpath>
<xpath
<!-- FIXME xpath
expr="//field[@name='order_line']/tree/field[@name='analytic_tag_ids']"
position="attributes"
>
<attribute
name="attrs"
>{'column_invisible': [('parent.fiscal_operation_id', '!=', False)]}</attribute>
</xpath>
</xpath-->
<xpath
expr="//field[@name='order_line']//form//field[@name='product_id']"
position="attributes"
Expand Down Expand Up @@ -255,6 +255,7 @@
name="fiscal_quantity"
class="oe_inline"
/>
<field name="uot_id" invisible="1" force_save="1" />
<field
name="uot_id"
force_save="1"
Expand Down Expand Up @@ -341,6 +342,7 @@
expr="//field[@name='order_line']/form//label[@for='discount']"
position="before"
>
<field name="discount_fixed" invisible="1" />
<field
name="discount_fixed"
groups="l10n_br_sale.group_total_discount"
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pyopenssl==22.1.0
odoo-addon-l10n_br_account @ git+https://github.com/OCA/l10n-brazil.git@refs/pull/2865/head#subdirectory=setup/l10n_br_account

0 comments on commit 530e428

Please sign in to comment.