Skip to content
Merged
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
3 changes: 1 addition & 2 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Do NOT update manually; changes here will be overwritten by Copier
_commit: v1.29
_commit: v1.40
_src_path: gh:oca/oca-addons-repo-template
ci: GitHub
convert_readme_fragments_to_markdown: false
enable_checklog_odoo: false
generate_requirements_txt: true
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-requirements.txt merge=union
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
cache-dependency-path: '.pre-commit-config.yaml'
- name: Get python version
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v4
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
makepot: "true"
services:
postgres:
image: postgres:12.0
image: postgres:12
env:
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
Expand All @@ -63,6 +63,13 @@ jobs:
run: oca_init_test_database
- name: Run tests
run: oca_run_tests
- name: Upload screenshots from JS tests
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: Screenshots of failed JS tests - ${{ matrix.name }}${{ join(matrix.include) }}
path: /tmp/odoo_tests/${{ env.PGDATABASE }}
if-no-files-found: ignore
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ repos:
entry: found a en.po file
language: fail
files: '[a-zA-Z0-9_]*/i18n/en\.po$'
- id: obsolete dotfiles
name: obsolete dotfiles
entry: found obsolete files; remove them
files: '^(\.travis\.yml|\.t2d\.yml|CONTRIBUTING\.md)$'
language: fail
- repo: https://github.com/oca/maintainer-tools
rev: d5fab7ee87fceee858a3d01048c78a548974d935
rev: f9b919b9868143135a9c9cb03021089cabba8223
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand Down Expand Up @@ -104,6 +109,7 @@ repos:
additional_dependencies:
- "eslint@8.24.0"
- "eslint-plugin-jsdoc@"
- "globals@"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
Expand Down Expand Up @@ -140,7 +146,7 @@ repos:
- --settings=.
exclude: /__init__\.py$
- repo: https://github.com/acsone/setuptools-odoo
rev: 3.1.8
rev: 3.3.2
hooks:
- id: setuptools-odoo-make-default
- id: setuptools-odoo-get-requirements
Expand Down
69 changes: 35 additions & 34 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,25 @@ disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
openerp-exception-warning,
redundant-modulename-xml,
relative-import,
rst-syntax-error,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
assignment-from-none,
attribute-deprecated,
dangerous-default-value,
development-status-allowed,
duplicate-key,
eval-used,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
Expand All @@ -48,73 +54,68 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
missing-newline-extrafiles,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
str-format-used,
unnecessary-utf8-coding-comment,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
attribute-string-redundant,
consider-merging-classes-inherited,
context-overridden,
except-pass,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
missing-manifest-dependency,
too-complex,,
create-user-wo-reset-password,
dangerous-filter-wo-user,
deprecated-module,
file-not-used,
invalid-commit,
missing-manifest-dependency,
missing-newline-extrafiles,
missing-readme,
no-utf8-coding-comment,
odoo-addons-relative-import,
old-api7-method-defined,
unnecessary-utf8-coding-comment,
# messages that do not cause the lint step to fail
consider-merging-classes-inherited,
deprecated-module,
invalid-commit,
missing-readme,
odoo-addons-relative-import,
redefined-builtin,
too-complex,
unnecessary-utf8-coding-comment
manifest-external-assets


[REPORTS]
Expand Down
50 changes: 25 additions & 25 deletions .pylintrc-mandatory
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@ disable=all
enable=anomalous-backslash-in-string,
api-one-deprecated,
api-one-multi-together,
assignment-from-none,
attribute-deprecated,
class-camelcase,
dangerous-default-value,
dangerous-view-replace-wo-priority,
development-status-allowed,
duplicate-id-csv,
duplicate-key,
duplicate-xml-fields,
duplicate-xml-record-id,
eval-referenced,
eval-used,
incoherent-interpreter-exec-perm,
openerp-exception-warning,
redundant-modulename-xml,
relative-import,
rst-syntax-error,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
assignment-from-none,
attribute-deprecated,
dangerous-default-value,
development-status-allowed,
duplicate-key,
eval-used,
license-allowed,
manifest-author-string,
manifest-deprecated-key,
Expand All @@ -40,56 +46,50 @@ enable=anomalous-backslash-in-string,
method-inverse,
method-required-super,
method-search,
openerp-exception-warning,
pointless-statement,
pointless-string-statement,
print-used,
redundant-keyword-arg,
redundant-modulename-xml,
reimported,
relative-import,
return-in-init,
rst-syntax-error,
sql-injection,
too-few-format-args,
translation-field,
translation-required,
unreachable,
use-vim-comment,
wrong-tabs-instead-of-spaces,
xml-syntax-error,
attribute-string-redundant,
character-not-valid-in-resource-link,
consider-merging-classes-inherited,
context-overridden,
create-user-wo-reset-password,
dangerous-filter-wo-user,
dangerous-qweb-replace-wo-priority,
deprecated-data-xml-node,
deprecated-openerp-xml-node,
duplicate-po-message-definition,
except-pass,
file-not-used,
missing-newline-extrafiles,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
str-format-used,
unnecessary-utf8-coding-comment,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
attribute-string-redundant,
consider-merging-classes-inherited,
context-overridden,
except-pass,
invalid-commit,
manifest-maintainers-list,
missing-newline-extrafiles,
missing-readme,
missing-return,
odoo-addons-relative-import,
old-api7-method-defined,
po-msgstr-variables,
po-syntax-error,
renamed-field-parameter,
resource-not-exist,
str-format-used,
test-folder-imported,
translation-contains-variable,
translation-positional-used,
unnecessary-utf8-coding-comment,
website-manifest-key-not-valid-uri,
xml-attribute-translatable,
xml-deprecated-qweb-directive,
xml-deprecated-tree-attribute,
external-request-timeout

[REPORTS]
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

[![Support the OCA](https://odoo-community.org/readme-banner-image)](https://odoo-community.org/get-involved?utm_source=repo-readme)

# contract
[![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/contract&target_branch=16.0)
[![Pre-commit Status](https://github.com/OCA/contract/actions/workflows/pre-commit.yml/badge.svg?branch=16.0)](https://github.com/OCA/contract/actions/workflows/pre-commit.yml?query=branch%3A16.0)
[![Build Status](https://github.com/OCA/contract/actions/workflows/test.yml/badge.svg?branch=16.0)](https://github.com/OCA/contract/actions/workflows/test.yml?query=branch%3A16.0)
Expand All @@ -7,8 +10,6 @@

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

# contract

TODO: add repo description.

<!-- /!\ do not modify below this line -->
Expand Down
8 changes: 4 additions & 4 deletions contract_payment_auto/tests/test_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ def test_do_auto_pay_invoice_ensure_one(self):
def test_do_auto_pay_open_invoice(self):
"""It should open the invoice."""
invoice = self._create_invoice()
self.contract._do_auto_pay(invoice)
self.contract.with_context(test_target_state="done")._do_auto_pay(invoice)
self.assertEqual(invoice.state, "posted")

def test_do_auto_pay_sends_message(self):
"""It should call the send message method with the invoice."""
with mock.patch.object(contract.Contract, "_send_invoice_message") as m:
invoice = self._create_invoice()
self.contract._do_auto_pay(invoice)
self.contract.with_context(test_target_state="done")._do_auto_pay(invoice)
m.assert_called_once_with(invoice)

def test_do_auto_pay_does_pay(self):
Expand All @@ -136,8 +136,8 @@ def test_pay_invoice_not_open(self):

def test_pay_invoice_no_residual(self):
"""It should return None if no residual on the invoice."""
invoice = self._create_invoice()
invoice.state = "posted"
invoice = self._create_invoice(True)
invoice.amount_residual = 0.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is tricking too much the aim of the tests, as this is saying there's no debt. Not sure though if the tests were OK before.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pedrobaeza for the comment, I'm struggling quite blindly with these unrelated test errors…

Honestly, I don't know if posting or even sending (i.e. self._create_invoice(True, True)) are supposed to clear the residual in the test context (note: they don't), or if some other operation should be issued in the middle (hints welcome!).

At any rate, this contract_payment_auto module doesn't even exist in 17.0 nor 18.0, I wonder if just dropping the test would make sense at this point if we fail to make sense out of it. 🤷

res = self.contract._pay_invoice(invoice)
self.assertIs(res, None)

Expand Down
4 changes: 4 additions & 0 deletions subscription_oca/tests/test_subscription_oca.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def setUpClass(cls):
("company_id", "=", cls.env.ref("base.main_company").id),
]
)[0]
# Allow paying from no matter what company acct used for refunds etc.
cls.env.ref("base.main_company").partner_id.bank_ids.update(
{"allow_out_payment": True}
)
cls.pricelist1 = cls.env["product.pricelist"].create(
{
"name": "pricelist for contract test",
Expand Down
Loading