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

[14.0][REF+IMP] l10n_br_purchase_stock: Renomeando o campo da Politica de Fatura e adaptando código para o caso Sem Operação Fiscal #3145

Merged
Merged
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_purchase_stock/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"category": "Localisation",
"author": "Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/l10n-brazil",
"version": "14.0.1.3.5",
"version": "14.0.2.0.0",
"depends": [
"l10n_br_purchase",
"l10n_br_stock_account",
Expand Down
6 changes: 3 additions & 3 deletions l10n_br_purchase_stock/demo/purchase_order.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

<!-- Criação da Invoice baseada no Picking.
Com isso os Picking são criados com o invoice_state 2binvoiced -->
<record id="purchase_create_invoice_policy_settings" model="res.config.settings">
<field name="purchase_create_invoice_policy">stock_picking</field>
<record id="purchase_invoicing_policy_settings" model="res.config.settings">
<field name="purchase_invoicing_policy">stock_picking</field>
</record>

<function model="res.config.settings" name="execute">
<value
model="res.config.settings"
search="[('id', '=',
ref('purchase_create_invoice_policy_settings'))]"
ref('purchase_invoicing_policy_settings'))]"
/>
</function>

Expand Down
16 changes: 16 additions & 0 deletions l10n_br_purchase_stock/migrations/14.0.2.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (C) 2024-Today - Akretion (<http://www.akretion.com>).
# @author Magno Costa <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from openupgradelib import openupgrade

_column_renames = {
"res_company": [
("purchase_create_invoice_policy", "purchase_invoicing_policy"),
],
}


@openupgrade.migrate(use_env=True)
def migrate(env, version):
openupgrade.rename_columns(env.cr, _column_renames)
3 changes: 0 additions & 3 deletions l10n_br_purchase_stock/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# Copyright (C) 2015 Renato Lima - Akretion
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html

from . import res_company
from . import purchase_order
from . import purchase_order_line
Expand Down
8 changes: 4 additions & 4 deletions l10n_br_purchase_stock/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
class PurchaseOrder(models.Model):
_inherit = "purchase.order"

purchase_create_invoice_policy = fields.Selection(
related="company_id.purchase_create_invoice_policy",
purchase_invoicing_policy = fields.Selection(
related="company_id.purchase_invoicing_policy",
)

# Make Invisible Invoice Button
Expand All @@ -30,7 +30,7 @@ def _compute_get_button_create_invoice_invisible(self):
):
button_create_invoice_invisible = True
else:
if record.purchase_create_invoice_policy == "stock_picking":
if record.purchase_invoicing_policy == "stock_picking":
# A criação de Fatura de Serviços deve ser possível via Pedido
if not any(
line.product_id.type == "service" for line in record.order_line
Expand All @@ -44,7 +44,7 @@ def _prepare_picking(self):
values = super()._prepare_picking()
if self.fiscal_operation_id:
values.update(self._prepare_br_fiscal_dict())
if self.company_id.purchase_create_invoice_policy == "stock_picking":
if self.company_id.purchase_invoicing_policy == "stock_picking":
values["invoice_state"] = "2binvoiced"

return values
2 changes: 1 addition & 1 deletion l10n_br_purchase_stock/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _prepare_stock_moves(self, picking):
for v in values:
if self.order_id.fiscal_operation_id:
v.update(self._prepare_br_fiscal_dict())
if self.order_id.purchase_create_invoice_policy == "stock_picking":
if self.order_id.purchase_invoicing_policy == "stock_picking":
v["invoice_state"] = "2binvoiced"
return values

Expand Down
2 changes: 1 addition & 1 deletion l10n_br_purchase_stock/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Company(models.Model):
domain=[("state", "=", "approved"), ("fiscal_type", "=", "purchase")],
)

purchase_create_invoice_policy = fields.Selection(
purchase_invoicing_policy = fields.Selection(
selection=[
("purchase_order", _("Purchase Order")),
("stock_picking", _("Stock Picking")),
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_purchase_stock/models/res_config_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

purchase_create_invoice_policy = fields.Selection(
related="company_id.purchase_create_invoice_policy",
purchase_invoicing_policy = fields.Selection(
related="company_id.purchase_invoicing_policy",
readonly=False,
)
2 changes: 1 addition & 1 deletion l10n_br_purchase_stock/views/res_company_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<field name="purchase_fiscal_operation_id" position="before">
<field name="purchase_create_invoice_policy" />
<field name="purchase_invoicing_policy" />
</field>
</field>
</record>
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_purchase_stock/views/res_config_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
>
<div class="o_setting_left_pane" />
<div class="o_setting_right_pane">
<label for="purchase_create_invoice_policy" />
<label for="purchase_invoicing_policy" />
<span
class="fa fa-lg fa-building-o"
title="Values set here are company-specific."
Expand All @@ -33,7 +33,7 @@
<div class="content-group">
<div class="mt16">
<field
name="purchase_create_invoice_policy"
name="purchase_invoicing_policy"
class="o_light_label"
widget="radio"
/>
Expand Down
Loading