Commit Graph
54 Commits
Author SHA1 Message Date
Corentin Thaon (thco) 46f1e7552c [FIX] l10n_ar, l10n_cl: Print invoice PDF foreign currency
Trying to print or send an invoice using a foreign currency leads to a traceback while generating the PDF.

Steps to reproduce:
- Install l10n_ar and step into the AR company;
- Create a new invoice using a foreign currency (e.g. USD);
- Confirm the invoice;
- Try to Send/Print the invoice.

This is also the case with l10n_cl.

opw-3477108

closes odoo/odoo#134612

X-original-commit: 9578fa9854a000a58ca6ffbdf144104d6a99c56d
Signed-off-by: Cedric Snauwaert <csn@odoo.com>
Signed-off-by: Corentin Thaon (thco) <thco@odoo.com>
2023-09-07 13:10:10 +00:00
Daniel Kosky (dako) 084408a9bb [FIX] l10n_*: set default taxes
The default taxes for most localisations have been left undefined by
default. When loading the chart template, the model generally selects
the first sales and purchase taxes, based on the order in which the
taxes appear in the csv, for the default sales and purchase taxes
respectively.

This behaviour can be confusing to those who are not yet familiar with
it. It has been decided that it is preferable instead to specify the
default tax in _get_*_res_company function on the account chart template
model, such that the default taxes are defined explicitly for every
localisation.

task-3453997

closes odoo/odoo#130733

Related: odoo/enterprise#45531
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
2023-08-17 18:42:46 +02:00
Daniel BlancoandJosé Moreno Hanshing 9d4710a823 [FIX] l10n_cl: enable purchase invoice for foreign vendors
Description of the issue/feature this PR addresses:
Before SII resolution 46 from 2022, the only documents for foreign vendors were 110 111, and 112.
After that, SII and accountants are indicated as a practice to issue purchase invoices (Factura
de compra 46) to foreign vendors in order to pay the vat taxes, mainly for digital services.

Current behavior before PR:
It is not allowed by validation restrictions to issue this document type to foreign vendors

Desired behavior after PR is merged:
the validation release the restriction for document type 46

closes odoo/odoo#124392

X-original-commit: ee2485fd4c4e0f1ababbc74a0e1f349d58380cff
Signed-off-by: Josse Colpaert <jco@odoo.com>
Co-authored-by: Daniel Blanco <daniel@blancomartin.cl>
Co-authored-by: José Moreno Hanshing <jose@blancomartin.cl>
2023-06-12 15:26:46 +02:00
Dylan Kiss (dyki) 094ed83d4a [FIX] l10n_*: add missing tax closing accounts
* l10n_ae, l10n_ar, l10n_at, l10n_au, l10n_bg, l10n_br, l10n_ch,
l10n_cl, l10n_dk, l10n_es, l10n_hu, l10n_in, l10n_mn, l10n_nl, l10n_no,
l10n_pt, l10n_sa, l10n_se, l10n_sg, l10n_si, l10n_uk

Some localizations do not have any default account for tax closing.
This leads to the opening of a RedirectWarning when trying to do a tax
closing.

task-3082332

closes odoo/odoo#124003

X-original-commit: 14abe7acb11d522fb2b4a274ac0eb06d41e637ed
Related: odoo/enterprise#42071
Signed-off-by: Olivier Colson (oco) <oco@odoo.com>
Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
2023-06-07 08:59:00 +02:00
william-andre 8e6a3d7269 [REF] l10n_*: clean code
A lot of the separate files were kept up to now because it made the
process easier while applying the script to rebase.
The files can now be merged.

Some code is also cleaned by using CSV instead of a python dict.

Part-of: odoo/odoo#114164
2023-03-06 23:34:49 +01:00
Maximilien (malb) dae0b7ae9f [IMP] l10n_latam_invoice_document: removing duplicated code
Before this commit, the name and report name of document type for latam localization had been added in each latam localization. Since they depend on l10n_latam, we decided it would be better to just add translate=True to already existing field (name and report_name) instead of adding new field in those module. This commit corrects that.

Task-id: 3179209
Part-of: odoo/odoo#112803
2023-02-24 10:06:18 +01:00
william-andre d782b8b925 [IMP] l10n_*: convert CoA in new format
Converted using https://github.com/william-andre/transform_coa

closes odoo/odoo#110016

Related: odoo/enterprise#35836
Related: odoo/documentation#3336
Related: odoo/upgrade#4276
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-17 19:30:40 +01:00
wan 5125748616 [REF] account: remove chart template
Rewrite the whole chart template mechanism, removing the templates
stored in the database. The new format will mainly use CSV.

Speed up install time
---------------------

* About half of the time of installing a localization for the first time is
  taken by creating the template records. This new in code format gets
  completely rid of this.
* Creating the template records could often not be done in batch because
  of parent/children relations.
* The instanciation of the accounts on the company has been entirely
  reworked too, by
  - optimizing the order of creation of records to avoid UPDATE queries
  - using precomputed fields to avoid UPDATE queries
  - updating the translation in batch
  - deactivating logging in the chatter
  - avoiding access rights checks by checking the rights at the start

Overall, when installing a chart template for the first time, it is 4
times faster because half of the time spent on saving the template in
the database is not done at all anymore, and the instanciation on the
company is more than twice as fast.

Reduce technical debt
---------------------

There is no need to synchronize the templates with the real records
anymore. No need to use hooks to copy the data from one to the other.

It is easier to change a template in a stable version, which can often
be necessary due to legal reasons (i.e. a change of tax rates, reporting
tags,...)

Two modules have been removed:
* `l10n_generic_coa`: since there is nothing left datawise in this
  module, it can be integrated in `account` for free. It is just code
  and CSV.
* `l10n_multilang`: the fields that this module modified to be
  translatable are now always translatable:
  - there was an issue when updating modules that deleted all the
    translations because the fields were not translatable at some point
    during the loading of the registry, then they because translatable
    again but lost all translations because of the column type change.
  - most devs are not able to understand all the languages needed for
    all the localization available. Therefore, english has been added in
    the sources in most localization to understand better issues while
    debugging.
  - no need to call post init hooks anymore, doing the sync with the
    templates.
  - more: see "Translations" section

Because most of the data is now in CSV, it is also easier for product
owners to edit, audit, modify files themselves, removing one layer
during trivial development processes when only data should be changed.

More flexibility for declaration
--------------------------------

The data declaration can now be done easily in python or CSV.
A nice feature is that you can declare everything at once, even for some
more complex chart of accounts:
* if you have to set default taxes on accounts, would need to
  - declare the accounts because accounts are required on the taxes
  - declare the taxes
  - declare the taxes to put on the accounts
  This would lead to scatter information in multiple files. Now,
  everything can be declared in the same place and the loading of the
  chart of accounts will do the 3 steps automatically.
* if you have a relation of child/parent, you would first need to
  declare the parents then the children, and the loading would not be
  efficient because done one by one. Now, everything is done in batch
  automatically without having to think about it.

It is also easier to update fields on records where there was no field
for that on the templates, like
* setting a restriction for journals on accounts
* setting specific values on the company
* modifying journals and linking them easily by using the xml_id instead
  of having to compute it manually

Translations
------------

Some countries have multiple languages (i.e. Belgium uses officially
French, Dutch and German, and the CoA also has an official English
version) and we must support the languages in all these countries.
All these translations are known, and hard coded without using out
translation platform (Transifex). We also like to have the English
version (even if an official one doesn't exist) so that support can be
done more easily in databases using chart templates in other languages
(especially using a non roman alphabet).

Because the translations were not on Transifex for these records, it was
really hard to maintain: the translation templates (`.pot` files) were
not easy to extract as the automatic export would give values mixing
both the CoA and the menuitmes, the fields' strings,... But we don't
want to translate the CoA as we already know the value.
Managing the translations in the `.po` files was also annoying:
- it is easy to forget that the translations need an update too
- it requires a special editor, special terminal commands that everyone
  is not familiar with
- it is easy to make mistakes in the source string

The new format is the following: `field@en_US` where `field` is the
translatable field (usually `name`) and `en_US` is the locale code.
This allows to have the whole declaration on one line, everything in one
file. It also makes the process easier when debugging: instead of
searching for the translation in the `.po` files, it directly appears
next to the configuration of the account/tax/... .

Update of the code
------------------

The code can be updated using this script
https://github.com/william-andre/transform_coa
Forward ports can be managed too by stashing/resetting/checkout the new
modules or the changes in the modules updated in the same PR.

task-2687567

Part-of: odoo/odoo#110016
2023-02-17 19:30:40 +01:00
Maximilien (malb) c9e26ac79a [IMP] l10n_cl: translation
Before this PR, all this localisation was written in Spanish, but all the localisation have to be written in english and then translated back in the native language. This PR correct that.

closes odoo/odoo#112160

Task-id: 3166093
Related: odoo/enterprise#36801
Signed-off-by: William André (wan) <wan@odoo.com>
2023-02-13 16:20:52 +01:00
Daniel Blanco b4772177e6 [FIX] l10n_cl: add l10n_cl_activity_description field to community
since this value is used as a required field in website sale
[FIX] l10n_cl: add activity description field to company

closes odoo/odoo#95964

Related: odoo/enterprise#29462
Related: odoo/upgrade#3764
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-08-27 03:33:07 +02:00
Daniel Blanco a542cb3b3d [FIX] l10n_cl: adjust domain for vendor bills to exclude credit notes from in_invoice type
this fixes the domain of document types for vendor bills, (was failing since it included
invoices as a document type as option for
credit notes in the wizard and also fixes the opposite (credit notes in invoices generation)

closes odoo/odoo#98002

X-original-commit: 1a8a6c369b257bef87bc3efe62fc9b764a02ebf1
Related: odoo/enterprise#30368
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-08-16 11:39:57 +02:00
william-andre d8d47f9ff8 [REF] accounting v16. Yeeeeaah
TLDR:
* invoices are implemented using computed methods instead of onchange
* the synchronization only happens when switching tabs in the Form view
  to improve perfs.

_______________________________________________________________________

The whole engine of the synchronization of Invoices to the Journal
Entries has been refactored
* by using computed fields instead of onchange functions
* by synchronizing only from invoice to journal entry in `create` and
  `write`
* by saving when switching tabs on the Invoice form, to synchronize
  before showing the values

This comes with numerous advantages:
* no need to call the onchange methods manually
* no need to use the Form emulator to build invoices (i.e. EDI, OCR,
  intercompany, ...)
* the performance for invoices with many lines improves drastically, going
  from 2 minutes to 4 seconds to create an invoice with 500 lines
* the model is more declarative, we can now see how the values are computed
  instead of having the values being copied from various places.
* remove the hack in `onchange` that disabled the recursivity of it,
  which was unexpected and needed to be managed manually in all the
  onchange methods

This means that:
* Some fields need to be exclusively computed on journal entries values
  or invoice values, more specifically the Tax Summary widget.
  It is now
    - computed from entry lines, when opening the view
    - computed from invoice lines when changing those, because the tax lines
      will need to be recomputed anyways, erasing previously set values
    - set with an inverse function when saving; after the sync has been done
* Some possible operations previously possible have been dropped.
  (i.e. look at the removed test test_in_invoice_line_onchange_accounting_fields_1)
  This is because such a behavior was undefined (how is changing the balance going
  to affect the unit price? How is the amount currency going to affect it?)

_______________________________________________________________________

Implementation Details
----------------------

The "dynamic lines", meaning the payment terms and the tax lines are now
only created in the `create` and `write` functions.
In order to reduce code duplication, it has been implemented using
context managers used in both `account.move` and `account.move.line`
These context managers help comparing the values before/after, acting
like a local `onchange`, but getting benefit from the dirty flags from
the `compute` dependences.
This is relying on computed fields on the move (`needed_terms`) and on
the lines (`compute_all_tax`) which contain the values needed for the
related move.
Depending on the needed values and the existing values (`term_key` and
`tax_key`, respectively) the context manager will determine what needs
to be created/updated/deleted.

Some related changes are to produce a `dict` instead of a `str` for the
`tax_totals` (previously `tax_totals_json`) fields, by simplicity to
reduce the complexity of IO, and simplicity of debugging, because the
logic of the field needed to change (cannot be computed at the same time
anymore since it needed the lines to be synced)

By simplicity, and also because it makes more sense, some boolean fields
have been merged into `display_type`:
* `is_rounding_line`
* `exclude_from_invoice_tab`
* `is_anglo_saxon_line`

The `price_unit`, `quantity` and other "invoice fields" are now not set
anymore on lines that are not product lines since it didn't make any
sense to have it.

Performances
------------

You have to keep in mind that a simple `create` didn't compute a lot of
fields, for instance not taxes were set, no payment terms,...
Now it does.

```python
import random
from timeit import timeit
from odoo import Command
domain = [('company_id', 'in', (False, self.env.company.id))]
products = self.env['product.product'].search(domain).ids
partners = self.env['res.partner'].search(domain).ids
taxes = self.env['account.tax'].search(domain).ids
def create(nmove, nline):
    self.env['account.move'].create([
        {
            'move_type': 'out_invoice',
            'partner_id': random.choice(partners),
            'invoice_line_ids': [
                Command.create({
                    'name': f'line{i}',
                    'product_id': random.choice(products),
                    'tax_ids': [Command.set([random.choice(taxes)])],
                })
                for i in range(nline)
            ]
        }
        for j in range(nmove)
    ])
                                                             # After  | Before
print(timeit("create(1, 1)", globals=globals(), number=1))   # 0.11   | 0.09
print(timeit("create(100, 1)", globals=globals(), number=1)) # 2.76   | 2.50
print(timeit("create(500, 1)", globals=globals(), number=1)) # 14.56  | 12.34
print(timeit("create(1, 100)", globals=globals(), number=1)) # 1.03   | 5.52
print(timeit("create(1, 500)", globals=globals(), number=1)) # 3.99   | 125.02
print(timeit("create(50, 50)", globals=globals(), number=1)) # 19.44  | 79.55
```

Another metric that can be used is running the test suite with
`--test-tags=/account` (only `account` installed)
* before: 404s, 267127 queries (366 tests)
* after: 318s, 232125 queries (362 tests)

Why this commit title?
----------------------

Someone told me that this was the perfect way of naming your commits.
c04065abd8

task-2711317

closes odoo/odoo#96134

Related: odoo/upgrade#3715
Related: odoo/enterprise#29758
Signed-off-by: Laurent Smet <las@odoo.com>
2022-08-03 13:44:49 +02:00
Daniel Blanco 0a2c9da6c6 [FIX] l10n_cl: documents domain in sales journal to prevent availability of incorrect documents
(i.e. orden de compra, guia de despacho) if they are enabled

closes odoo/odoo#93763

X-original-commit: afde2ab2cd44078b812e3fdd1553a55650fa45c0
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-06-16 11:25:14 +02:00
aliya 3748595ac8 [FIX] l10n_cl: fix invoice totals
Task: 2817024

1. l10n_cl uses _prepare_tax_lines_data_for_totals_from_invoice() and _get_tax_totals() to prepare invoice totals for exporting invoices in pdf.
After the recent changes these methods no longer exist and invoice totals should be calculated in a different way.
2. Contact widget should not have ```'no_tag_br': True``` anymore to show the address properly.

closes odoo/odoo#88144

Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-04-11 11:01:59 +02:00
Andrea Grazioso (agr-odoo) 815b754ed2 [FIX] l10n_cl: unable to issue credit note (vendor bill)
Have a CL company setup
Issue a vendor bill
Then generate the credit note via 'Add Credit Note' wizard
Add a reason and confirm
Error will raise “You can not use a invoice document type with a refund
invoice”

As
https://github.com/odoo/odoo/commit/c9ff9d28ab75c02093ca54d9fbd1d2e203c5ee2e
for the invoice case
we need to add specific logic to handle credit notes in l10n_cl

opw-2801576

closes odoo/odoo#87946

X-original-commit: 0f1edf4d47d936c440e42fa105a8a5d6a75a8a77
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-04-05 13:20:56 +02:00
Juan Jose Scarafia 06f08f770d [FIX] l10n_ar/cl: starting sequence
When getting l10n_ar/l10n_cl starting_squence check with the proper
company (self.company_id) and not self.env.company_id

We do not put a journal_id anymore as it should take the correct one
automatically in v15.

Original commit d6f4fee58edf103c63836ac488be240961fd671a

closes odoo/odoo#87219

X-original-commit: f2f76dfa195226b7604076830412706447c168f2
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-03-31 17:25:06 +02:00
william-andre beb6e17066 [FIX] account: remove dead code complete_tax_set
This field was used in version 9.0 [1] to allow users to select their
tax rate, but it was removed in version 12 [2]

[1] https://github.com/odoo/odoo/commit/c04065abd8f62c9a211c8fa824f5eecf68e61b73
[2] https://github.com/odoo/odoo/commit/87f0d2eefb77bfc6a9a0fa7f7dcd1475c7c34639

closes odoo/odoo#80185

Related: odoo/enterprise#22441
Related: odoo/upgrade#3057
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
2022-03-31 17:24:55 +02:00
Andrea Grazioso (agr-odoo) 7d028396e0 [FIX] l10n_cl: unable to issue credit note
Have a CL company setup
Issue an invoice
Then generate the credit note via 'Add Credit Note' wizard
Add a reason (credit method is locked to 'partial refund') and confirm
Error will raise “You can not use a invoice document type with a refund
invoice”

This occur after
https://github.com/odoo/enterprise/commit/9e049b833b23809e4287ef61ddf7482413debefd

We now fall back to the logic of l10n_latam_invoice_document
which, in turns, fall back to the l10n_cl, ignoring the 'credit_note'
case.

opw-2794515

closes odoo/odoo#87116

X-original-commit: c9ff9d28ab75c02093ca54d9fbd1d2e203c5ee2e
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Grazioso Andrea (agr) <agr@odoo.com>
2022-03-24 12:57:29 +01:00
Raphael Collet a1904aa6f6 [IMP] core: field index names
The possible index names have been renamed "btree", "btree_not_null"
(instead of "not null") and "trigram" (instead of "gin").

Task 2742526

Part-of: odoo/odoo#83274
2022-01-28 14:10:01 +00:00
Fabien Pinckaers eedf37d6e2 [IMP] Better handling of indexes
Three supported types:
- btree (default for index=True)
- btree not null (when >90% of the data are null)
- gin trigram search (for char fields)

Review of indexes on all objects.

closes odoo/odoo#83015

Signed-off-by: Fabien Pinckaers <fp@odoo.com>
2022-01-19 16:52:23 +00:00
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
Daniel Blanco 3150ad15e4 [FIX] l10n_cl: adds l10n_cl_journal_active field and change tha active documents
[FIX] l10n_cl: adds new latam reference document types
[FIX] l10n_cl: add additional document references
[I18N] l10n_cl: translate as T.doc to reduce width of column
[FIX] l10n_cl: add l10n_cl_active to latam document type view
[FIX] l10n_cl: change account 410235 to direct cost instead of expenses
[FIX] l10n_cl: change account withholding of second category to most recent tax rate (-11.5%)

closes odoo/odoo#75865

Related: odoo/enterprise#20565
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-11-18 10:06:19 +00:00
Daniel Blanco d85a8acdcc [FIX] l10n_cl: modifications needed to create electronic vendor bill document type (46) since it is mandatory for some customers.
Adds new account to withhold vat tax, and new vat tax
Enables document type 46
Allow electronic docs in purchase journals
[FIX] l10n_latam_invoice_document Consider doc type 46 as a vendor document
More information -> https://www.sii.cl/preguntas_frecuentes/catastro/001_012_3665.htm

[RM] l10n_cl: remove _filter_taxes_included method

closes odoo/odoo#79479

X-original-commit: 0c34fe795cee7eb6f0c5678f9e505ccc9b6e57e8
Related: odoo/enterprise#22160
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-11-08 11:08:06 +00:00
Bruno Zanotti (ADHOC)andJuan Jose Scarafia ab9f36db24 [IMP] l10n_cl: calculate removed latam fields
Adapt the module to calculate removed fields from latam localization

closes odoo/odoo#78296

X-original-commit: 9269ac23e86cfd0218234360ac8271785697a725
Signed-off-by: Josse Colpaert <jco@openerp.com>
Co-authored-by: Juan Jose Scarafia <jjs@adhoc.com.ar>
2021-10-14 16:16:04 +00:00
Daniel Blanco 05317ef4b1 [I18N] l10n_cl: relax the condition for registering entries in purchase journal, in order to allow to record expenses without warnings.
closes odoo/odoo#77919

X-original-commit: 790a532898c07c69da6037a674bc805e30e46f45
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-10-06 00:48:42 +00:00
Touati Djamel (otd) 95e56d75ad [FIX] l10n_cl: correct Chilean VAT formatting
Problem 1 steps to reproduce the bug:
- Install `l10n_cl`
- Create a new company
    - Choose for example Algeria in country.
    - Enter this VAT number: CL220604497
- Save
- edit
- Change the country to Chile

problem:
VAT number is not formatted according to the Chilean VAT formatting,
Because in the write function we do not trigger the VAT formatting when the country changes

Bug introduced in this commit: https://github.com/odoo/odoo/commit/11ec94df926db98265d26af1072a0c8bf1843083

Problem 2, steps to reproduce the bug:
When you install `l10n_cl`, a Chilean company is created with these demo data: https://github.com/odoo/odoo/blob/7cc252908b33b7d77d45d0630464e203b25b09dc/addons/l10n_cl/demo/demo_company.x15ml#L

- The VAT is formatted according to the standard formatting instead of the Chilean vat formatting,
Because the field `" l10n_latam_identification_type_id "` is not defined: https://github.com/odoo/odoo/blob/f3a66dd65d041ffc7367d85d5603e9627efb9f2b/addons/l10n_cl/models/res_partner.py#L33-L34

so we will have this result: CL220604497 instead of 22060449-7

- create a vendor bill with this company
- try to print it
- a traceback is triggered, because we call the `_format_dotted_vat_cl` function which divides the vat in two parts
based on the dash and then processes the result without checking that there are two elements in the result.
As in our case here. The vat has no dash in the middle, so we will only have one part
an error is triggered when the function tries to access the 2nd element

https://github.com/odoo/odoo/blob/2b500c12c2540e593f3a243bf80de28bd335b7be/addons/l10n_cl/views/report_invoice.xml#L53

opw-2630877

closes odoo/odoo#75936

X-original-commit: d1369dbcc6c40297e7616b990aefa87a2eb4d5c3
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-09-20 10:53:39 +00:00
Katherine Zaoral 3654addf5c [IMP] l10n_cl, l10n_latam_invoice_document: move field
move l10n_latam_document_type_id_code field definition to latam module
in order to be re used by another latam localizations

closes odoo/odoo#75764

Related: odoo/enterprise#20513
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-09-01 09:38:51 +00:00
Touati Djamel (otd) 3fcec6db90 [FIX] l10n_cl: update VAT only if it is changed
Steps to reproduce the bug:
- install l10n_cl
- Create two contacts and for only one of the two fill in the "Identification Number" field
- Go to contact app > select both contacts to edit some of their fields at the same time
- For example, edit “City” > save

Problem:
The "Identification Number" of contact 1 is copied to the second contact,
while normally only the "city" field of the two contacts needs to be changed.
This is due to the fact that we do not check in the write function if the vat or identification_type are in values before changing the vat.

Solution:
check that `vat` or  `l10n_latam_identification_type_id` are in values before changing the vat

opw-2587994

closes odoo/odoo#75472

X-original-commit: 11ec94df926db98265d26af1072a0c8bf1843083
Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
2021-08-23 15:31:23 +00:00
Daniel Blanco c874bff3de [FIX] l10n_cl: modifications to report invoice to show tax included in boletas
[ADD] l10n_cl: add method to invoice report to format the vat dotted

closes odoo/odoo#73869

X-original-commit: 2b500c12c2540e593f3a243bf80de28bd335b7be
Related: odoo/enterprise#19705
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-07-16 12:30:16 +00:00
Nikunj Ladava a35700251a [REM] l10n_cl: remove sequence from journal
- latam document type was used in l10n_cl_sequence_ids and used the same
table in l10n_cl_journal_ids but it was never used any where

task- 2464212

closes odoo/odoo#71095

Related: odoo/upgrade#2478
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-08-03 13:01:39 +00:00
Susana a7e3d8755a [FIX] l10n_cl: Fix cannot post invoice with a contact as a partner
closes odoo/odoo#73801

X-original-commit: b375317140ffdeb9afd8d587806de7a5dd6da72a
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-07-15 17:45:17 +00:00
wan 060b26e95e [FIX] l10n_cl: do not remove document type for other countries
You don't want this for other latam countries.
2021-07-19 10:14:24 +00:00
wan 1e0bfff589 [FIX] l10n_cl: do not override _onchange_journal`
This method was defined in `account` but overrided in `l10n_cl`. Prefix
the method to avoid that.

X-original-commit: c60530eedc70f7bb6040adaf311a273bad5aa37c
2021-05-21 15:54:58 +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
fw-bot ad039ebeec [FIX] l10n_cl: return a different domain in available document types
when the partner is Tesoreria de la República, and exclude the credit note.

closes odoo/odoo#67630

X-original-commit: 8ca3ea063050f2ab2d19cce8a68116489872a734
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-03-11 14:54:50 +00:00
Daniel Blanco 08a7e0f38f [FIX] l10n_cl: exclude vendor bills from last sequence domain
closes odoo/odoo#63758

X-original-commit: 13b6550616a3d99643b0b3de3d75f4714fd9d2f2
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-12-23 18:13:20 +00:00
Qiuyu (QHO) d4f0bcaa36 [FIX] l10n_cl: _post() method should return in l10n_cl
Steps to reproduce:
1. Set the company with country "Argentina"
2. Install modules `account_accountant`, `l10n_ar`, `l10n_ar_edi` and `l10n_cl`
3. Create a new invoice
4. Confirm the inovice
=> TypeError: Mixing apples and oranges

Reason:
`_post()` method in `l10n_cl` module does not return any value so `None` is returned [1]
The return value is used to be concated in `_post()` method in `l10n_ar_edi` moodule [2]

Solution:
`_post()` method should return `account.move` object

opw-2409156

[1] https://github.com/odoo/odoo/blob/14.0/addons/l10n_cl/models/account_move.py#L99
[2] https://github.com/odoo/enterprise/blob/c814ab1ad67140c9976860fab5ff37e6c713733d/l10n_ar_edi/models/account_move.py#L150

closes odoo/odoo#62963

X-original-commit: 82cad06e934de0cb559c15ddd7a687ab8a4432d4
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-12-07 14:32:43 +00:00
Victor Feyens 1b67affe7d [FIX] *: avoid direct references to countries
Ensure the code works fine even if countries are deleted.

Also consider "re"-created countries after deletion, by only considering
the country code, not the data reference.

This should reduce support requests related to deleted countries, and
ease the resolution of such problems by the users themselves.

TASK ID - 2368842

closes odoo/odoo#60558

X-original-commit: 037012bc4e2935eb00a7f353529bb7ec55066733
Related: odoo/enterprise#14347
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2020-10-22 16:17:26 +00:00
Daniel Blanco 15d6e0f47b [ADD] l10n_cl: forward to 14.0
closes odoo/odoo#58889

X-original-commit: faea1fec6b0a8571e5f61c1a891cfa708b0a9075
Related: odoo/enterprise#13721
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-09-30 12:30:53 +00:00
Daniel Blanco 2b6412de68 [FIX] l10n_cl: allow to generate document type "boleta" for foreign customers
fixes #56982

[FIX] l10n_cl: allow to generate document type "boleta" for foreign customers

closes odoo/odoo#57012

X-original-commit: 8df301383d9b2d960ca17ff547a12b1324f93bda
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-09-03 09:47:04 +00:00
Katherine Zaoral a0653089fe [REF] l10n_cl: Add custom report
Port foward from 13.0 branch . Also adapt _get_name_invoice_report()
method to match the new method in account.
2020-08-17 14:09:18 +00:00
william 82dc0cb7b9 [IMP] account: soft post entries in the future
Add an easy way to not post the entries in the future when calling
post() on it, but rather set it to be auto-posted at accounting date.
This is useful when we are creating a lot of entries in batch and some
might be in the future, some in the past, and we don't want to separate
that in two batch every time. (asset, accrual, transfer,... )
2020-08-05 11:57:10 +00:00
Andrea Grazioso (agr-odoo) a100c4c336 [FIX] l10n_cl: Correct document type domain
Create an invoice, fill document type
"(61) Nota de Crédito Electrònica". Save.
Action will be blocked by a warning: document type is invalid.

Some options in the document type should not be shown as they can not be
used in the customer invoices and customer credit note.

opw-2286623

closes odoo/odoo#53987

X-original-commit: 3b9738a394c4944b0c859f68f561e50d14b92942
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-07-02 13:03:08 +00:00
Daniel Blanco f3a66dd65d [FIX] l10n_cl: Several fixes and improvements for l10n_cl
[FIX] l10n_cl: format RUT/VAT as used in Chile (99999999-X)
[FIX] l10n_cl: prevent errors with domain of available documents in invoice view.
[FIX] l10n_cl: allow to select document types when partner is empty
[ADD] l10n_cl: add ILA taxes (purchase and sale) and assign account to taxes
[ADD] l10n_cl: add fiscal position exempt for purchases and sales
[IMP] l10n_cl: configure accounts used in inventory valuation
[FIX] l10n_cl prevent to put unneeded sales documents in sales journal
[FIX] l10n_cl limit revision of document types and partner constrains only for sale and purchase journals
[FIX] l10n_cl: add extra validation to know wether there is a latam_document_type_code selected
[ADD] l10n_cl: add document type '801' Orden de compra
[WIP] add tag to costo de ventas account
[FIX] l10n_cl: fiscal position templates: fix supermarket tax
[FIX] l10n_cl: change order for boletas
[WIP] l10n_cl: fix the compute document types method
[FIX] l10n_cl: prevent expected singleton error (checked in tests) in post
[I18N] l10n_cl: add new translations
[I18N] l10n_cl: reduce size of taxes names and abbreviation for invoices (probably more work to add here)
[FIX] l10n_cl: remove countries from accounts
[FIX] l10n_cl: remove recalc of domain when journal changes
[FIX] l10n_cl: remove sale constraint

closes odoo/odoo#53068

X-original-commit: 060f083879f6094941f746928832fec253a23bb0
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-06-16 13:28:00 +00:00
Josse Colpaert 55b06152bc [FIX] l10n_cl: backport from master
* avoid doing super where we removed the super method: Was done in adapting l10n_cl to do without the methods in l10n_latam_invoice_document
* journal name to create
* at least fix for the document type itself
* making it work like before with shared sequences

closes odoo/odoo#49095

closes odoo/odoo#51496

Related: odoo/enterprise#9699
Related: odoo/enterprise#10654
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-05-19 07:23:41 +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
wan dfd01b8c5c [IMP] account: rework name sequences
Task 2146469

Rework the name computation:
* It doesn't use ir.sequence anymore
* It is an editable computed field
* Add a renaming tool

This allows the user to tweak the sequences more easily than having to
get through the ir.sequence settings.

The sequence depends on a parameter of the journal: continuous, montly
and yearly restart of the sequence. Everytime a new period is started,
try to make a pattern form another period.

The incrementing is done by taking the previous name, ordered
lexicographically, splitting it by taking the digits at the end, adding
1 and re contstruct with the prefix.

** This means there could be cases where the prefix has a big importance
on the next number. For instance, if you have
INVOICE/2019/0001
INVOICE/2019/0002
and then rename the last one to INV/2019/0002, don't expect the next
number to be INV/2019/0003. It will be INVOICE/2019/0002 (again) because
the highest number was INVOICE/2019/0001.
You will then end up with
INVOICE/2019/0001
INV/2019/0002
INVOICE/2019/0002

closes odoo/odoo#41485

Related: odoo/enterprise#7189
Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2020-02-05 13:59:43 +00:00
Daniel Blanco 46b1218094 [FIX] l10n_cl: taxpayer type and sequences of document type
Description:
- Add readonly attribute to partner view for l10n_cl_sii_taxpayer_type field for children res.partner records.
- Fix the tax payer type label to prevent usage of "label for.."
- Optimize document type order to put most used on top of file and in selection of document types during invoicing process

closes odoo/odoo#41372

X-original-commit: 4162b9b618ffe62548e9a1d5ae3c0fdd604a1395
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-04 17:21:15 +00:00
Josse Colpaert 0940bfcfd5 [FIX] l10n_cl: avoid warnings on module install
X-original-commit: c6a00ff1c29481e826c81f551cacf60f054c15f8
2019-11-27 12:55:56 +00:00
Susana 38e7ba14cc [FIX] l10n_cl: fixed wrong domain getting document types
closes odoo/odoo#38446

X-original-commit: 089a9d9fb447a5717469bf931a62526d5462a361
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-10-11 01:16:21 +00:00