Merge pull request #135 from Tecnativa/13.0-apply-copier

[13.0] Apply copier
This commit is contained in:
Pedro M. Baeza
2021-02-22 15:44:21 +01:00
committed by GitHub
25 changed files with 651 additions and 265 deletions

13
.copier-answers.yml Normal file
View File

@@ -0,0 +1,13 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.1.3
_src_path: https://github.com/OCA/oca-addons-repo-template.git
dependency_installation_mode: OCA
generate_requirements_txt: true
include_wkhtmltopdf: false
odoo_version: 13.0
rebel_module_groups: []
repo_description: Reports for the Odoo Logistics modules
repo_name: Odoo Stock Logistics Reporting
repo_slug: stock-logistics-reporting
travis_apt_packages: []
travis_apt_sources: []

View File

@@ -7,11 +7,11 @@ indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[.eslintrc,*.{json,yml,yaml,rst,md}]
[*.{json,yml,yaml,rst,md}]
indent_size = 2
# Do not configure editor for libs and autogenerated content
[*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst]
[{*/static/{lib,src/lib}/**,*/static/description/index.html,*/readme/../README.rst}]
charset = unset
end_of_line = unset
indent_size = unset

180
.eslintrc.yml Normal file
View File

@@ -0,0 +1,180 @@
env:
browser: true
# See https://github.com/OCA/odoo-community.org/issues/37#issuecomment-470686449
parserOptions:
ecmaVersion: 2017
# Globals available in Odoo that shouldn't produce errorings
globals:
_: readonly
$: readonly
fuzzy: readonly
jQuery: readonly
moment: readonly
odoo: readonly
openerp: readonly
Promise: 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
rules:
accessor-pairs: warn
array-callback-return: warn
callback-return: warn
capitalized-comments:
- warn
- always
- ignoreConsecutiveComments: true
ignoreInlineComments: true
complexity:
- warn
- 15
constructor-super: warn
dot-notation: warn
eqeqeq: warn
global-require: warn
handle-callback-err: warn
id-blacklist: warn
id-match: warn
init-declarations: error
max-depth: warn
max-nested-callbacks: warn
max-statements-per-line: warn
no-alert: warn
no-array-constructor: warn
no-caller: warn
no-case-declarations: warn
no-class-assign: warn
no-cond-assign: error
no-const-assign: error
no-constant-condition: warn
no-control-regex: warn
no-debugger: error
no-delete-var: warn
no-div-regex: warn
no-dupe-args: error
no-dupe-class-members: error
no-dupe-keys: error
no-duplicate-case: error
no-duplicate-imports: error
no-else-return: warn
no-empty-character-class: warn
no-empty-function: error
no-empty-pattern: error
no-empty: warn
no-eq-null: error
no-eval: error
no-ex-assign: error
no-extend-native: warn
no-extra-bind: warn
no-extra-boolean-cast: warn
no-extra-label: warn
no-fallthrough: warn
no-func-assign: error
no-global-assign: error
no-implicit-coercion:
- warn
- allow: ["~"]
no-implicit-globals: warn
no-implied-eval: warn
no-inline-comments: warn
no-inner-declarations: warn
no-invalid-regexp: warn
no-irregular-whitespace: warn
no-iterator: warn
no-label-var: warn
no-labels: warn
no-lone-blocks: warn
no-lonely-if: error
no-mixed-requires: error
no-multi-str: warn
no-native-reassign: error
no-negated-condition: warn
no-negated-in-lhs: error
no-new-func: warn
no-new-object: warn
no-new-require: warn
no-new-symbol: warn
no-new-wrappers: warn
no-new: warn
no-obj-calls: warn
no-octal-escape: warn
no-octal: warn
no-param-reassign: warn
no-path-concat: warn
no-process-env: warn
no-process-exit: warn
no-proto: warn
no-prototype-builtins: warn
no-redeclare: warn
no-regex-spaces: warn
no-restricted-globals: warn
no-restricted-imports: warn
no-restricted-modules: warn
no-restricted-syntax: warn
no-return-assign: error
no-script-url: warn
no-self-assign: warn
no-self-compare: warn
no-sequences: warn
no-shadow-restricted-names: warn
no-shadow: warn
no-sparse-arrays: warn
no-sync: warn
no-this-before-super: warn
no-throw-literal: warn
no-undef-init: warn
no-undef: error
no-unmodified-loop-condition: warn
no-unneeded-ternary: error
no-unreachable: error
no-unsafe-finally: error
no-unused-expressions: error
no-unused-labels: error
no-unused-vars: error
no-use-before-define: error
no-useless-call: warn
no-useless-computed-key: warn
no-useless-concat: warn
no-useless-constructor: warn
no-useless-escape: warn
no-useless-rename: warn
no-void: warn
no-with: warn
operator-assignment: [error, always]
prefer-const: warn
radix: warn
require-yield: warn
sort-imports: warn
spaced-comment: [error, always]
strict: [error, function]
use-isnan: error
valid-jsdoc:
- warn
- prefer:
arg: param
argument: param
augments: extends
constructor: class
exception: throws
func: function
method: function
prop: property
return: returns
virtual: abstract
yield: yields
preferType:
array: Array
bool: Boolean
boolean: Boolean
number: Number
object: Object
str: String
string: String
requireParamDescription: false
requireReturn: false
requireReturnDescription: false
requireReturnType: false
valid-typeof: warn
yoda: warn

13
.github/workflows/pre-commit.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: pre-commit
on:
pull_request:
push:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.0

20
.gitignore vendored
View File

@@ -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
# Visual Studio cache/options directory
.vs/
# OCA rules
!static/lib/

View File

@@ -9,4 +9,4 @@ line_length=88
known_odoo=odoo
known_odoo_addons=odoo.addons
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
known_third_party=setuptools
default_section=THIRDPARTY

View File

@@ -1,69 +1,128 @@
exclude: "^setup/|/static/lib/|/static/src/lib/"
exclude: |
(?x)
# NOT INSTALLABLE ADDONS
# END NOT INSTALLABLE ADDONS
# Files and folders generated by bots, to avoid loops
^setup/|/static/description/index\.html$|
# We don't want to mess with tool-generated files
.svg$|
# Maybe reactivate this when all README files include prettier ignore tags?
^README\.md$|
# Library files can have extraneous formatting (even minimized)
/static/(src/)?lib/|
# Repos using Sphinx to generate docs don't need prettying
^docs/_templates/.*\.html$|
# You don't usually want a bot to modify your legal texts
(LICENSE.*|COPYING.*)
default_language_version:
python: python3
node: "14.13.0"
repos:
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.3.1
hooks:
- id: pylint
name: pylint with optional checks
args: ["--rcfile=.pylintrc", "--exit-zero"]
verbose: true
additional_dependencies: ["pylint-odoo==3.0.3"]
- id: pylint
name: pylint with mandatory checks
args: ["--rcfile=.pylintrc-mandatory"]
additional_dependencies: ["pylint-odoo==3.0.3"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.0
hooks:
- id: pyupgrade
- repo: https://github.com/asottile/seed-isort-config
rev: v1.9.3
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v6.5.1
hooks:
- id: eslint
verbose: true
- repo: local
hooks:
# These files are most likely copier diff rejection junks; if found,
# review them manually, fix the problem (if needed) and remove them
- id: forbidden-files
name: forbidden files
entry: found forbidden files; remove them
language: fail
files: "\\.rej$"
- repo: https://github.com/oca/maintainer-tools
rev: ab1d7f6
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
- id: oca-fix-manifest-website
args: ["https://github.com/OCA/stock-logistics-reporting"]
- repo: https://github.com/myint/autoflake
rev: v1.4
hooks:
- id: autoflake
args: ["-i", "--ignore-init-module-imports"]
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v1.19.1
hooks:
- id: prettier
name: prettier (with plugin-xml)
entry: prettier --write --list-different
additional_dependencies:
- "prettier@1.19.1"
- "@prettier/plugin-xml@0.7.2"
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v6.8.0
hooks:
- id: eslint
verbose: true
args:
- --color
- --fix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: end-of-file-fixer
# exclude autogenerated files
exclude: /README\.rst$|\.pot?$
- id: debug-statements
- id: fix-encoding-pragma
args: ["--remove"]
- id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
# exclude files where underlines are not distinguishable from merge conflicts
exclude: /README\.rst$|^docs/.*\.rst$
- id: check-symlinks
- id: check-xml
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/asottile/pyupgrade
rev: v1.26.2
hooks:
- id: pyupgrade
args: ["--keep-percent-format"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
name: isort except __init__.py
exclude: /__init__\.py$
- repo: https://github.com/acsone/setuptools-odoo
rev: 2.5.2
hooks:
- id: setuptools-odoo-make-default
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
hooks:
- id: flake8
name: flake8 except __init__.py
exclude: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- id: flake8
name: flake8 only __init__.py
args: ["--extend-ignore=F401"] # ignore unused imports in __init__.py
files: /__init__\.py$
additional_dependencies: ["flake8-bugbear==19.8.0"]
- repo: https://github.com/pre-commit/mirrors-pylint
rev: v2.5.3
hooks:
- id: pylint
name: pylint with optional checks
args:
- --rcfile=.pylintrc
- --exit-zero
verbose: true
additional_dependencies: &pylint_deps
- pylint-odoo==3.5.0
- id: pylint
name: pylint with mandatory checks
args:
- --rcfile=.pylintrc-mandatory
additional_dependencies: *pylint_deps

8
.prettierrc.yml Normal file
View File

@@ -0,0 +1,8 @@
# Defaults for all prettier-supported languages.
# Prettier will complete this with settings from .editorconfig file.
bracketSpacing: false
printWidth: 88
proseWrap: always
semi: true
trailingComma: "es5"
xmlWhitespaceSensitivity: "strict"

View File

@@ -46,8 +46,6 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
@@ -73,6 +71,7 @@ enable=anomalous-backslash-in-string,
deprecated-module,
file-not-used,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
@@ -82,6 +81,7 @@ enable=anomalous-backslash-in-string,
too-complex,
unnecessary-utf8-coding-comment
[REPORTS]
msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}
output-format=colorized

View File

@@ -39,8 +39,6 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
missing-import-error,
missing-manifest-dependency,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,

View File

@@ -1,8 +1,8 @@
language: python
cache:
directories:
- $HOME/.cache/pip
- $HOME/.cache/pre-commit
- $HOME/.cache/pip
- $HOME/.cache/pre-commit
python:
- "3.6"
@@ -11,33 +11,26 @@ addons:
postgresql: "9.6"
apt:
packages:
- expect-dev # provides unbuffer utility
- expect-dev # provides unbuffer utility
stages:
- linting
- test
jobs:
include:
- stage: linting
name: "pre-commit"
before_install:
install: pip install pre-commit
script: pre-commit run --all --show-diff-on-failure --verbose --color always
after_success:
- stage: test
env:
- TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1"
- TESTS=1 ODOO_REPO="odoo/odoo" MAKEPOT="1"
- stage: test
env:
- TESTS="1" ODOO_REPO="OCA/OCB"
- TESTS=1 ODOO_REPO="OCA/OCB"
env:
global:
- VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
- VERSION="13.0" TESTS="0" LINT_CHECK="0" MAKEPOT="0"
install:
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git ${HOME}/maintainer-quality-tools
- git clone --depth=1 https://github.com/OCA/maintainer-quality-tools.git
${HOME}/maintainer-quality-tools
- export PATH=${HOME}/maintainer-quality-tools/travis:${PATH}
- travis_install_nightly

10
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,10 @@
# OCA Guidelines
Please follow the official guide from the
[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
LICENSE
View File

@@ -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.
@@ -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,
@@ -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.
@@ -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/>.

View File

@@ -1,9 +1,42 @@
[![Build Status](https://travis-ci.org/OCA/stock-logistics-reporting.svg?branch=13.0)](https://travis-ci.org/OCA/stock-logistics-reporting)
[![Coverage Status](https://coveralls.io/repos/OCA/stock-logistics-reporting/badge.png?branch=13.0)](https://coveralls.io/r/OCA/stock-logistics-reporting?branch=13.0)
[![Runbot Status](https://runbot.odoo-community.org/runbot/badge/flat/151/13.0.svg)](https://runbot.odoo-community.org/runbot/repo/github-com-oca-stock-logistics-reporting-151)
[![Build Status](https://travis-ci.com/OCA/stock-logistics-reporting.svg?branch=13.0)](https://travis-ci.com/OCA/stock-logistics-reporting)
[![codecov](https://codecov.io/gh/OCA/stock-logistics-reporting/branch/13.0/graph/badge.svg)](https://codecov.io/gh/OCA/stock-logistics-reporting)
[![Translation Status](https://translation.odoo-community.org/widgets/stock-logistics-reporting-13-0/-/svg-badge.svg)](https://translation.odoo-community.org/engage/stock-logistics-reporting-13-0/?utm_source=widget)
Odoo Stock Logistics Reporting
==============================
<!-- /!\ do not modify above this line -->
Reports for the Odoo Logistics modules.
# Odoo Stock Logistics Reporting
- Stock Picking Partner Lang: adds possibility to print picking in partner language
Reports for the Odoo Logistics modules
<!-- /!\ do not modify below this line -->
<!-- prettier-ignore-start -->
[//]: # (addons)
Available addons
----------------
addon | version | summary
--- | --- | ---
[stock_card_report](stock_card_report/) | 13.0.1.0.0 | Add stock card report on Inventory Reporting.
[stock_picking_report_valued](stock_picking_report_valued/) | 13.0.1.1.0 | Adding Valued Picking on Delivery Slip report
[stock_quantity_history_location](stock_quantity_history_location/) | 13.0.1.1.0 | Provides stock quantity by location on past date
[//]: # (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.

View File

@@ -1,2 +1,3 @@
# See https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#oca_dependencies-txt
server-ux
reporting-engine

View File

@@ -2,7 +2,7 @@
<record id="paperformat_stock_card" model="report.paperformat">
<field name="name">Stock Card A4</field>
<field name="default" eval="True"/>
<field name="default" eval="True" />
<field name="format">A4</field>
<field name="page_height">0</field>
<field name="page_width">0</field>
@@ -11,7 +11,7 @@
<field name="margin_bottom">28</field>
<field name="margin_left">7</field>
<field name="margin_right">7</field>
<field name="header_line" eval="False"/>
<field name="header_line" eval="False" />
<field name="header_spacing">24</field>
<field name="dpi">90</field>
</record>

View File

@@ -6,21 +6,25 @@
<field name="context" eval="{'active_model': 'report.stock.card.report'}" />
</record>
<report string="Stock Card PDF"
id="action_stock_card_report_pdf"
model="report.stock.card.report"
name="stock_card_report.report_stock_card_report_pdf"
file="stock_card_report.report_stock_card_report_pdf"
report_type="qweb-pdf"
print_report_name="'Stock Card Report - [%s]' % object.location_id.display_name"
paperformat="stock_card_report.paperformat_stock_card"/>
<report
string="Stock Card PDF"
id="action_stock_card_report_pdf"
model="report.stock.card.report"
name="stock_card_report.report_stock_card_report_pdf"
file="stock_card_report.report_stock_card_report_pdf"
report_type="qweb-pdf"
print_report_name="'Stock Card Report - [%s]' % object.location_id.display_name"
paperformat="stock_card_report.paperformat_stock_card"
/>
<report string="Stock Card XLSX"
id="action_stock_card_report_xlsx"
model="report.stock.card.report"
name="stock_card_report.report_stock_card_report_xlsx"
file="Stock Card Report"
report_type="xlsx"
attachment_use="False"/>
<report
string="Stock Card XLSX"
id="action_stock_card_report_xlsx"
model="report.stock.card.report"
name="stock_card_report.report_stock_card_report_xlsx"
file="Stock Card Report"
report_type="xlsx"
attachment_use="False"
/>
</odoo>

View File

@@ -1,26 +1,39 @@
<odoo>
<template id="assets_backend"
name="stock_card_report assets" inherit_id="web.assets_backend">
<template
id="assets_backend"
name="stock_card_report assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<link href="/stock_card_report/static/src/css/report.css" rel="stylesheet"/>
<script type="text/javascript"
src="/stock_card_report/static/src/js/stock_card_report_backend.js"/>
<link
href="/stock_card_report/static/src/css/report.css"
rel="stylesheet"
/>
<script
type="text/javascript"
src="/stock_card_report/static/src/js/stock_card_report_backend.js"
/>
</xpath>
</template>
<template id="stock_card_report.internal_layout">
<div class="article">
<link href="/stock_card_report/static/src/css/report.css" rel="stylesheet"/>
<t t-raw="0"/>
<link
href="/stock_card_report/static/src/css/report.css"
rel="stylesheet"
/>
<t t-raw="0" />
</div>
<div class="footer">
<div class="row">
<div class="col-6 custom_footer">
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"/>
<span
t-esc="context_timestamp(datetime.datetime.now()).strftime('%Y-%m-%d')"
/>
</div>
<div class="col-6 text-right custom_footer">
<span class="page"/>/<span class="topage"/>
<span class="page" />/<span class="topage" />
</div>
</div>
</div>
@@ -28,15 +41,19 @@
<template id="report_buttons">
<div class="button_row">
<button class="o_stock_card_reports_print btn btn-sm oe_button"><span class="fa fa-print"/>Print</button>
<button class="o_stock_card_reports_export btn btn-sm oe_button"><span class="fa fa-download"/>Export</button>
<button class="o_stock_card_reports_print btn btn-sm oe_button"><span
class="fa fa-print"
/>Print</button>
<button class="o_stock_card_reports_export btn btn-sm oe_button"><span
class="fa fa-download"
/>Export</button>
</div>
</template>
<template id="report_stock_card_report_html">
<div class="o_stock_card_reports_page">
<t t-call="stock_card_report.report_buttons"/>
<t t-call="stock_card_report.report_stock_card_report_base"/>
<t t-call="stock_card_report.report_buttons" />
<t t-call="stock_card_report.report_stock_card_report_base" />
</div>
</template>
@@ -44,7 +61,7 @@
<t t-call="web.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="stock_card_report.internal_layout">
<t t-call="stock_card_report.report_stock_card_report_base"/>
<t t-call="stock_card_report.report_stock_card_report_base" />
</t>
</t>
</t>
@@ -54,36 +71,45 @@
<t t-foreach="o.product_ids" t-as="product">
<div class="page">
<div class="row">
<t t-set="title">Stock Card - <t t-raw="product.name"/></t>
<h4 class="mt0" t-esc="title" style="text-align: center;"/>
<t t-set="title">Stock Card - <t t-raw="product.name" /></t>
<h4 class="mt0" t-esc="title" style="text-align: center;" />
</div>
<!-- Display filters -->
<t t-call="stock_card_report.report_stock_card_report_filters"/>
<t t-call="stock_card_report.report_stock_card_report_filters" />
<!-- Display stock card table -->
<div class="act_as_table data_table mt4" style="width: 100%;">
<!-- Display header line-->
<t t-call="stock_card_report.report_stock_card_lines_header"/>
<t t-call="stock_card_report.report_stock_card_lines_header" />
<!-- Display initial lines -->
<t t-set="initial" t-value="o._get_initial(o.results.filtered(lambda l: l.product_id == product and l.is_initial))"/>
<t
t-set="initial"
t-value="o._get_initial(o.results.filtered(lambda l: l.product_id == product and l.is_initial))"
/>
<div class="act_as_row lines">
<div class="act_as_cell"/>
<div class="act_as_cell" />
<div class="act_as_cell">
Initial
</div>
<div class="act_as_cell"/>
<div class="act_as_cell"/>
<div class="act_as_cell" />
<div class="act_as_cell" />
<div class="act_as_cell right">
<t t-esc="'{0:,.3f}'.format(initial)"/>
<t t-esc="'{0:,.3f}'.format(initial)" />
</div>
</div>
<!-- Display each lines -->
<t t-set="product_balance" t-value="initial"/>
<t t-foreach="o.results.filtered(lambda l: l.product_id == product and not l.is_initial)" t-as="product_line">
<t t-set="product_balance" t-value="product_balance + product_line.product_in - product_line.product_out"/>
<t t-call="stock_card_report.report_stock_card_lines"/>
<t t-set="product_balance" t-value="initial" />
<t
t-foreach="o.results.filtered(lambda l: l.product_id == product and not l.is_initial)"
t-as="product_line"
>
<t
t-set="product_balance"
t-value="product_balance + product_line.product_in - product_line.product_out"
/>
<t t-call="stock_card_report.report_stock_card_lines" />
</t>
</div>
<p style="page-break-before:always;"></p>
<p style="page-break-before:always;" />
</div>
</t>
</template>
@@ -97,13 +123,13 @@
</div>
<div class="act_as_row">
<div class="act_as_cell">
<span t-field="o.date_from"/>
<span t-field="o.date_from" />
</div>
<div class="act_as_cell">
<span t-field="o.date_to"/>
<span t-field="o.date_to" />
</div>
<div class="act_as_cell">
<span t-field="o.location_id"/>
<span t-field="o.location_id" />
</div>
</div>
</div>
@@ -124,19 +150,19 @@
<template id="stock_card_report.report_stock_card_lines">
<div class="act_as_row lines">
<div class="act_as_cell left">
<t t-esc="product_line.date.strftime('%Y-%m-%d')"/>
<t t-esc="product_line.date.strftime('%Y-%m-%d')" />
</div>
<div class="act_as_cell left">
<t t-esc="product_line.reference"/>
<t t-esc="product_line.reference" />
</div>
<div class="act_as_cell right">
<t t-esc="'{0:,.3f}'.format(product_line.product_in)"/>
<t t-esc="'{0:,.3f}'.format(product_line.product_in)" />
</div>
<div class="act_as_cell right">
<t t-esc="'{0:,.3f}'.format(product_line.product_out)"/>
<t t-esc="'{0:,.3f}'.format(product_line.product_out)" />
</div>
<div class="act_as_cell right">
<t t-esc="'{0:,.3f}'.format(product_balance)"/>
<t t-esc="'{0:,.3f}'.format(product_balance)" />
</div>
</div>
</template>

View File

@@ -2,7 +2,7 @@
display: table !important;
background-color: white;
}
.act_as_row {
.act_as_row {
display: table-row !important;
page-break-inside: avoid;
}
@@ -14,21 +14,21 @@
display: table-header-group !important;
}
.act_as_row.labels {
background-color:#F0F0F0 !important;
background-color: #f0f0f0 !important;
}
.data_table {
width: 100% !important;
border-left:0px;
border-right:0px;
text-align:center;
font-size:10px;
padding-right:3px;
padding-left:3px;
padding-top:2px;
padding-bottom:2px;
border-collapse:collapse;
border-left: 0px;
border-right: 0px;
text-align: center;
font-size: 10px;
padding-right: 3px;
padding-left: 3px;
padding-top: 2px;
padding-bottom: 2px;
border-collapse: collapse;
}
.data_table .act_as_cell{
.data_table .act_as_cell {
border: 1px solid lightGrey;
text-align: center;
}
@@ -39,13 +39,13 @@
font-weight: bold;
}
.act_as_cell.left {
text-align:left;
text-align: left;
}
.act_as_cell.right {
text-align:right;
text-align: right;
}
.custom_footer {
font-size:7px !important;
font-size: 7px !important;
}
.button_row {
padding-bottom: 10px;

View File

@@ -1,19 +1,18 @@
odoo.define('stock_card_report.stock_card_report_backend', function (require) {
'use strict';
var AbstractAction = require('web.AbstractAction');
var core = require('web.core');
var ReportWidget = require('web.Widget');
odoo.define("stock_card_report.stock_card_report_backend", function(require) {
"use strict";
var AbstractAction = require("web.AbstractAction");
var core = require("web.core");
var ReportWidget = require("web.Widget");
var report_backend = AbstractAction.extend({
hasControlPanel: true,
// Stores all the parameters of the action.
events: {
'click .o_stock_card_reports_print': 'print',
'click .o_stock_card_reports_export': 'export',
"click .o_stock_card_reports_print": "print",
"click .o_stock_card_reports_export": "export",
},
init: function (parent, action) {
init: function(parent, action) {
this._super.apply(this, arguments);
this.actionManager = parent;
this.given_context = {};
@@ -22,49 +21,48 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
if (action.context.context) {
this.given_context = action.context.context;
}
this.given_context.active_id = action.context.active_id ||
action.params.active_id;
this.given_context.active_id =
action.context.active_id || action.params.active_id;
this.given_context.model = action.context.active_model || false;
this.given_context.ttype = action.context.ttype || false;
},
willStart: function () {
willStart: function() {
return Promise.all([this._super.apply(this, arguments), this.get_html()]);
},
set_html: function () {
set_html: function() {
var self = this;
var def = Promise.resolve();
if (!this.report_widget) {
this.report_widget = new ReportWidget(this, this.given_context);
def = this.report_widget.appendTo(this.$('.o_content'));
def = this.report_widget.appendTo(this.$(".o_content"));
}
def.then(function () {
def.then(function() {
self.report_widget.$el.html(self.html);
});
},
start: function () {
start: function() {
this.set_html();
return this._super();
},
// Fetches the html and is previous report.context if any,
// else create it
get_html: function () {
get_html: function() {
var self = this;
var defs = [];
return this._rpc({
model: this.given_context.model,
method: 'get_html',
method: "get_html",
args: [self.given_context],
context: self.odoo_context,
})
.then(function (result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
});
}).then(function(result) {
self.html = result.html;
defs.push(self.update_cp());
return $.when.apply($, defs);
});
},
// Updates the control panel and render the elements that have yet
// to be rendered
update_cp: function () {
update_cp: function() {
if (this.$buttons) {
var status = {
breadcrumbs: this.actionManager.get_breadcrumbs(),
@@ -73,40 +71,37 @@ odoo.define('stock_card_report.stock_card_report_backend', function (require) {
return this.update_control_panel(status);
}
},
do_show: function () {
do_show: function() {
this._super();
this.update_cp();
},
print: function () {
print: function() {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'qweb-pdf'],
method: "print_report",
args: [this.given_context.active_id, "qweb-pdf"],
context: self.odoo_context,
}).then(function (result) {
}).then(function(result) {
self.do_action(result);
});
},
export: function () {
export: function() {
var self = this;
this._rpc({
model: this.given_context.model,
method: 'print_report',
args: [this.given_context.active_id, 'xlsx'],
method: "print_report",
args: [this.given_context.active_id, "xlsx"],
context: self.odoo_context,
}).then(function (result) {
}).then(function(result) {
self.do_action(result);
});
},
canBeRemoved: function () {
canBeRemoved: function() {
return Promise.resolve();
},
});
core.action_registry.add(
"stock_card_report_backend",
report_backend
);
core.action_registry.add("stock_card_report_backend", report_backend);
return report_backend;
});

View File

@@ -7,22 +7,35 @@
<form>
<group name="criteria">
<group>
<field name="date_range_id"/>
<field name="date_from"/>
<field name="date_to"/>
<field name="date_range_id" />
<field name="date_from" />
<field name="date_to" />
</group>
<group>
<field name="product_ids" widget="many2many_tags"/>
<field name="location_id"/>
<field name="product_ids" widget="many2many_tags" />
<field name="location_id" />
</group>
</group>
<footer>
<button name="button_export_html" string="View"
type="object" default_focus="1" class="oe_highlight"/>
<button
name="button_export_html"
string="View"
type="object"
default_focus="1"
class="oe_highlight"
/>
or
<button name="button_export_pdf" string="Export PDF" type="object"/>
<button
name="button_export_pdf"
string="Export PDF"
type="object"
/>
or
<button name="button_export_xlsx" string="Export XLSX" type="object"/>
<button
name="button_export_xlsx"
string="Export XLSX"
type="object"
/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</footer>
@@ -37,9 +50,11 @@
<field name="target">new</field>
</record>
<menuitem id="stock_card_report_menu"
action="stock_card_report_action"
parent="stock.menu_warehouse_report"
sequence="30"/>
<menuitem
id="stock_card_report_menu"
action="stock_card_report_action"
parent="stock.menu_warehouse_report"
sequence="30"
/>
</odoo>

View File

@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="valued_report_picking" inherit_id="stock.report_delivery_document">
<xpath expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]/thead/tr"
position="inside">
<xpath
expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]/thead/tr"
position="inside"
>
<t t-if="o.valued and o.sale_id and o.move_line_ids">
<t t-if="o.state != 'done'">
<th class="text-right"><strong>Qty Reserved</strong></th>
@@ -20,21 +22,25 @@
<t t-if="o.valued and o.sale_id and o.move_line_ids">
<t t-if="move_line.picking_id.state != 'done'">
<td class="text-right">
<span t-field="move_line.product_uom_qty"/>
<span t-field="move_line.product_uom_id"/></td>
<span t-field="move_line.product_uom_qty" />
<span t-field="move_line.product_uom_id" /></td>
</t>
<td class="text-right"><span
t-field="move_line.sale_price_unit" /></td>
<td class="text-right"><span t-field="move_line.sale_price_unit" /></td>
<td class="text-right" groups="product.group_discount_per_so_line">
<span t-field="move_line.sale_discount" />
</td>
<td class="text-right"><span
t-field="move_line.sale_price_subtotal" /></td>
t-field="move_line.sale_price_subtotal"
/></td>
<td class="text-right"><span
t-field="move_line.sale_tax_description"/></td>
t-field="move_line.sale_tax_description"
/></td>
</t>
</xpath>
<xpath expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]" position="after">
<xpath
expr="//table[@t-if=&quot;o.move_line_ids and o.state==&apos;done&apos;&quot;]"
position="after"
>
<t t-if="o.valued and o.sale_id and o.move_line_ids">
<table class="table table-sm mt32">
<thead>
@@ -47,13 +53,13 @@
<tbody>
<tr>
<td class="text-right">
<span t-field="o.amount_untaxed"/>
<span t-field="o.amount_untaxed" />
</td>
<td class="text-right">
<span t-field="o.amount_tax"/>
<span t-field="o.amount_tax" />
</td>
<td class="text-right">
<span t-field="o.amount_total"/>
<span t-field="o.amount_total" />
</td>
</tr>
</tbody>

View File

@@ -1,13 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record model="ir.ui.view" id="view_partner_valued_picking">
<field name="name">Partner view (Valued picking)</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<xpath expr="//page[@name='sales_purchases']//field[@name='user_id']" position="after">
<field name="valued_picking"/>
<xpath
expr="//page[@name='sales_purchases']//field[@name='user_id']"
position="after"
>
<field name="valued_picking" />
</xpath>
</field>
</record>

View File

@@ -1,23 +1,25 @@
odoo.define('stock.InventoryReportLocationListController', function (require) {
"use strict";
/* eslint-disable no-unused-vars */
odoo.define("stock.InventoryReportLocationListController", function(require) {
"use strict";
var core = require('web.core');
var InventoryReportListController = require('stock.InventoryReportListController');
var core = require("web.core");
var InventoryReportListController = require("stock.InventoryReportListController");
var qweb = core.qweb;
var _t = core._t;
var qweb = core.qweb;
var _t = core._t;
var InventoryReportLocationListController = InventoryReportListController.include({
renderButtons: function ($node) {
this._super.apply(this, arguments);
if (this.context.no_at_date) {
return;
}
if (this.modelName === "stock.quant") {
$node.find('.o_list_buttons').find(".btn-primary").html(_t("Inventory at Date & Location"))
}
},
});
var InventoryReportLocationListController = InventoryReportListController.include({
renderButtons: function($node) {
this._super.apply(this, arguments);
if (this.context.no_at_date) {
return;
}
if (this.modelName === "stock.quant") {
$node
.find(".o_list_buttons")
.find(".btn-primary")
.html(_t("Inventory at Date & Location"));
}
},
});
});

View File

@@ -1,22 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="stock_quantity_history_location_assets_backend" name="mrp_workorder assets" inherit_id="web.assets_backend">
<template
id="stock_quantity_history_location_assets_backend"
name="mrp_workorder assets"
inherit_id="web.assets_backend"
>
<xpath expr="." position="inside">
<script type="text/javascript" src="/stock_quantity_history_location/static/src/js/inventory_report.js"></script>
<script
type="text/javascript"
src="/stock_quantity_history_location/static/src/js/inventory_report.js"
/>
</xpath>
</template>
<record id="view_stock_quantity_history_location" model="ir.ui.view">
<field name="name">Inventory Report</field>
<field name="model">stock.quantity.history</field>
<field name="inherit_id" ref="stock.view_stock_quantity_history"/>
<field name="inherit_id" ref="stock.view_stock_quantity_history" />
<field name="arch" type="xml">
<field name="inventory_datetime" position="before">
<field name="location_id"
invisible="context.get('active_model') == 'stock.valuation.layer'"/>
<field name="include_child_locations"
attrs="{'invisible': [('location_id', '=', False)]}"/>
<field
name="location_id"
invisible="context.get('active_model') == 'stock.valuation.layer'"
/>
<field
name="include_child_locations"
attrs="{'invisible': [('location_id', '=', False)]}"
/>
</field>
</field>
</record>