Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fixed_asset] 11.0.2.1.0 #81

Open
wants to merge 2 commits into
base: 11.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -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: []
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
env:
browser: true
es6: true

# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
max-line-length = 80
max-line-length = 88
max-complexity = 16
# B = bugbear
# B9 = bugbear opinionated (incl line length)
Expand Down
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
/.venv
/.pytest_cache

# C extensions
*.so
Expand All @@ -21,6 +23,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
*.eggs

# Installer logs
pip-log.txt
Expand All @@ -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
Expand All @@ -55,5 +71,5 @@ docs/_build/
*~
*.swp

# OSX Files
*.DS_Store
# OCA rules
!static/lib/
1 change: 1 addition & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 4 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ cache:

python:
- "3.5"

dist: trusty

addons:
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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

<!-- /!\ do not modify above this line -->

This project does not have specific coding guidelines.
12 changes: 6 additions & 6 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>

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,
Expand All @@ -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 <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

Expand All @@ -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
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)

<!-- /!\ do not modify above this line -->

# opnsynid-fixed-asset

None

<!-- /!\ do not modify below this line -->

<!-- prettier-ignore-start -->

[//]: # (addons)

This part will be replaced when running the oca-gen-addons-table script from OCA/maintainer-tools.

[//]: # (end addons)

<!-- prettier-ignore-end -->

## 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.
1 change: 1 addition & 0 deletions fixed_asset/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

from . import (
models,
wizards,
)
3 changes: 2 additions & 1 deletion fixed_asset/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 7 additions & 0 deletions fixed_asset/wizards/__init__.py
Original file line number Diff line number Diff line change
@@ -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,
)
41 changes: 41 additions & 0 deletions fixed_asset/wizards/mass_depreciation.py
Original file line number Diff line number Diff line change
@@ -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()
43 changes: 43 additions & 0 deletions fixed_asset/wizards/mass_depreciation_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>

<record id="account_mass_depreciation_view_form" model="ir.ui.view">
<field name="name">Mass Depreciation</field>
<field name="model">account.mass_depreciation</field>
<field name="arch" type="xml">
<form>
<group name="group_1" colspan="4" col="2">
<field name="category_ids" widget="many2many_tags" />
<field name="date" />
</group>
<footer>
<button
string="Confirm"
name="action_confirm"
type="object"
class="oe_highlight"
confirm="Are you sure?"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
</form>
</field>
</record>

<record id="account_mass_depreciation_action" model="ir.actions.act_window">
<field name="name">Mass Depreciation</field>
<field name="res_model">account.mass_depreciation</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_mass_depreciation_view_form" />
<field name="target">new</field>
</record>

<menuitem
id="menu_mass_depreciation_action"
parent="fixed_asset.menu_finance_assets"
action="account_mass_depreciation_action"
sequence="99"
/>

</odoo>