Skip to content

Commit

Permalink
Merge PR #2750 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Oct 26, 2023
2 parents e2ae98f + c4df00c commit eccd5a0
Show file tree
Hide file tree
Showing 34 changed files with 54 additions and 62 deletions.
4 changes: 2 additions & 2 deletions l10n_br_account_payment_order/models/account_payment_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ def draft2open_payment_line_check(self):
"""
Override to add brazilian validations
"""
res = super(AccountPaymentLine, self).draft2open_payment_line_check()
res = super().draft2open_payment_line_check()
self._check_pix_transfer_type()
return res

@api.onchange("partner_id")
def partner_id_change(self):
res = super(AccountPaymentLine, self).partner_id_change()
res = super().partner_id_change()
partner_pix = False
if self.partner_id.pix_key_ids:
partner_pix = self.partner_id.pix_key_ids[0]
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_base/models/res_partner_pix.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ def _normalize_evp(self, key):
def create(self, vals_list):
for vals in vals_list:
self.check_vals(vals)
return super(PartnerPix, self).create(vals_list)
return super().create(vals_list)

def write(self, vals):
self.check_vals(vals)
return super(PartnerPix, self).write(vals)
return super().write(vals)

def check_vals(self, vals):
key_type = vals.get("key_type") or self.key_type
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnab_structure/models/cnab_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def unlink(self):
lines = self.filtered(lambda l: l.state != "draft")
if lines:
raise UserError(_("You cannot delete an CNAB Batch which is not draft !"))
return super(CNABBatch, self).unlink()
return super().unlink()

def check_batch(self):

Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnab_structure/models/cnab_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def unlink(self):
lines = self.filtered(lambda l: l.state != "draft")
if lines:
raise UserError(_("You cannot delete an CNAB Line which is not draft !"))
return super(CNABLine, self).unlink()
return super().unlink()

def check_line(self):

Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnab_structure/models/cnab_line_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def unlink(self):
lines = self.filtered(lambda l: l.state != "draft")
if lines:
raise UserError(_("You cannot delete an CNAB Field which is not draft !"))
return super(CNABField, self).unlink()
return super().unlink()

def action_review(self):
self.write({"state": "review"})
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnab_structure/models/cnab_line_field_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CNABFieldGroup(models.Model):

@api.model
def default_get(self, fields):
res = super(CNABFieldGroup, self).default_get(fields)
res = super().default_get(fields)
# It seems to be a bug in native odoo that the field cnab_line_id
# is not in the fields list by default. A workaround is required
# to force this.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CNABFieldCondition(models.Model):
@api.model
def default_get(self, fields_list):
"""Override default_get"""
res = super(CNABFieldCondition, self).default_get(fields_list)
res = super().default_get(fields_list)
# It seems to be a bug in native odoo that the field cnab_line_id
# is not in the fields list by default. A workaround is required
# to force this.
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnab_structure/models/cnab_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def unlink(self):
raise UserError(
_("You cannot delete an CNAB Structure which is not draft !")
)
return super(CNABStructure, self).unlink()
return super().unlink()

def action_review(self):
self.check_structure()
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnpj_search/tests/test_receitaws.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@tagged("post_install", "-at_install")
class TestReceitaWS(TestCnpjCommon):
def setUp(self):
super(TestReceitaWS, self).setUp()
super().setUp()

self.set_param("cnpj_provider", "receitaws")

Expand Down
2 changes: 1 addition & 1 deletion l10n_br_cnpj_search/tests/test_serpro.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@tagged("post_install", "-at_install")
class TestTestSerPro(TestCnpjCommon):
def setUp(self):
super(TestTestSerPro, self).setUp()
super().setUp()

self.set_param("cnpj_provider", "serpro")
self.set_param("serpro_token", "06aef429-a981-3ec5-a1f8-71d38d86481e")
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_coa_simple/tests/test_l10n_br_coa_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class L10nBrSimpleCOA(TransactionCase):
def setUp(self):
super(L10nBrSimpleCOA, self).setUp()
super().setUp()

self.l10n_br_coa_simple = self.env.ref(
"l10n_br_coa_simple.l10n_br_coa_simple_chart_template"
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_contract/tests/test_l10n_br_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
class TestL10nBrContract(SavepointCase):
@classmethod
def setUpClass(cls):
super(TestL10nBrContract, cls).setUpClass()
super().setUpClass()

# Create contract with 3 lines, two resale products and one service
contract_form = Form(cls.env["contract.contract"])
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_crm/tests/test_crm_onchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class L10nBrCrmOnchangeTest(TransactionCase):
def setUp(self):
super(L10nBrCrmOnchangeTest, self).setUp()
super().setUp()

self.crm_lead_01 = self.env["crm.lead"].create(
{
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_fiscal_closing/tests/test_fiscal_closing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

class TestFiscalClosing(TransactionCase):
def setUp(self):
super(TestFiscalClosing, self).setUp()
super().setUp()

self.nfe_export = self.env.ref("l10n_br_fiscal.demo_nfe_export")
self.nfe_export.document_date = fields.Datetime.now()
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_hr/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def create(self, vals):
)
vals["parent_id"] = employee_id.address_home_id.id

partner = super(ResPartner, self).create(vals)
partner = super().create(vals)

if "create_depentent" not in self._context and vals.get(
"is_employee_dependent", False
Expand All @@ -32,7 +32,7 @@ def create(self, vals):
return partner

def write(self, vals):
res = super(ResPartner, self).write(vals)
res = super().write(vals)
if "is_employee_dependent" in vals and not self.is_employee_dependent:
self.create_depentent()
return res
2 changes: 1 addition & 1 deletion l10n_br_nfse/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def _processador_erpbrasil_nfse(self):
)

def _document_export(self, pretty_print=True):
result = super(Document, self)._document_export()
result = super()._document_export()
for record in self.filtered(filter_processador_edoc_nfse):
if record.company_id.provedor_nfse:
edoc = record.serialize()[0]
Expand Down
8 changes: 3 additions & 5 deletions l10n_br_nfse/models/document_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,23 @@ class DocumentLine(models.Model):

@api.onchange("product_id")
def _onchange_product_id_fiscal(self):
result = super(DocumentLine, self)._onchange_product_id_fiscal()
result = super()._onchange_product_id_fiscal()
if self.product_id and self.product_id.fiscal_deductions_value:
self.fiscal_deductions_value = self.product_id.fiscal_deductions_value
return result

def _compute_taxes(self, taxes, cst=None):
discount_value = self.discount_value
self.discount_value += self.fiscal_deductions_value
res = super(DocumentLine, self)._compute_taxes(taxes, cst)
res = super()._compute_taxes(taxes, cst)
self.discount_value = discount_value
return res

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

if view_type == "form":
try:
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_nfse/tests/test_fiscal_document_nfse_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

class TestFiscalDocumentNFSeCommon(TransactionCase):
def setUp(self):
super(TestFiscalDocumentNFSeCommon, self).setUp()
super().setUp()

self.nfse_same_state = self.env.ref("l10n_br_fiscal.demo_nfse_same_state")
self.company = self.env.ref("l10n_br_base.empresa_simples_nacional")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestFiscalDocumentNFSeGinfes(TestFiscalDocumentNFSeCommon):
def setUp(self):
super(TestFiscalDocumentNFSeGinfes, self).setUp()
super().setUp()

self.company.provedor_nfse = "ginfes"

Expand Down
6 changes: 3 additions & 3 deletions l10n_br_nfse_paulistana/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def convert_type_nfselib(self, class_object, object_filed, value):
return value

def _serialize(self, edocs):
edocs = super(Document, self)._serialize(edocs)
edocs = super()._serialize(edocs)
for record in self.filtered(filter_oca_nfse).filtered(filter_paulistana):
edocs.append(record.serialize_nfse_paulistana())
return edocs
Expand Down Expand Up @@ -325,7 +325,7 @@ def _map_type_rps(self, rps_type):
return dict_type_rps[rps_type]

def _eletronic_document_send(self):
super(Document, self)._eletronic_document_send()
super()._eletronic_document_send()
for record in self.filtered(filter_oca_nfse).filtered(filter_paulistana):
processador = record._processador_erpbrasil_nfse()

Expand Down Expand Up @@ -443,5 +443,5 @@ def doc_dict(record):
return status

def _exec_before_SITUACAO_EDOC_CANCELADA(self, old_state, new_state):
super(Document, self)._exec_before_SITUACAO_EDOC_CANCELADA(old_state, new_state)
super()._exec_before_SITUACAO_EDOC_CANCELADA(old_state, new_state)
return self.cancel_document_paulistana()
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class TestFiscalDocumentNFSePaulistana(TestFiscalDocumentNFSeCommon):
def setUp(self):
super(TestFiscalDocumentNFSePaulistana, self).setUp()
super().setUp()
self.company.provedor_nfse = "paulistana"

def test_nfse_paulistana(self):
Expand Down
4 changes: 2 additions & 2 deletions l10n_br_portal/controllers/portal.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class L10nBrPortal(CustomerPortal):
) + ["inscr_mun", "street2", "mobile"]

def _prepare_portal_layout_values(self):
values = super(L10nBrPortal, self)._prepare_portal_layout_values()
values = super()._prepare_portal_layout_values()
cities = request.env["res.city"].sudo().search([])
values.update(
{
Expand All @@ -41,7 +41,7 @@ def account(self, redirect=None, **post):
city_id = request.env["res.city"].sudo().browse(int(post.get("city_id")))
if city_id:
post["city"] = city_id.name
res = super(L10nBrPortal, self).account(redirect, **post)
res = super().account(redirect, **post)
return res

@http.route("/l10n_br/zip_search", type="json", auth="user", website=True)
Expand Down
8 changes: 2 additions & 6 deletions l10n_br_pos/models/mail_thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ def message_post_with_view(self, views_or_xmlid, **kwargs):
[("name", "=", kwargs["values"]["origin"].origin)]
)
if not pos_order:
return super(MailThread, self).message_post_with_view(
views_or_xmlid, **kwargs
)
return super().message_post_with_view(views_or_xmlid, **kwargs)
except Exception:
return super(MailThread, self).message_post_with_view(
views_or_xmlid, **kwargs
)
return super().message_post_with_view(views_or_xmlid, **kwargs)
2 changes: 1 addition & 1 deletion l10n_br_pos/models/pos_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def _process_order(self, order, draft, existing_order):

@api.model
def _order_fields(self, ui_order):
order_fields = super(PosOrder, self)._order_fields(ui_order)
order_fields = super()._order_fields(ui_order)
order_fields["status_code"] = ui_order.get("status_code")
order_fields["status_name"] = ui_order.get("status_name")
order_fields["status_description"] = ui_order.get("status_description")
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_pos/models/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ def create_from_ui(self, partner):
if partner.get("name"):
partner["legal_name"] = partner["name"]

res = super(ResPartner, self).create_from_ui(partner)
res = super().create_from_ui(partner)
return res
2 changes: 1 addition & 1 deletion l10n_br_pos/models/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class StockPicking(models.Model):

@api.model
def _get_fiscal_document_access_keys_fields(self):
su = super(StockPicking, self)
su = super()
return su._get_fiscal_document_access_keys_fields() + ["pos_order_ids.key_cfe"]
10 changes: 4 additions & 6 deletions l10n_br_pos_nfce/models/pos_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PosOrder(models.Model):
)

def _prepare_invoice_vals(self):
vals = super(PosOrder, self)._prepare_invoice_vals()
vals = super()._prepare_invoice_vals()

pos_config_id = self.session_id.config_id
if pos_config_id.simplified_document_type == MODELO_FISCAL_NFCE:
Expand Down Expand Up @@ -61,9 +61,7 @@ def _prepare_nfce_vals(self, pos_config_id):

@api.model
def _process_order(self, pos_order_vals, draft, existing_order):
res = super(PosOrder, self)._process_order(
pos_order_vals, draft, existing_order
)
res = super()._process_order(pos_order_vals, draft, existing_order)

created_order = self.browse(res)
pos_config_id = created_order.session_id.config_id
Expand Down Expand Up @@ -114,7 +112,7 @@ def _has_anonymous_consumer(self):
return self.cnpj_cpf and self.partner_id.is_anonymous_consumer

def _prepare_invoice_line(self, order_line):
vals = super(PosOrder, self)._prepare_invoice_line(order_line)
vals = super()._prepare_invoice_line(order_line)

if self.config_id.simplified_document_type == MODELO_FISCAL_NFCE:
vals.update(order_line._prepare_nfce_tax_dict())
Expand All @@ -123,7 +121,7 @@ def _prepare_invoice_line(self, order_line):

@api.model
def create_from_ui(self, orders, draft=False):
response = super(PosOrder, self).create_from_ui(orders, draft)
response = super().create_from_ui(orders, draft)
for option in response:
order = self.env["pos.order"].search([("id", "=", option["id"])])
if order.document_type == MODELO_FISCAL_NFCE:
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_resource/tests/test_resource_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# for some reason conversion to SavepointCase fails
class TestResourceCalendar(test_common.SingleTransactionCase):
def setUp(self):
super(TestResourceCalendar, self).setUp()
super().setUp()

self.resource_calendar = self.env["resource.calendar"]
self.resource_leaves = self.env["resource.calendar.leaves"]
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_stock_account/tests/test_stock_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class StockRuleTest(TransactionCase):
"""Test Stock Rule"""

def setUp(self):
super(StockRuleTest, self).setUp()
super().setUp()

# Create a product route containing a stock rule that will
# generate a move from Stock for every procurement created in Output
Expand Down
12 changes: 6 additions & 6 deletions l10n_br_website_sale/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def confirm_order(self, **post):
line._onchange_fiscal_operation_line_id()
line._onchange_fiscal_taxes()

return super(L10nBrWebsiteSale, self).confirm_order(**post)
return super().confirm_order(**post)

def _get_mandatory_fields_billing(self, country_id=False):
req = super()._get_mandatory_fields_billing(country_id)
Expand Down Expand Up @@ -84,7 +84,7 @@ def address(self, **kw):
city_id = request.env["res.city"].sudo().browse(int(kw.get("city_id")))
if city_id:
kw["city"] = city_id.name
res = super(L10nBrWebsiteSale, self).address(**kw)
res = super().address(**kw)
if "submitted" not in kw:
country_id = request.env["res.country"].search([("code", "=", "BR")])
res.qcontext["country"] = country_id
Expand All @@ -106,9 +106,9 @@ def address(self, **kw):
return res

def values_postprocess(self, order, mode, values, errors, error_msg):
new_values, errors, error_msg = super(
L10nBrWebsiteSale, self
).values_postprocess(order, mode, values, errors, error_msg)
new_values, errors, error_msg = super().values_postprocess(
order, mode, values, errors, error_msg
)
if "country_id" in new_values and new_values["country_id"] != "31":
if "state_id" in errors:
errors.pop("state_id", None)
Expand All @@ -132,7 +132,7 @@ def values_postprocess(self, order, mode, values, errors, error_msg):
return new_values, errors, error_msg

def checkout_form_validate(self, mode, all_form_values, data):
error, error_message = super(L10nBrWebsiteSale, self).checkout_form_validate(
error, error_message = super().checkout_form_validate(
mode, all_form_values, data
)

Expand Down
Loading

0 comments on commit eccd5a0

Please sign in to comment.