Commit Graph
109 Commits
Author SHA1 Message Date
Yannick TivisseandVictor Feyens 18952cdc76 [IMP] *: Convert single create method into multi
Taskid: 2703085
Part-of: odoo/odoo#80824
Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-12-14 19:13:18 +00:00
Paolo (pgi) f3e9e6f4b6 [FIX] l10n_ch: Fix QR bill according to specs
Reworked the structure of the HTML and the SCSS
to adhere to the official specs:

- 5mm padding inside the two main sections
- Correct font sizes
- Bold headers
- Increased the Swiss Cross inside the logo (7mm x 7mm)
- Scissors pictogram on the outline
- Dashed borders

Sizes now take the wkhtmltopdf (1/1.25 factor) shrinking
into consideration.

closes odoo/odoo#80544

X-original-commit: f02622684c6a220a425044d8d4a5fd474efdb519
Signed-off-by: William André (wan) <wan@odoo.com>
2021-12-02 10:18:56 +00:00
Nasreddin Boulif (bon) 0e50113f69 [FIX] base,l10n_ch,account_qr_code_sepa,payment,websitesale: Display all QR codes in QR bill
Issue:

  When trying to print a Suisse QR bill, if multiple images are presents
  in document and they have a url as src, some pictures will not be
  displayed.
  (Same issue may occur with simple QR code)

Cause:

  It's a known issue with wkhtmltopdf: https://github.com/odoo/odoo/commit/2949138a7d84cd6c925ea1745d62f25ef077bb8b
  Also, adding css class to body by js break wkhtmltopdf.

Solution:

  Replace link by base64 image value (use a function to retrieve base64
  image instead of image_url).
  Remove class 'l10n_ch_qr' added by js (no need since CSS file didacted
  to this report).

  Move `_get_qr_code_base64` and `_get_qr_code_url` logic/flow
  (since generic) to account module.
  Move specific logic like `_get_qr_vals` and
  `_get_qr_code_generation_params` to specific module (ex: l10n_ch).

  extra: Alter some css for better rendering + update unitest.

opw-2620082

closes odoo/odoo#77643

X-original-commit: 699b6eeac993e3a8d97ae7949170f7e18ca05831
Signed-off-by: Olivier Colson <oco@odoo.com>
2021-11-08 09:25:47 +00:00
John Laterre (jol) eac2440fe0 [ADD] l10n_din5008: isolate din 5008 from l10n_de
DIN 5008 is not specific to Germany.
It also applies to Switzerland, Austria (& Lichtenstein).

The goal is to make DIN independent from l10n_de,
for Switzerland and Austria.

closes odoo/odoo#76227

Task: 2613993
Related: odoo/upgrade#2932
Signed-off-by: William André (wan) <wan@odoo.com>
2021-10-28 08:33:17 +00:00
oco-odoo 1bdfdae121 [IMP] l10n_ch: fix typo in UserError
closes odoo/odoo#76975

X-original-commit: 704fc0fa9e0d8eecd2f15a7f36f1320a9ed2e717
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-09-22 15:08:59 +00:00
Florent de Labarre a87c89d4ab [FIX] various: respect mail_post_autofollow previous values when adding it
Purpose of this commit is to avoid forcing mail_post_autofollow to True when
it is set to False. It eases inheritance and custom behavior.

Task-2612911
PR odoo/odoo#60792
2021-07-27 13:34:22 +00:00
Djamel (otd) d54d6959ac [FIX] l10n_ch: fix the qr_iban fields to only appear for Swiss companies
Steps to reproduce the bug :
- Create a French company
- Go to accounting settings > in “Fiscal Localization” install French accounting
- Install “l10n_ch_qriban”
- Go to contacts > Configuration > Bank accounts
- Create a new bank account > add a French company newly created in the “Account Holder” field

Problem:
The specific fields to a Swiss company appear.

Solution :
Check if the country of the company encoded in the “Account Holder” field is Switzerland.

opw-2504699

closes odoo/odoo#70011

X-original-commit: 326dc3f7001f605d7ebb929740ed8478fce20e7e
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-04-29 09:15:07 +00:00
oco-odoo b27e3e12b9 [IMP] l10n_ch: remove related l10n_ch_postal field from bank journal, for usability
Adding this field to the bank journal's form view had been done to ease encoding; yet more fields were left to be set on the related res.partner.bank object (l10n_ch_qr_iban, chf and eur subrscription numbers. In the end, to be consistent, we would have needed to do related fields for all of them as well on the journal. This would have put too many advanced features in a single screen. Instead, we just consider the whole setup needs to be done directly on the res.partner.bank.

Task 2412391
2021-04-01 17:06:11 +00:00
oco-odoo d9c97e8cd1 [REM] l10n_ch_qr_iban: merge module into l10n_ch
This module had been introduced in stable to add a field to store the QR-IBAN in case it differed from the regular account number. We now merge it into the original module and make it so that the only way to define a QR-IBAN is to populate this field (no more magic with account number).
2021-04-01 17:06:11 +00:00
oco-odoo 17610e8ca9 [IMP] account, account_edi, l10n_*, purchase, sale: Generalize the use of account_fiscal_country_id
Before, account_fiscal_country_id was only use for tax operations; and country_id was used for all the other accounting stuff. Now, with the new ability to use foreign tax reports (with foreign VAT fiscal positions), we can generalize the fiscal country, sot that it is the one that needs to be used for the whole accounting. Since foreign tax reports were not supported before, account_fiscal_country_id is already set on existing database as the country for the "main" accounting, so the impact of this change is small.

closes odoo/odoo#68349

Related: odoo/upgrade#2322
Related: odoo/enterprise#17299
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-04-01 12:09:20 +00:00
Yannick Vaucher c5ecf8b654 [FIX] l10n_ch: human readable ISR number set to False
The condition on computation of `l10n_ch_isr_number_spaced` was not in line anymore with
`l10n_ch_isr_number` computation.
With fixes on the ISR number the use of `l10n_ch_isr_postal` is rightly not
mandatory anymore.

This lead to an empty field, visible on the ISR report.

closes odoo/odoo#67058

X-original-commit: fdbfb332b528ba8b35d7529eecd610086465aff8
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-02 12:20:30 +00:00
wan de0c5f4b8c [FIX] l10n_ch: _is_qr_iban without bank
Part of task 2124952

Return False if the recordset is empty.
```python
self.acc_type == 'iban'
```
This already ensures there is at most one record.
We now have the same behavior as for `_is_isr_issuer` (False if empty
recordset)

Was needed after cb8b6db391 because it is
now calling _is_qr_iban on a possible empty recordset.

Revert 1b2aef65f4
2021-02-17 08:39:29 +00:00
nie 9e6c60140e [FIX] l10n_ch: use commercial partner name instead of computed field
Follow-up of https://github.com/odoo/odoo/pull/65357

closes odoo/odoo#65523

X-original-commit: 38e78a59ace4fb590cc5c138e16acb1013fa193e
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-04 10:36:03 +00:00
nie ebd85820b8 [FIX] l10n_ch: use commercial company name in invoice PDF
Steps:
- Edit the current company (1):
  - Country: Switzerland
  - Currency: CHF
- Install l10n_ch
- Go to Invoicing > Configuration > Bank Accounts
- Edit Bank:
  - Bank Account: create a new one:
    - Account Holder: (1)
- Go to Configuration > Journal
- Edit Customer Invoices:
  - Advanced Settings tab:
    - Communication Standards: Switzerland
- Go to Customers > Customers
- Create a new customer (2):
  - Fill in street, city, zip code and country
- Edit (2):
  - Contacts & Addresses tab:
    - Add:
      - Select Invoice Address
      - Contact Name: Keep this field blank
- Go to Customers > Invoices
- Create a new one:
  - Customer: "(2), Invoice Address"
  - Add a product
- Validate it
- Click Print QR-Bill

Bug:
Traceback here:
https://github.com/odoo/odoo/blob/b76e9ef658bde0178fa1660b6ad27b880e91632a/addons/l10n_ch/models/res_bank.py#L129
TypeError: 'bool' object is not subscriptable

Explanation:
The contact name of an address is optional. When nothing is filled in
that field, it returns `False`, hence the error.
Using the commercial company name ensures a name is put in the invoice,
even if the contact doesn't belong to a company.

opw:2447158

closes odoo/odoo#65417

X-original-commit: 2537bb01675279f08edf65077e6d41a5bd968ec4
Signed-off-by: backspac <backspac@users.noreply.github.com>
2021-02-02 13:56:41 +00:00
Goffin Simon 419337782f [FIX] l10n_ch: Traceback when installing module
Function _is_l10n_ch_postal expects a singleton

closes odoo/odoo#64785

X-original-commit: 90c286e168b62876214119d69257d0aa5c120bc2
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-01-20 10:37:45 +00:00
Goffin Simon 1b2aef65f4 [FIX] l10n_ch, l10n_ch_qriban: Impossible to create a vendor bill
Fine tuning of this commit: https://github.com/odoo/odoo/commit/6e374e25943106be84711233f3960f2f3a4b9aa9

To fix the issue when l10n_ch_qriban is not installed

opw:2416809

closes odoo/odoo#63478

X-original-commit: b226f07628618aac6ada0ffce736e29cb1cdc550
Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2020-12-16 17:39:33 +00:00
Yannick Vaucher cb8b6db391 [FIX] l10n_ch: check reference format with supplier QR-IBAN
closes odoo/odoo#63396

X-original-commit: 0d80dbf8a530209679a65a5c62808be1589c5cef
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-12-15 13:34:19 +00:00
Christophe Monniez abf3a8afd2 [FIX] l10n_ch: use an absolute path for ch flag
When printing an invoice with an iban qrcode using l10n_ch module, a
little ch flag appears in the center of the qr code.

When odoo is started from elsewhere than the root of the odoo code, the
flag does not appear. The cause is that a relative path is used to find
the flag image.

With this commit, an absolute path is computed to find the flag.

closes odoo/odoo#61048

X-original-commit: d33785032b1ca2c6e1d4ade7e174d024fae9a151
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-10-30 13:20:49 +00:00
Yannick Vaucher 2af6b7dcf6 [REF] l10n_ch ISR number computation
Add hooks to be able to tweak the Bank customer ID number for ISR-B

Those hooks will allow to not use of the field l10n_ch_postal for
multiple purposes.

Fixes conditions on which the reference is generated.
It shouldn't be always generated if l10n_ch_postal is set.
Only if a l10n_ch_subscription_xxx is set.

closes odoo/odoo#58398

X-original-commit: 4790b8e57aa357cda32818392d795b8c0dc48f43
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-09-24 09:56:14 +00:00
Yannick Vaucher b5b83b60a7 [DOC] l10n_ch: describe structure of ISR ref
The reference with 27 chars and the optical line
are not meant to be human readable. This document
the structure of the ISR Reference. [1]

[1] https://www.raiffeisen.ch/rch/fr/clients-entreprises/trafic-paiements-et-liquidites/debiteurs/bulletin-de-versement-orange.html

closes odoo/odoo#57889

X-original-commit: d5be7ff9331b060c9ff84361b1a422056817f548
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-09-16 16:18:09 +00:00
Ravi Gohil 5cd83b448a [IMP] l10n_ch: refactor a method to make it overridable
We refactored a method to check if the IBAN is in the correct
range to be a QR-IBAN or not.  (to be able to reuse it)

Thanks to Ravi Gohil

Task: 2307262
X-original-commit: efd6e493a6d855c12e43e9b3cb7c436c6d7de35a
2020-09-15 08:46:16 +00:00
oco-odoo 01aa711d41 [FIX] l10n_ch: fix forward-port errors
closes odoo/odoo#56307

X-original-commit: 604dedd84cac082c7575f4b40356f4ac4ff40dd3
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-08-21 13:38:52 +00:00
Yannick Vaucher 9afee4f2eb [FIX] l10n_ch: Swiss QR names len limit
Limit must be 70 not 71

closes odoo/odoo#54587

X-original-commit: 7d808675de88ed54de67f798de9cec16bb95ef3b
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-07-16 14:08:00 +00:00
Yannick Vaucher da6c9027f4 [IMP] l10n_ch: clearer validations for bank fields and vendor bills (ISR ref)
On res.partner.bank, we check that:
- l10n_ch_postal contains a valid postal number
- l10n_ch_isr_subscription_chf contains a valid ISR subscription number
- l10n_ch_isr_subscription_eur contains a valid ISR subscription number

ISR subscriptions numbers are postal numbers but starting with 01 or 03.
Those codes are reserved to ISR issuance.

When the bank account on a Vendor Bill is detected as
an ISR Issuer, check the reference is actually an ISR.

The 27 digits ISR Reference is error prone when typed by hand
and an error at this stage would break the payment process later.

This is required to avoid batch payment error with SEPA.

We prefer using the pretty form xx-yyyyy-z of a postal account.
The Swiss users will identify it more easily.

We always want to auto fill the field l10n_ch_postal when possible from
acc_number, which includes only 2 cases of filling acc_number:

1. a 9 position postal account number
2. an IBAN from PostFinance which includes clearing 09000

Original prs: Closes #51645, #51544, #51560

closes odoo/odoo#54455

X-original-commit: f8a3ec438e3b5fa56305db729a78304aec7a6716
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-07-14 14:49:15 +00:00
bfr-o 52949a1a83 [FIX] l10n_ch: Fix broken 'test_l10n_ch_isr
'

X-original-commit: 10c14c63094870346143a42f5df39e1db3f0dc5c
2020-07-03 15:53:29 +00:00
Yannick Vaucher 3230ae6441 [FIX] l10n_ch - Swiss QR layout cleaning
This intend to enforce specifications and improve readability

Layout changes:

* [FIX] Amount section must be placed under the QR code
* [FIX] Don't display empty additional information
* [FIX] Rename slip sections and labels
* [IMP] Rework of the layout

    Group content like adresse by removing line spacing
    Reduce character size to follow Swiss Implementation Guidelines QR-bill v2.1
    Reduce left margin to avoid overlap of spaced ISR reference on the Receipt

* [FIX] Missing street on Receipt
* [FIX] Add thousand separators

    Official specs asks for:
    - thousand separators as blank. (using a non breaking to avoid spliting the amount)
    - decimal separators as a full stop

    > If  the  amount  isincluded  in  the  Swiss  QR  Code,  then  it  must  be  printed  after  the currency code. A blank (space) should be used as the thousands separator and a full stop «.»as  the  decimal  separator.  The  amount  must  always  include  two  decimal places (e.g. CHF 1 590.00).

QR-Code:

* [IMP] Align QR code upper and improve accuracy of size

    Add an option on reportlab to print QR Code without surounding blank space
    this is required to compute with accuracy the width of 46mm x 46mm defined
    in the specs.

* [FIX] Street and street2 issues

    Removes an extra space between street values when only one is given.
    Test the right partner street, only the company street was checked.

QRR generation

* [FIX] make it possible to generate QRR

    It must be possible to generate QRR without ISR subscription number.

Content removed as not present in the specs version 2.1:

* [RM] procedure section
* [RM] due date

Translations:

* [IMP] Add translations of the QR-bill in DE, FR and IT
* [FIX] QR-bill lang is now based on customer lang

Tests:

* [IMP] Add unit tests for Swiss reality check for the QR-bill

closes odoo/odoo#54053

X-original-commit: 4f4edd0594b29252a5d44281cc773230c09521e9
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-07-03 13:01:15 +00:00
Martin Trigaux 400cc4f14e [FIX] *: correct all or improve code translation lookup
This commit fixes all issues detected by the new pylint
gettext-variable test.
It converts some calls to the new syntax
  _("Foo %s", bar)

to progressively migrate the code to the new syntax.

A few calls were not technically incorrect but still detected by the
linter.

  _("Foo" +
    "Bar")

has been converted to

  _("Foo"
    "Bar")

as it has the same effect and make sure the argument is of type
asteroid.Const instead of BinOp).

closes odoo/odoo#53683

Related: odoo/enterprise#11467
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-06-30 10:19:59 +00:00
Yannick Vaucher 2e9aac7655 [FIX] l10n_ch - print ISR tests
resolves the following error:

E psycopg2.IntegrityError: null value in column "partner_id" violates not-null constraint
E DETAIL: Failing row contains (193, 010391391, null, null, null, null, 10, null, 1, 1, 2020-05-20 20:05:28.431208, 1, 2020-05-20 20:05:28.431208, null, null, null, null).

To generate an ISR payment slip you need:

  * a type == out_invoice
  * a partner bank account with a ISR issuer number (field l10n_ch_isr_subscription_[chf|eur])
  * a currency either in EUR or CHF

Remarks:

  * l10n_ch_postal is not necessary and must be used for Vendors only.
  * human readable subscription number is xx-yyyyyy-c
        validation of such format is done with the following PR: https://github.com/odoo/odoo/pull/51544/files

It does:

- Removes unexisting field from tests
- Adds required field on partner_id
- Fix test with an actual case that case generate ISR payment slips

closes odoo/odoo#53498

X-original-commit: 776fd59909d12c981585fac82cfa9f3603d96ccf
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-06-23 10:17:26 +00:00
fw-bot 0d327e2d81 [FIX] l10n_ch: don't add an empty page on QR-bill pdf report when a header is displayed
Before that, just one pixel from the bottom of the QR-bill frame passed got out of the page, and end out creating a second, empty page.

Since this error was probably due to some rounding issue in the way A4 dimensions were compared to the layout specified by the scss file, we solve it by rounding the height of this section a little more, removing 0.25mm from it.

[FIX] l10n_ch: qr bill report: display the payment ref under "reference" and the invoice's name as additional information

closes odoo/odoo#53453

X-original-commit: 8a6cc1a572cd04f540e4a5e83362319c13274aea
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-06-22 16:03:59 +00:00
fw-bot 3349940157 [FIX] l10n_ch: make QR-bill and ISR generation disjoint
QR-bills could only be generated for ISR-compliant invoices, which is wrong and would have caused issues in the future, as ISR will slowly disappear.

Furthermore, doing it this way avoids raising an error after commit 719f087 , when trying to print an ISR-compliant invoice if the module hadn't been updated (it used to raise because the QR-bill report didn't exist, and it tried generating it).

closes odoo/odoo#51858

Forward-port-of: #51340
Forward-port-of: #50744
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-05-28 11:43:30 +00:00
Martin Trigaux d9287caf94 [IMP] *: convert to private methods
render, render_template, load, activity_schedule_with_view,
get_website_pages should all be private:
It should not be possible to render an aribtrary template only with
its name or id

Still need to render some qweb views from js so the method
render_template is kept public.
This explains why the website editor still need read access on
ir.ui.view as we want to allow any snippet to be rendered.
2020-05-14 13:59:10 +02:00
oco-odoo e997bf14b3 [FIX] l10n_ch: fix QR-bill pdf report so that it matches the spec
Using it as a parf of the regular invoice pdf report was wrong, as this report is subject to the margins defined in its paper format; causing issues as for the rendering of the QR report, which must be displayed at a precise location (just like ISR). wkhtmltopdf doesn't allow having different margin values in the same file, so we did just as for ISR, and now generate QR-bill in a distinct pdf.

[IMP] l10n_ch: add receipt part to QR-bill pdf report

closes odoo/odoo#50765

X-original-commit: 99b5306545b945810e8259f2cc447b933d316778
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-05-07 08:18:35 +00:00
Laurent Smet caeb782841 [IMP] account,*: Improve bank statements/payments workflow
- Create journal entries as soon as bank/cash statement lines are created, temporary booked on a suspense account set on the journal.
- Simplify the management of "blue" lines in the reconciliation widget. A "blue" line is now a journal item using a temporary liquidity account (outstanding payment/receipt accounts, set on the journal).
- Adapt and simplify the bank reconciliation report.
- Remove the bank reconciliation threshold date. The reconciliation report will show the not already reconciled journal entries using a liquidity account and the not already reconciled journal entries using a temporary liquidity account. Without accounting, an account.payment will involve directly the liquidity account and then, will be considered as a statement line directly.
- Remove the post_at bank reconciliation feature. The "paid" state will be set on the invoices only if reconciled with a journal entry involving the journal's liquidity account.
    With invoicing, the payment will do that so the "in_payment" state should never be shown up.
    With accounting, only the statement lines have the power to move an invoice to the "paid" state.
- Fix various corner cases about the management of multi-currency in bank statement lines.
- Fix the conversion dates in multi-currency: Since the bank/cash is always used on the statement lines, it will use always the real "bank" date instead of the fictive payment one.
- Ensure the 'reconcile' method will raise an error if the involved moves are not posted.

related enterprise PR odoo/enterprise#7019

closes odoo/odoo#41301

--task: 2092096
Related: odoo/upgrade#1018
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-04-10 09:47:24 +00:00
oco-odoo 7a65152bcc [FIX] l10n_ch: QR-code generation: limit address lines to 70 characters instead of 71
closes odoo/odoo#49231

X-original-commit: 396fc027709f38679a211c1391d0cc2d8f919421
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-04-08 12:50:08 +00:00
oco-odoo 473be98911 [IMP] l10n_ch: remove old development TODO
Oopsy! 0:)

closes odoo/odoo#49005

X-original-commit: 6827757f6dbe2692a5b343b2227240c69d1a4af5
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-04-04 18:12:23 +00:00
oco-odoo 0eef278268 [IMP] base, account, l10n_ch, website_sale, payment, web: make payment QR-code generation more generic
This new modelling makes it easier to add new QR-code formats, and allows using all of them in website_sale and account.payment's form view as well (so, Swiss QR codes are now available there, while they were restricted to only invoices in the past). All barcodes are now generated as reports, from a dedicated route. This was only partly the case before : Swiss QR added a cross on top of the QR-code directly in the template, it wasn't part of the image returned by the route; now it is.

[ADD] base_qr_code_sepa: new module decoupling SEPA QR-codes generation from the base module

Each new QR-code generation option should thus be done in a dedicated module (or added to a localization) in the future.

[IMP] base_qr_code_sepa: update the generated QR codes to version 2 of the specification

Version 1 is still supported, so no need to backport this.

[IMP] l10n_ch: make Swiss QR-codes compatible with the new version of the specification (the old one is deprecated)

This will be backported to 11.0 and 12.0, as these QR-codes will soon replace ISR.

[IMP] account: make it possible to mark manual payments as sent with a button on the form view

This way, when making them directly with a QR-code (or doing a more classical wire transfer), people can keep track of what they already have asked the bank to do, and what they still have to treat.

closes odoo/odoo#44839

Related: odoo/enterprise#8262
Related: odoo/upgrade#992
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-03-30 11:28:41 +00:00
Adrian Torres 1daf8eb127 [FIX] *: set ondelete policy of required Selection fields
With this commit, Selection fields with `required=True` which are
extended via `selection_add` are given proper ondelete policies to
ensure the cleanup of records containing these extended options during
uninstall of the extending module.

This commit also cleans up leftover uninstall hooks that were being used
to handle the same set of problems prior to the ondelete mechanism being
implemented for Selection fields.

closes odoo/odoo#46325

Related: odoo/enterprise#9117
Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-30 13:42:04 +00:00
Thibault Delavallée a03f6483d6 [REF] mail: clean code about rendering in mail_template
PURPOSE

Clean and rename code about language management and template rendering in mail
template model.

SPECIFICATIONS

Clean method naming and try to make code easier to understand and call. Also
add and/or clean docstrings of rendering methods.

Notably

  * ``_classify_per_lang``: for each lang-contextualized template, give the list
    of record ids;
  * ``_render_template``: now working only on a valid list of IDs instead of
    allowing both int / list and having a return type depending on the input
    type. It allows to simplify code and delegate some processing to callers;

Introduce new API method

  * ``_render_lang``: for each record id return the lang matching it;
  * ``_render_field``: render a field of mail.template, on given set of record
    ids. Usage: template._render_field('body_html', records.ids). Language
    computation is available for this method;

Remove the "multi mode" support of rendering that either returned a rendered
value, either a dict based on given ids. Now all methods always work in batch
and caller have to fetch the correct result if necessary.

LINKS

Task ID 1963529
Community PR odoo/odoo#32397
2020-03-24 10:24:18 +00:00
Josse Colpaert 72623a2c82 [FIX] l10n_ch: adapt bank account creation in reconciliation
If the bank account number is a postal one, search differently
to see if the account already exists.  As for a postal account,
the same number can be used by multiple partners, changed the
account to include the name of the partner, but for this
we need to alter the way the account is searched/created.

closes odoo/odoo#47365

X-original-commit: b95b9d6db2af51644f640142d5a0b9ca72eac52f
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-03-11 10:32:47 +00:00
Ankita Raval d675dbaa4c [IMP] account,* : Change type field to move_type in account.move
task-id: 2028z813
2020-02-19 09:09:20 +00:00
Xavier Morel de590816d8 [FIX] *: deprecated access to url_ utilities through werkzeug root
In 0.15 accessing werkzeug.urls functions directly through werkzeug
is deprecated, the shortcut will be removed in the eventual werkzeug
1.0.

Fix existing uses of these shortcuts. Also cleanup some imports when
they're not far from a werkzeug* import being altered.
2020-02-04 12:42:35 +00:00
Nicolas Martinelli a02a4b112a [FIX] l10n_ch: ISR with partial payment
- Create an invoice for 1000
- Make a partial payment (e.g. cash) for 250
- Print the ISR

The ISR contains an amount of 1000 (total amount), while it should be
750 (amount left to pay).

opw-2180538

closes odoo/odoo#44552

X-original-commit: 421bbcd5270b889874dc99a9a8cead0272e1e3da
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-02-04 08:48:20 +00:00
oco-odoo a1c175bae7 [FIX] l10n_ch: fix bad field renaming in QR code generation
Originally introduced by https://github.com/odoo/odoo/commit/f3c1e6cfbe70f9dd37cc7c7b3b3464c5b9af280b

closes odoo/odoo#43474

X-original-commit: 3c85bed2f7680336d52821ce0d8bc241347c56c5
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-01-17 11:58:24 +00:00
oco-odoo aea045d446 [FIX] l10n_ch: don't assume the bank account of the company always has a currency_id
Since this field is not required on res.partner.bank (which is fine: we want it to be synchronized with the journal's currency, which is None if the journal uses company currency), the parameter received by validate_swiss_code_arguments ended out being an empty recordset in case the company was directly in CHF. This caused the QR code to never be displayed in this situation.

closes odoo/odoo#43351

X-original-commit: 60a55834b5ae0a8ac10914a243f97029d9921ae6
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-01-15 14:01:34 +00:00
Swapnesh Shah f1bdf63830 [FIX] l10n_ch: Update l10n_ch_postal if related field is set
Fixes https://github.com/odoo/odoo/issues/43122
Before this commit, Creating Journal without Bank account number will be failed as, It tries to update Related field 'l10n_ch_postal' while bank_account_id is not set.

In this commit, we update 'l10n_ch_postal' if 'bank_account_id' is present on Journal

closes odoo/odoo#43302

X-original-commit: 6ddd93bf615c95675c13cc989b8a6f835de04324
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2020-01-14 17:01:27 +00:00
Jason Van Malder bde09810c7 [FIX] l10n_ch: fix isr report crash with studio
Issue

    - Swiss company
    - Install Accounting & Studio
    - Journals > Customers Invoice
        - Communication standard: Switzerland
    - Journals > Bank
        - Swizz account with CHF ISR subscription number
    - Studio > Reports > ISR

    Traceback

Cause

    If the statement of the `l10n_ch_isr_optical_line` compute
    method is False, the value will be `None`.

    In the view, we do a foreach on the value which is `None` and
    it crashes.

Solution

    Set an empty string as default value for the
    `l10n_ch_isr_optical_line` field

OPW-2129122

closes odoo/odoo#41247

X-original-commit: a0dc556b0e04c9e89e7f6a8e4e9af045151614f7
Signed-off-by: Jason Van Malder <jasonvanmalder@users.noreply.github.com>
2019-12-03 07:55:32 +00:00
Jigar Vaghela 441759a5f1 [FIX] l10n_ch: avoid warning about not stored of l10n_ch_isr_number_spaced
two compute field have same method but one is store and other one is non store
so we split compute method for both fields(l10n_ch_isr_number,l10n_ch_isr_number_spaced)

closes odoo/odoo#40970

X-original-commit: d7a2d4aca37647ae568a5bb9f515ce2138245878
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-11-27 12:56:04 +00:00
fw-bot a745616404 [FW][IMP] l10n_ch: deconfuse BVR implementation
The BVR implementation was confusing as it
seemed to only take into account the case where the postal
account belonged to PostFinance itself and not to another
bank, where the same number is shared among multiple accounts.
Also, the purpose of the fields was confusing.

Adaptations done:
- When you add a bank account of type postal in the account number,
there is an onchange that automatically puts it in the postal account
field and makes itself unique by adding the name of the partner to
the account number. The account will still be detected as "postal".
- Improve help message of the postal account field on the bank account
as it is used for two different purposes (Client Number for own accounts
and postal number for "postal" vendor accounts)
- Only show the subscription fields when you have to do with a bank
account related to your own accounts / Switzerland
- Add fields in the Add Bank Account wizard if it is for Switzerland
(subscription number and the postal field we label "Client Number")
- Also label Client Number on the journal form for postal field
- Don't remove zeros in front of the client number on the BVR
- Don't put extra - in the subscription number on the BVR if it has
some - already
- Use number without spaces for payment reference

[FIX] l10n_ch: module moved to enterprise

closes odoo/odoo#39642

Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-10-31 13:57:21 +00:00
Thibault Delavallée 7ec2e85734 [REF] mail: remove dead code in composer and lint some code bits
Purpose of this commit is to remove code coming from old features,
implementations and that was not completely cleaned.

Including

  * remove support of old "reply" composition mode which is simply a comment
    with a parent message, and is deprecated;
  * remove support of old "mail.compose.message.mode" context key that was
    used in Odoo 6.1;
  * remove support of message_id default value in context instead of
    default_parent_id;
  * remove old redirection of user / partner post. This code come from
    old age when people were able to post on their "profile" by posting
    on their user;
  * remove unnecessary method for selection field;
  * remove unused imports to clean a bit code;

We also make some optional parameters in rendering methods mandatory to
ease code understanding and future modifications.

Task ID 1853147
PR #39272
2019-10-23 15:29:58 +00:00
Nicolas Martinelli ece4335e46 [FIX] l10n_ch: print ISR
On a customer invoice, click on 'Print ISR' => Error

This is because of computed fields not set.

opw-2081567

closes odoo/odoo#38325

X-original-commit: ed6dd79703bd1e02a8c3d9f13d12e2baa157ec36
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-10-10 06:30:44 +00:00