Skip to content

Commit

Permalink
[IMP] *: pre-commit automatic fixes (pre-commit run -a)
Browse files Browse the repository at this point in the history
  • Loading branch information
ced-adhoc committed Jan 27, 2025
1 parent ad3209b commit 4d056d2
Show file tree
Hide file tree
Showing 28 changed files with 650 additions and 628 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
17 changes: 12 additions & 5 deletions purchase_catalog_tree/models/ir_model_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from odoo import api, models, exceptions, _
from odoo import api, models


class IrModelAccess(models.Model):
_inherit = 'ir.model.access'
_inherit = "ir.model.access"

@api.model
def check(self, model, mode='read', raise_exception=True):
def check(self, model, mode="read", raise_exception=True):
if isinstance(model, models.BaseModel):
assert model._name == 'ir.model', 'Invalid model object'
assert model._name == "ir.model", "Invalid model object"
# model_name was not used, so we can omit its assignment:
# model_name = model.model
# else:
# model_name = model
# we need to use this flag to know when the operation is from this modules
if self._context.get('sale_quotation_products') or self._context.get('purchase_catalog_tree') or self.env.is_superuser():
if (
self._context.get("sale_quotation_products")
or self._context.get("purchase_catalog_tree")
or self.env.is_superuser()
):
return True
37 changes: 18 additions & 19 deletions purchase_global_discount/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@
#
##############################################################################
{
'name': 'Purchase Global Discount',
'version': "18.0.1.0.0",
'category': 'Purchase Management',
'sequence': 14,
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'summary': '',
'depends': [
'purchase',
"name": "Purchase Global Discount",
"version": "18.0.1.0.0",
"category": "Purchase Management",
"sequence": 14,
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"summary": "",
"depends": [
"purchase",
],
'external_dependencies': {
},
'data': [
'security/ir.model.access.csv',
'wizard/purchase_global_discount_wizard_view.xml',
'views/purchase_order_views.xml',
"external_dependencies": {},
"data": [
"security/ir.model.access.csv",
"wizard/purchase_global_discount_wizard_view.xml",
"views/purchase_order_views.xml",
],
'installable': True,
'auto_install': False,
'application': False,
"installable": True,
"auto_install": False,
"application": False,
}
2 changes: 1 addition & 1 deletion purchase_global_discount/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_purchase_order_global_discount_wizard,access_purchase_order_global_discount_wizard,model_purchase_order_global_discount_wizard,purchase.group_purchase_user,1,1,1,0
access_purchase_order_global_discount_wizard,access_purchase_order_global_discount_wizard,model_purchase_order_global_discount_wizard,purchase.group_purchase_user,1,1,1,0
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
from odoo import fields, models


class PurchaseGlobalDiscountWizard(models.TransientModel):
_name = "purchase.order.global_discount.wizard"
_description = "Transient model to apply global discounts on POs"

amount = fields.Float(
'Discount',
"Discount",
required=True,
)

def confirm(self):
self.ensure_one()
order = self.env['purchase.order'].browse(self._context.get('active_id', False))
order.order_line.write({'discount': self.amount})
order = self.env["purchase.order"].browse(self._context.get("active_id", False))
order.order_line.write({"discount": self.amount})
return True
33 changes: 16 additions & 17 deletions purchase_order_line_number/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,22 @@
#
##############################################################################
{
'name': 'Purchase Order Line Number',
'version': "18.0.1.0.0",
'category': 'Purchase',
'sequence': 14,
'summary': 'Add line numbers to purchase orders for better control and communication',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
"name": "Purchase Order Line Number",
"version": "18.0.1.0.0",
"category": "Purchase",
"sequence": 14,
"summary": "Add line numbers to purchase orders for better control and communication",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"purchase",
],
'depends': [
'purchase',
"data": [
"views/purchase_order_views.xml",
],
'data': [
'views/purchase_order_views.xml',
],
'installable': True,
'auto_install': False,
'application': False,
"installable": True,
"auto_install": False,
"application": False,
}
10 changes: 4 additions & 6 deletions purchase_order_line_number/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,22 @@
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields
from odoo import fields, models


class PurchaseOrderLine(models.Model):

_inherit = 'purchase.order.line'
_inherit = "purchase.order.line"

number = fields.Integer(
compute='_compute_get_number',
compute="_compute_get_number",
)

def _compute_get_number(self):
self.number = False
if self and not isinstance(self[0].id, int):
return
for order in self.mapped('order_id'):
for order in self.mapped("order_id"):
number = 1
for line in order.order_line.sorted("sequence"):
line.number = number
number += 1

36 changes: 17 additions & 19 deletions purchase_request_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,24 @@
#
##############################################################################
{
'name': 'Purchase Request UX',
'version': "18.0.1.0.0",
'category': 'Purchases',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
"name": "Purchase Request UX",
"version": "18.0.1.0.0",
"category": "Purchases",
"sequence": 14,
"summary": "",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"purchase_request",
],
'depends': [
'purchase_request',
],
'data': [
"data": [
"security/purchase_request.xml",
'views/purchase_request_views.xml',
],
'demo': [
"views/purchase_request_views.xml",
],
'installable': True,
'auto_install': False,
'application': False,
"demo": [],
"installable": True,
"auto_install": False,
"application": False,
}
9 changes: 4 additions & 5 deletions purchase_request_ux/models/purchase_request.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from odoo import api, fields, models
from odoo.exceptions import UserError
from odoo import fields, models

class PurchaseRequest(models.Model):

_inherit = 'purchase.request'
class PurchaseRequest(models.Model):
_inherit = "purchase.request"

is_user_id = fields.Boolean(compute='_compute_current_user_id')
is_user_id = fields.Boolean(compute="_compute_current_user_id")

def _compute_current_user_id(self):
for rec in self:
Expand Down
47 changes: 22 additions & 25 deletions purchase_stock_ux/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,28 @@
#
##############################################################################
{
'name': 'Purchase Stock UX',
'version': "18.0.1.0.0",
'category': 'Purchases',
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'images': [
"name": "Purchase Stock UX",
"version": "18.0.1.0.0",
"category": "Purchases",
"sequence": 14,
"summary": "",
"author": "ADHOC SA",
"website": "www.adhoc.com.ar",
"license": "AGPL-3",
"images": [],
"depends": [
"purchase_ux",
"purchase_stock",
"stock_ux",
],
'depends': [
'purchase_ux',
'purchase_stock',
'stock_ux',

"data": [
"views/purchase_order_views.xml",
"views/purchase_line_views.xml",
"views/stock_move_views.xml",
"wizards/res_config_settings_views.xml",
],
'data': [
'views/purchase_order_views.xml',
'views/purchase_line_views.xml',
'views/stock_move_views.xml',
'wizards/res_config_settings_views.xml',
],
'demo': [
],
'installable': True,
'auto_install': True,
'application': False,
"demo": [],
"installable": True,
"auto_install": True,
"application": False,
}
Loading

0 comments on commit 4d056d2

Please sign in to comment.