Skip to content

Commit

Permalink
[IMP] *: pre-commit automatic fixes
Browse files Browse the repository at this point in the history
closes #1018

Signed-off-by: Virginia Bonservizi <[email protected]>
  • Loading branch information
jue-adhoc committed Feb 6, 2025
1 parent 8dd61db commit 99e05a0
Show file tree
Hide file tree
Showing 50 changed files with 1,070 additions and 957 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

exclude: |
(?x)
# We don't want to mess with tool-generated files
.svg$|/tests/([^/]+/)?cassettes/|^.copier-answers.yml$|^.github/|^eslint.config.cjs|^prettier.config.cjs|
# Library files can have extraneous formatting (even minimized)
Expand Down
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ Please follow the official guide from [Odoo Argentina](https://github.com/ingadh
## Project Specific Guidelines

This project does not have specific coding guidelines.

16 changes: 8 additions & 8 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
> **No me gusta mi camisa**
>
> *Version affectada:*
>
>
> - 7.0 y encima
>
>
> *Pasos para reproducir:*
>
>
> 1. ponerse antes de un espejo
> 2. prender la luz
> 3. abrir los ojos
>
>
> *Lo que pasa actualmente:*
>
>
> - Asusto
>
>
> *Lo que debe pasar:*
>
> - Todo bien, listo para la fiesta
>
> - Todo bien, listo para la fiesta
>
> *Analisis profunda:*
>
Expand Down
31 changes: 15 additions & 16 deletions l10n_ar_account_withholding_ratio/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{
'name': 'Argentinean Withholding Ratio',
'version': "17.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'summary': '',
'depends': [
'l10n_ar_withholding_ux',
"name": "Argentinean Withholding Ratio",
"version": "17.0.1.0.0",
"category": "Localization/Argentina",
"sequence": 14,
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"summary": "",
"depends": [
"l10n_ar_withholding_ux",
],
'data': [
"data": [
#'views/account_tax_view.xml',
],
'demo': [
],
'installable': False,
'auto_install': False,
'application': False,
"demo": [],
"installable": False,
"auto_install": False,
"application": False,
}
29 changes: 16 additions & 13 deletions l10n_ar_account_withholding_ratio/models/account_tax.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
from odoo import fields, models, api, _
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class AccountTax(models.Model):
_inherit = 'account.tax'
_inherit = "account.tax"

ratio = fields.Float(default=100.00, help="Ratio to apply to tax base amount.")

@api.constrains('ratio')
@api.constrains("ratio")
def _check_line_ids_percent(self):
""" Check that the total percent is not bigger than 100.0 """
"""Check that the total percent is not bigger than 100.0"""
for tax in self:
if not tax.ratio or tax.ratio < 0.0 or tax.ratio > 100.0:
raise ValidationError(_('The total percentage (%s) should be higher than 0 and less or equal to 100.', tax.ratio))
raise ValidationError(
_("The total percentage (%s) should be higher than 0 and less or equal to 100.", tax.ratio)
)

def get_withholding_vals(self, payment):
vals = super().get_withholding_vals(payment)
if self.withholding_type == 'partner_tax' and self.ratio != 100:
vals['withholdable_base_amount'] *= self.ratio / 100
vals['period_withholding_amount'] *= self.ratio / 100
if self.withholding_type == "partner_tax" and self.ratio != 100:
vals["withholdable_base_amount"] *= self.ratio / 100
vals["period_withholding_amount"] *= self.ratio / 100
return vals

def _compute_amount(
self, base_amount, price_unit, quantity, product, partner=None, fixed_multiplicator=1):
if self.amount_type == 'partner_tax' and self.ratio != 100:
date = self._context.get('invoice_date') or fields.Date.context_today(self)
def _compute_amount(self, base_amount, price_unit, quantity, product, partner=None, fixed_multiplicator=1):
if self.amount_type == "partner_tax" and self.ratio != 100:
date = self._context.get("invoice_date") or fields.Date.context_today(self)
partner = partner and partner.sudo()
return base_amount * self.sudo().get_partner_alicuota_percepcion(partner, date) * self.ratio / 100
return super()._compute_amount(base_amount, price_unit, quantity, product, partner=partner, fixed_multiplicator=fixed_multiplicator)
return super()._compute_amount(
base_amount, price_unit, quantity, product, partner=partner, fixed_multiplicator=fixed_multiplicator
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@
</record>

</odoo>

28 changes: 14 additions & 14 deletions l10n_ar_bank/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "Listado de Bancos Argentinos",
'version': "18.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
'license': 'AGPL-3',
'summary': '',
'depends': [
'base',
'l10n_ar',
"version": "18.0.1.0.0",
"category": "Localization/Argentina",
"sequence": 14,
"author": "ADHOC SA",
"license": "AGPL-3",
"summary": "",
"depends": [
"base",
"l10n_ar",
],
'data': [
'data/res_bank.xml',
"data": [
"data/res_bank.xml",
],
'installable': True,
'auto_install': True,
'application': False,
"installable": True,
"auto_install": True,
"application": False,
}
38 changes: 18 additions & 20 deletions l10n_ar_purchase/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{
'name': 'Argentinean Purchase',
'version': "18.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'summary': '',
'depends': [
'purchase',
'l10n_ar',
"name": "Argentinean Purchase",
"version": "18.0.1.0.0",
"category": "Localization/Argentina",
"sequence": 14,
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"summary": "",
"depends": [
"purchase",
"l10n_ar",
],
'external_dependencies': {
},
'data': [
'views/purchase_report_templates.xml',
"external_dependencies": {},
"data": [
"views/purchase_report_templates.xml",
],
'demo': [
],
'installable': True,
'auto_install': False,
'application': False,
"demo": [],
"installable": True,
"auto_install": False,
"application": False,
}
10 changes: 5 additions & 5 deletions l10n_ar_purchase/models/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ class PurchaseOrder(models.Model):
_inherit = "purchase.order"

def _get_name_purchase_report(self, report_xml_id):
""" Method similar to the '_get_name_invoice_report' of l10n_latam_invoice_document
"""Method similar to the '_get_name_invoice_report' of l10n_latam_invoice_document
Basically it allows different localizations to define it's own report
This method should actually go in a sale_ux module that later can be extended by different localizations
Another option would be to use report_substitute module and setup a subsitution with a domain
"""
self.ensure_one()
if self.company_id.country_id.code == 'AR':
if report_xml_id == 'purchase.report_purchasequotation_document':
return 'l10n_ar_purchase.report_purchasequotation_document'
if self.company_id.country_id.code == "AR":
if report_xml_id == "purchase.report_purchasequotation_document":
return "l10n_ar_purchase.report_purchasequotation_document"
else:
return 'l10n_ar_purchase.report_purchaseorder_document'
return "l10n_ar_purchase.report_purchaseorder_document"
return report_xml_id
38 changes: 18 additions & 20 deletions l10n_ar_purchase_stock/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
{
'name': 'Argentinian Purchase Stock',
'version': "18.0.1.0.0",
'category': 'Localization/Argentina',
'sequence': 14,
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'summary': '',
'depends': [
'purchase_stock',
'l10n_ar_purchase',
"name": "Argentinian Purchase Stock",
"version": "18.0.1.0.0",
"category": "Localization/Argentina",
"sequence": 14,
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"summary": "",
"depends": [
"purchase_stock",
"l10n_ar_purchase",
],
'external_dependencies': {
},
'data': [
'views/purchase_report_templates.xml',
"external_dependencies": {},
"data": [
"views/purchase_report_templates.xml",
],
'demo': [
],
'installable': True,
'auto_install': True,
'application': False,
"demo": [],
"installable": True,
"auto_install": True,
"application": False,
}
14 changes: 9 additions & 5 deletions l10n_ar_tax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,31 @@
from . import wizard
from odoo.addons.l10n_ar_withholding.models.account_payment import AccountPayment
import logging

_logger = logging.getLogger(__name__)


def monkey_patch_synchronize_to_moves():

def _synchronize_to_moves(self, changed_fields):
return super(AccountPayment, self)._synchronize_to_moves(changed_fields)

AccountPayment._synchronize_to_moves = _synchronize_to_moves


def _l10n_ar_update_taxes(env):
""" Al instalar este módulo, en caso de que existan compañías responsable inscripto argentinas y con plan de cuentas
"""Al instalar este módulo, en caso de que existan compañías responsable inscripto argentinas y con plan de cuentas
ajustamos ciertos datos de los impuestos
TODO la mayoria de esto deberia implementarse en odoo standard
"""

# si tiene instalado chart ri o exento le actualizamos impuestos
companies = env['res.company'].search([('chart_template', 'in', ('ar_base', 'ar_ri', 'ar_ex'))])
companies = env["res.company"].search([("chart_template", "in", ("ar_base", "ar_ri", "ar_ex"))])
for company in companies:
env['account.chart.template']._add_wh_taxes(company)
env["account.chart.template"]._add_wh_taxes(company)

# Dejamos registro en los logs de las compañías en las cuales se estableció el código de impuesto
if companies:
_logger.info("Se agregaron los códigos de impuestos correspondientes para retenciones de ganancias aplicadas y retenciones de iva aplicadas y las etiquetas de impuestos para compañías %s." % ', '.join(companies.mapped('name')))
_logger.info(
"Se agregaron los códigos de impuestos correspondientes para retenciones de ganancias aplicadas y retenciones de iva aplicadas y las etiquetas de impuestos para compañías %s."
% ", ".join(companies.mapped("name"))
)
72 changes: 36 additions & 36 deletions l10n_ar_tax/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,44 +18,44 @@
#
##############################################################################
{
'name': 'Automatic Argentinian Withholdings on Payments',
'version': "18.0.1.2.0",
'author': 'ADHOC SA,Odoo Community Association (OCA)',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'category': 'Accounting & Finance',
'data': [
'security/ir.model.access.csv',
'views/report_withholding_certificate_templates.xml',
'views/account_payment_view.xml',
'views/res_company_jurisdiction_padron_view.xml',
'views/res_partner_view.xml',
'views/account_tax_view.xml',
'views/report_payment_receipt_templates.xml',
'views/l10n_ar_payment_withholding_views.xml',
'views/account_fiscal_position_view.xml',
'wizard/account_payment_register_views.xml',
'wizard/res_config_settings_views.xml',
"name": "Automatic Argentinian Withholdings on Payments",
"version": "18.0.1.2.0",
"author": "ADHOC SA,Odoo Community Association (OCA)",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"category": "Accounting & Finance",
"data": [
"security/ir.model.access.csv",
"views/report_withholding_certificate_templates.xml",
"views/account_payment_view.xml",
"views/res_company_jurisdiction_padron_view.xml",
"views/res_partner_view.xml",
"views/account_tax_view.xml",
"views/report_payment_receipt_templates.xml",
"views/l10n_ar_payment_withholding_views.xml",
"views/account_fiscal_position_view.xml",
"wizard/account_payment_register_views.xml",
"wizard/res_config_settings_views.xml",
],
'demo': [
'demo/ir_parameter.xml',
'demo/account_fiscal_position_demo.xml',
'demo/account_tax_demo.xml',
'demo/res_partner_demo.xml',
'demo/account_move_demo.xml',
"demo": [
"demo/ir_parameter.xml",
"demo/account_fiscal_position_demo.xml",
"demo/account_tax_demo.xml",
"demo/res_partner_demo.xml",
"demo/account_move_demo.xml",
],
'depends': [
'l10n_ar',
'l10n_ar_ux',
'l10n_ar_withholding',
'account_payment_pro',
'l10n_latam_check_ux', # para reporte de pagos/recibos
"depends": [
"l10n_ar",
"l10n_ar_ux",
"l10n_ar_withholding",
"account_payment_pro",
"l10n_latam_check_ux", # para reporte de pagos/recibos
],
'external_dependencies': {
'python': ['pyafipws'],
"external_dependencies": {
"python": ["pyafipws"],
},
'installable': True,
'auto_install': ['l10n_ar'],
'post_load': 'monkey_patch_synchronize_to_moves',
'post_init_hook': '_l10n_ar_update_taxes',
"installable": True,
"auto_install": ["l10n_ar"],
"post_load": "monkey_patch_synchronize_to_moves",
"post_init_hook": "_l10n_ar_update_taxes",
}
Loading

0 comments on commit 99e05a0

Please sign in to comment.