Skip to content

Commit

Permalink
[IMP] rma_purchase_analytic: black, isort, prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminSForgeFlow committed Sep 26, 2023
1 parent 88dc486 commit 0ea0a79
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 22 deletions.
1 change: 0 additions & 1 deletion rma_purchase_analytic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import models
Expand Down
11 changes: 4 additions & 7 deletions rma_purchase_analytic/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# -*- coding: utf-8 -*-
# © 2017 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Analytic Account in RMA purchase",
"version": "10.0.1.0.0",
"author": "Eficent,"
"Odoo Community Association (OCA)",
"author": "Eficent," "Odoo Community Association (OCA)",
"license": "LGPL-3",
"website": "http://www.eficent.com",
"website": "https://github.com/ForgeFlow/stock-rma",
"category": "Analytic",
"depends": ["rma_account", "rma_analytic", "purchase_analytic"],
"data": [
],
'installable': True,
"data": [],
"installable": True,
}
1 change: 0 additions & 1 deletion rma_purchase_analytic/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

from . import purchase_order_line
13 changes: 7 additions & 6 deletions rma_purchase_analytic/models/purchase_order_line.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2018 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

Expand All @@ -8,11 +7,13 @@
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"

@api.constrains('account_analytic_id')
@api.constrains("account_analytic_id")
def check_analytic(self):
for line in self.filtered(lambda p: p.rma_line_id):
if (line.account_analytic_id !=
line.rma_line_id.analytic_account_id):
if line.account_analytic_id != line.rma_line_id.analytic_account_id:
raise exceptions.ValidationError(
_("The analytic account in the PO line it's not the same"
" as in the rma line"))
_(
"The analytic account in the PO line it's not the same"
" as in the rma line"
)
)
1 change: 0 additions & 1 deletion rma_purchase_analytic/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# © 2018 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

Expand Down
11 changes: 5 additions & 6 deletions rma_purchase_analytic/wizards/rma_add_purchase.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*-
# © 2018 Eficent Business and IT Consulting Services S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)

from odoo import api, models


class RmaAddPurchase(models.TransientModel):
_inherit = 'rma_add_purchase'
_inherit = "rma_add_purchase"

@api.model
def _prepare_rma_line_from_po_line(self, line):
Expand All @@ -21,8 +20,8 @@ class RmaLineMakePurchaseOrder(models.TransientModel):

@api.model
def _prepare_purchase_order_line(self, po, item):
res = super(
RmaLineMakePurchaseOrder, self)._prepare_purchase_order_line(
po, item)
res['account_analytic_id'] = item.line_id.analytic_account_id.id
res = super(RmaLineMakePurchaseOrder, self)._prepare_purchase_order_line(
po, item
)
res["account_analytic_id"] = item.line_id.analytic_account_id.id
return res
1 change: 1 addition & 0 deletions setup/rma_purchase_analytic/odoo/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions setup/rma_purchase_analytic/odoo/addons/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
6 changes: 6 additions & 0 deletions setup/rma_purchase_analytic/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit 0ea0a79

Please sign in to comment.