From 3623a6b5c8d66237f74a9b602ce71b9e029972fb Mon Sep 17 00:00:00 2001 From: Andhitia Rama Date: Mon, 11 Apr 2022 15:40:45 +0700 Subject: [PATCH 1/2] [fixed_asset] 11.0.2.1.0 * Add wizard to mass depreciation --- fixed_asset/__init__.py | 1 + fixed_asset/__manifest__.py | 3 +- fixed_asset/wizards/__init__.py | 7 +++ fixed_asset/wizards/mass_depreciation.py | 41 ++++++++++++++++++ .../wizards/mass_depreciation_views.xml | 43 +++++++++++++++++++ 5 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 fixed_asset/wizards/__init__.py create mode 100644 fixed_asset/wizards/mass_depreciation.py create mode 100644 fixed_asset/wizards/mass_depreciation_views.xml diff --git a/fixed_asset/__init__.py b/fixed_asset/__init__.py index d46542b..30c8bb2 100644 --- a/fixed_asset/__init__.py +++ b/fixed_asset/__init__.py @@ -4,4 +4,5 @@ from . import ( models, + wizards, ) diff --git a/fixed_asset/__manifest__.py b/fixed_asset/__manifest__.py index f078204..c64803e 100644 --- a/fixed_asset/__manifest__.py +++ b/fixed_asset/__manifest__.py @@ -3,7 +3,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Fixed Asset", - "version": "11.0.2.0.3", + "version": "11.0.2.1.0", "category": "Accounting & Finance", "website": "https://simetri-sinergi.id", "author": "PT. Simetri Sinergi Indonesia, OpenSynergy Indonesia", @@ -31,6 +31,7 @@ "menu.xml", "data/ir_sequence_data.xml", "data/sequence_template_data.xml", + "wizards/mass_depreciation_views.xml", "views/fixed_asset_config_setting_views.xml", "views/fixed_asset_category.xml", "views/account_account_view.xml", diff --git a/fixed_asset/wizards/__init__.py b/fixed_asset/wizards/__init__.py new file mode 100644 index 0000000..39b3012 --- /dev/null +++ b/fixed_asset/wizards/__init__.py @@ -0,0 +1,7 @@ +# Copyright 2022 OpenSynergy Indonesia +# Copyright 2022 PT. Simetri Sinergi Indonesia +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import ( + mass_depreciation, +) diff --git a/fixed_asset/wizards/mass_depreciation.py b/fixed_asset/wizards/mass_depreciation.py new file mode 100644 index 0000000..c333a96 --- /dev/null +++ b/fixed_asset/wizards/mass_depreciation.py @@ -0,0 +1,41 @@ +# Copyright 2022 OpenSynergy Indonesia +# Copyright 2022 PT. Simetri Sinergi Indonesia +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class AccountMassDepreciation(models.TransientModel): + _name = "account.mass_depreciation" + _description = "Mass Depreciation" + + category_ids = fields.Many2many( + string="Categories", + comodel_name="fixed.asset.category", + ) + date = fields.Date( + string="Date Depreciation", + required=True, + ) + + @api.multi + def action_confirm(self): + for wizard in self: + wizard._mass_depreciate() + + @api.multi + def _mass_depreciate(self): + self.ensure_one() + obj_line = self.env["fixed.asset.depreciation.line"] + criteria = [ + ("asset_id.state", "=", "open"), + ("type", "=", "depreciate"), + ("init_entry", "=", False), + ("move_id", "=", False), + ("line_date", "=", self.date), + ] + if self.category_ids: + criteria.append(("asset_id.category_id", "in", self.category_ids.ids)) + + for line in obj_line.search(criteria): + line.create_move() diff --git a/fixed_asset/wizards/mass_depreciation_views.xml b/fixed_asset/wizards/mass_depreciation_views.xml new file mode 100644 index 0000000..6878943 --- /dev/null +++ b/fixed_asset/wizards/mass_depreciation_views.xml @@ -0,0 +1,43 @@ + + + + + Mass Depreciation + account.mass_depreciation + +
+ + + + +
+
+
+
+
+ + + Mass Depreciation + account.mass_depreciation + form + + new + + + + +
From 87f6ca688ea09d4eff50a6a9a66c505d85bd1c49 Mon Sep 17 00:00:00 2001 From: Andhitia Rama Date: Mon, 11 Apr 2022 16:11:24 +0700 Subject: [PATCH 2/2] copier copy --- .copier-answers.yml | 14 ++++++++++++++ .eslintrc.yml | 3 ++- .flake8 | 2 +- .gitignore | 20 ++++++++++++++++++-- .isort.cfg | 1 + .pre-commit-config.yaml | 2 +- .travis.yml | 13 ++++--------- CONTRIBUTING.md | 4 +++- LICENSE | 12 ++++++------ README.md | 33 +++++++++++++++++++++++++++++++++ 10 files changed, 83 insertions(+), 21 deletions(-) create mode 100644 .copier-answers.yml diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..767f4ba --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,14 @@ +# Do NOT update manually; changes here will be overwritten by Copier +_commit: edb24fc +_src_path: gh:open-synergy/ssi-addons-repo-template +dependency_installation_mode: OCA +generate_requirements_txt: true +include_aeroo_report: false +include_wkhtmltopdf: false +odoo_version: 11.0 +rebel_module_groups: [] +repo_description: null +repo_name: opnsynid-fixed-asset +repo_slug: opnsynid-fixed-asset +travis_apt_packages: [] +travis_apt_sources: [] diff --git a/.eslintrc.yml b/.eslintrc.yml index 88f2881..16a185f 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -1,5 +1,6 @@ env: browser: true + es6: true # See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449 parserOptions: @@ -14,7 +15,7 @@ globals: moment: readonly odoo: readonly openerp: readonly - Promise: readonly + owl: readonly # Styling is handled by Prettier, so we only need to enable AST rules; # see https://github.com/OCA/maintainer-quality-tools/pull/618#issuecomment-558576890 diff --git a/.flake8 b/.flake8 index 44ed868..638a9cd 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,5 @@ [flake8] -max-line-length = 80 +max-line-length = 88 max-complexity = 16 # B = bugbear # B9 = bugbear opinionated (incl line length) diff --git a/.gitignore b/.gitignore index f7f8a40..818770f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] +/.venv +/.pytest_cache # C extensions *.so @@ -21,6 +23,7 @@ var/ *.egg-info/ .installed.cfg *.egg +*.eggs # Installer logs pip-log.txt @@ -40,6 +43,19 @@ coverage.xml # Pycharm .idea +# Eclipse +.settings + +# Visual Studio cache/options directory +.vs/ +.vscode + +# OSX Files +.DS_Store + +# Django stuff: +*.log + # Mr Developer .mr.developer.cfg .project @@ -55,5 +71,5 @@ docs/_build/ *~ *.swp -# OSX Files -*.DS_Store +# OCA rules +!static/lib/ diff --git a/.isort.cfg b/.isort.cfg index 7683bad..0ec187e 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -10,3 +10,4 @@ known_odoo=odoo known_odoo_addons=odoo.addons sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER default_section=THIRDPARTY +ensure_newline_before_comments = True diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab221c7..2fafa81 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -38,7 +38,7 @@ repos: - id: autoflake args: ["-i", "--ignore-init-module-imports"] - repo: https://github.com/psf/black - rev: 21.7b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier diff --git a/.travis.yml b/.travis.yml index 42f06bb..55eebc5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ cache: python: - "3.5" - dist: trusty addons: @@ -16,23 +15,19 @@ addons: - expect-dev # provides unbuffer utility stages: - - linting - test jobs: include: - - stage: linting - name: "linting" - env: - - LINT_CHECK="1" - - stage: test env: - TESTS=1 ODOO_REPO="odoo/odoo" MAKEPOT="1" + - stage: test + env: + - TESTS=1 ODOO_REPO="OCA/OCB" env: global: - - VERSION="11.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0" - - WKHTMLTOPDF_VERSION="0.12.5" + - VERSION="11.0" TESTS="0" LINT_CHECK="0" MAKEPOT="1" install: - git clone --depth=1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8f7056a..9ac71fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,8 +1,10 @@ # OCA Guidelines Please follow the official guide from the -[OCA Guidelines page](https://github.com/OCA/maintainer-tools/blob/master/CONTRIBUTING.md). +[OCA Guidelines page](https://odoo-community.org/page/contributing). ## Project Specific Guidelines + + This project does not have specific coding guidelines. diff --git a/LICENSE b/LICENSE index 3ffc567..be3f7b2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ -GNU AFFERO GENERAL PUBLIC LICENSE + GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -643,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. @@ -658,4 +658,4 @@ specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see -. \ No newline at end of file +. diff --git a/README.md b/README.md index 6701b37..8c76654 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,35 @@ [![Build Status](https://travis-ci.com/open-synergy/opnsynid-fixed-asset.svg?branch=11.0)](https://travis-ci.com/open-synergy/opnsynid-fixed-asset) +![pre-commit](https://github.com/open-synergy/opnsynid-fixed-asset/actions/workflows/pre-commit.yml/badge.svg) [![codecov](https://codecov.io/gh/open-synergy/opnsynid-fixed-asset/branch/11.0/graph/badge.svg)](https://codecov.io/gh/open-synergy/opnsynid-fixed-asset) + + + +# opnsynid-fixed-asset + +None + + + + + +[//]: # (addons) + +This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools. + +[//]: # (end addons) + + + +## Licenses + +This repository is licensed under [AGPL-3.0](LICENSE). + +However, each module can have a totally different license, as long as they adhere to OCA +policy. Consult each module's `__manifest__.py` file, which contains a `license` key +that explains its license. + +---- + +OCA, or the [Odoo Community Association](http://odoo-community.org/), is a nonprofit +organization whose mission is to support the collaborative development of Odoo features +and promote its widespread use.