Commit Graph
53 Commits
Author SHA1 Message Date
Gorash 75a105f46a [REF] base/all: Update modifier syntax: remove 'states' from fields
These changes are made as a result of simplifying attrs and 'states' in
views. However, they should have remained in a separate commit. When
applying the script making the xml changes (used later for the migration
script), the script checked the definition of the python fields in order
to convert the information into a python expression. Therefore, this
commit is not applied when the script is applied to xml changes.

During this attribute deletion pre-existing errors were found. Part of
the code was using the boolean values of 'states' and another part of
the code was not. The behavior could therefore be different (in cases
where readonly on the field had the same value as the ballan in
'states').

Following the deletion of 'states' and without the application of the
view migration, the js tests (tower) were no longer functional. Tests
using the Form view suffered the same effect. There are few tests that
had to be adapted, including two tests in business accounting (updated
by the accounting team). A test for column_invisible did not work. Test
checking if the test system triggers an error if we try to write on an
invisible field. It turns out that Form was testing on the value of
invisible but not taking into account if the column was invisible. The
test system fix is applied separately because there were a lot of tests
that were incorrect.

Part-of: odoo/odoo#104741
2023-08-18 09:49:11 +02: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
hupo-odoo a4583a1aa6 [IMP] l10n_{mx,ua,in,dz,ma}: activate default setting
For Mexican localization, activate by default the setting display_invoice_amount_total_words for the Mexican localization. As this localization uses its own amount to words function, the related commit enables an override of the generic function to use it correctly with Mexican localization.

For the other mentioned localizations (ua,in,dz,ma), the setting was already activated but overriding the create method was not a proper way of doing.

task - 3367243

closes odoo/odoo#124909

X-original-commit: 6ee9842764e0b1244927cb8ece1f6407ccec20d5
Related: odoo/enterprise#42510
Signed-off-by: Laurent Smet <las@odoo.com>
Signed-off-by: hupo-odoo <hupo@odoo.com>
2023-06-14 10:54:24 +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
Nishant Jain (niai) 4a935d3937 [IMP] l10n_in: audit trail improvement
With this commit, Made the tree line clickable instead of clicking View Related
Document Button. Updated the description, to be similar to chatter in audit trail
tree view. Also Updated error message while deleting entries once it's posted for
Indian Company.

closes odoo/odoo#122566

X-original-commit: 8833329191acc56468a62b3f00171c14d0252eb7
Signed-off-by: William André (wan) <wan@odoo.com>
Signed-off-by: Nishant Jain(niai) <niai@odoo.com>
2023-05-30 15:39:50 +02:00
kir-odoo 02cd8ebe02 [ADD] l10n_in: merge l10n_in_upi l10n_in
merge l10n_in_upi into l10n_in

closes odoo/odoo#111299

Related: odoo/upgrade#4272
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-05-22 16:29:57 +02:00
oco-odoo b96dc99f03 [FIX] account: tax computation: when forcing the tags on caba taxes, also force the account
Cash basis taxes use a distinct transition account on their tax lines; the tax account set on the repartition lines is only used when the payment is received, on the cash basis move.

In enterprise, the bank reconciliation widget allows setting a tax on the manual write-off done for a statement line. When doing so, we expect the tax to behave just like on an invoice. For cash basis taxes, this means the "final" tax account has to be used instead of the transition one ; it wasn't the case.

OPW 3255511

X-original-commit: 991fa46081296c3560bd7ca195996693a81a46b8
Part-of: odoo/odoo#120924
2023-05-10 20:15:29 +02:00
Jigar Vaghela 6eb8213d0e [IMP] l10n_in: Audit Trail
In Indian government required audit trail report for private limited companies
So from this commit user can't delete journal entries after posting once.

Create an audit trail report from mail.message to show a full log of journal entries

task - 3239932

closes odoo/odoo#118945

X-original-commit: f4365ee1c6e979e352ece66b03f3c00e830f2117
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-04-18 19:29:12 +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
Hansun (hale) 99c694c4a7 [FIX] l10n_in: Place of supply editability for Indian companies
1. Install [Expenses], [Indian - Accounting], [Accounting] on Apps
2. [Settings] [Users & Companies] [Companies]
- create a company based in India with address there
3. Enter [Expenses], [CREATE]
- create and add an employee w contact info (private address) in India
- set paid by: Company, write an amount, category > [CREATE REPORT]
- [SUBMIT TO MANAGER] [APPROVE] [POST TO JOURNAL ENTRIES]
4. Click on the [Journal Entry] created at the top right corner

Issue: Missing pos field hinders revising it by [reset to draft]

Resolve by: change the requirement in view and enable further revision

Impacted versions: 16.0 up to master

opw-3168426

closes odoo/odoo#113270

X-original-commit: bc08a6e9d0cc42d1586913bf95d01d4547c13b05
Signed-off-by: Josse Colpaert <jco@odoo.com>
Signed-off-by: Lee, Hansun (hale) <hale@odoo.com>
2023-02-21 21:07:49 +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
william-andre 88de6c41ee [MOV] l10n_in{,_tcs_tds}: merge modules
Part-of: odoo/odoo#110016
2023-02-17 19:30:37 +01:00
hupo-odoo 014590a005 [IMP] l10n_{dz,in,ua,ma}: invoice amount in words
As it is now possible to activate the total amount of an invoice in letters, these localizations (dz,in,ua,ma) need by default the feature to be activated. In addition, some of them had aleady such feature which has therefore been removed to accommodate the new generic feature.

The indian localization also has a different message on the right side of QR code on invoices

closes odoo/odoo#107714

Task: 3097097
Pr: 107714
Related: odoo/enterprise#35959
Signed-off-by: Florian Gilbert (flg) <flg@odoo.com>
2023-02-09 08:46:45 +01:00
Nishant Jain (niai) 68057e7161 [IMP] l10n_in: auto set GST Treatment only for Indian invoice/bill
After this commit GST treatment will be only assigned to Indian invoices/bills.

closes odoo/odoo#111738

X-original-commit: 6ede766eab05b621bfee6e6af259c7d2d0bfbd94
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-02-03 10:35:44 +01:00
Nishant Jain (niai) fcd6c6d400 [IMP] l10n_in: auto set GST Treatment in invoice/bill
Before this commit
==================
GST Treatment will not be assigned to those invoices/bills
whose partners don't have GST Treatment.

After this commit
=================
GST Treatment will be assigned to those invoices/bills whose
partners don't have GST Treatment.

closes odoo/odoo#111528

X-original-commit: de944b54715db0a0b6898fb9b049449c5ced29c9
Related: odoo/enterprise#36555
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-02-03 05:09:28 +01:00
Nishant Jain (niai) a5465a91a2 [IMP] l10n_in: indian integration setting in one block
Before this commit
==================
all the settings of Indian integration like E-waybill,and e-invoice were
having different setting blocks.

After this commit
=================
all the Indian integration settings will be shown in one setting block.

closes odoo/odoo#111175

Related: odoo/enterprise#36382
Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
2023-01-31 12:55:58 +01:00
bat-odoo 361ac275c7 [IMP] l10n_in: set partner state in Place of supply only when journal type is sale
Currently, the Place of supply value is set from the partner state for all journal types.

So in this commit, we set the partner state in `Place of supply` only when
the journal type is a sale. Also added the country domain in XML view.

Part-of: odoo/odoo#109717
2023-01-16 10:32:17 +01:00
Jigar Vaghela f9efc2b75f [IMP] l10n_in: simplify place of supply
We just set a place of supply(state_id) from partner_id in the Invoice/Bill if partner country is india because there are many complex cases so we can't get it automatically in all cases like
(a) where the supply involves movement of goods, whether by the supplier or
the recipient or by any other person, the place of supply of such goods shall be the
location of the goods at the time at which the movement of goods terminates for
delivery to the recipient;

(b) where the goods are delivered by the supplier to a recipient or any other
person on the direction of a third person, whether acting as an agent or otherwise,
before or during movement of goods, either by way of transfer of documents of title
to the goods or otherwise, it shall be deemed that the said third person has received
the goods and the place of supply of such goods shall be the principal place of business
of such person;

(c) where the supply does not involve movement of goods, whether by the
supplier or the recipient, the place of supply shall be the location of such goods at the
time of the delivery to the recipient;

(d) where the goods are assembled or installed at site, the place of supply shall
be the place of such installation or assembly;

(e) where the goods are supplied on board a conveyance, including a vessel, an
aircraft, a train or a motor vehicle, the place of supply shall be the location at which
such goods are taken on board.

we add new state "Other Country" to set place of supply(state_id) incase of partner country is not India
for more details check CHAPTER V here https://www.cbic.gov.in/resources//htdocs-cbec/gst/igst-act.pdf;jsessionid=63D695F612B9972934E8131415FEBA28

closes odoo/odoo#82011

closes odoo/odoo#109286

X-original-commit: https://github.com/odoo-dev/odoo/commit/b76ee098e2a4c4d26d6d1c689bb0750e770201dc
Signed-off-by: Quentin De Paoli <qdp@odoo.com>
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-01-13 11:40:13 +01:00
bat-odoo 7269e6a0c4 [IMP] l10n_in{_edi}: improvements in UX
In this commit, the following points are covered

- updated error messages
- remove renaming the `Customer Invoices` journal name
- updated Fiscal Opening Date and Year End for Indian localization
- updated Indian E-Invoicing report and settings setup

Part-of: odoo/odoo#109396
2023-01-12 11:09:23 +01:00
bat-odoo a634aafe4d [REM] l10n_in*: removed multi GSTIN
In this commit, we have removed the multi-GSTIN feature from the journal.

Multi-unit is created if there is a different branch with the same GSTIN(vat) so
now we decided to create a multi-company instead of this.

because functionally we discuss with Indian CA and we find out that it's good
practice if we create a different company.

The main problem is one company and the same Bank account but we also find a
functional solution using a transfer balance to another company.

so we remove this so our other integrations do not have complexity
like E-invoice, E-waybill, GST E-filing

TaskID - 2723109

closes odoo/odoo#107234

Related: odoo/upgrade#4107
Signed-off-by: Josse Colpaert <jco@odoo.com>
2023-01-02 09:53:57 +01:00
Jigar Vaghela dc53124a09 [IMP] l10n_in*: remove l10n_in_shipping_gstin
Companies only get a tax credit on the bill to GST number(vat), not on the shipping GST number.

task - 2723111

closes odoo/odoo#81977

Related: odoo/upgrade#3493
Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-08-30 20:21:41 +02:00
oco-odoo b7232b14b7 [IMP] account, l10n_*: Introduce unified reporting engine
This commit adapts account's model to the new report engine introduced for v16, and updates the data files accordingly.

account.report model is now declared in community, together with the other models used by the reporting. This is done so that the tax tags can properly be created by the tax report and used on tax templates. All the actual computation logic stays in enterprise.

See enterprise commit for full details.

Task 2524389

Part-of: odoo/odoo#94125
2022-08-25 19:56:55 +02:00
Mohammed Shekha 0fc93fb1e4 [IMP] l10n_in: change fiscalyear_last_month to march
With this commit: we are changing fiscalyear_last_month to March if
chart template is Indian chart template as fiscal year ends in 31 March
in India.

task-2723849

closes odoo/odoo#81982

Signed-off-by: Josse Colpaert <jco@odoo.com>
2022-04-19 14:19:40 +02:00
Jigar Vaghela 534167bf96 [IMP] l10n_in: update demo data, add tax report line and method to get warehouse address
add get warehouse address method
needed in Indian EDI to pass value of dispatched address

improve demo data and bypass one GST number from validation because that GST number use to test EDI

Add Non GST Supplies and State CESS tax report line
Non-GST Supplies and State CESS is required to get related value from the invoice for send EDI

Part-of: odoo/odoo#79995
2022-04-06 16:45:30 +02:00
Laurent Smet cd6c33575b [IMP] account: Add generic methods to help the taxes computation
Unify taxes computation between 'account', 'sale' and 'purchase' including:
- computation of price_subtotal/price_total.
- computation of business models total (using the json field)

closes odoo/odoo#80231

Task: 2654784
Related: odoo/enterprise#25620
Signed-off-by: Olivier Colson <oco@odoo.com>
2022-03-29 20:20:15 +02:00
Arnold Moyaux b4f2c40815 [FIX] l10n_in_stock: move code from l10n to l10n_stock
l10n doesn't depend of stock so move it to l10n_stock to have
correct dependencies

closes odoo/odoo#84173

X-original-commit: f1c55ec86102bfd52730f34eb19d002d4e22a3d2
Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-02-08 14:53:55 +00:00
Arthur Gossuin (goa) 5e849006db [IMP] l10n_in: always generate commercial invoice
The commercial invoice is usually only needed when the country of the
sender is different from the country of the recipient, however, for india,
commercial invoice is mandatory, even if the goods dont leave the country:
https://cleartax.in/s/commercial-invoice/#commercial

closes odoo/odoo#82084

Signed-off-by: Arnold Moyaux <arm@odoo.com>
2022-01-18 11:02:02 +00:00
Adrien Minet e8c60ad132 [FIX] l10n_in: copying gst treatment from client
How to reproduce:

- Switch to an Indian-based company
- Create a non-Indian customer and set gst treatment
- Create a subscription for the new customer
- Generate an invoice for the subscription
- The gst-treatment field will be empty

Bug:

When creating a new account.move object, the gst treatment is not copied.

closes odoo/odoo#80966

Opw: 2662308
X-original-commit: a1f0ae25f8b96a5ff5691aa0b9ffeb62033932bf
Signed-off-by: Laurent Smet <las@odoo.com>
2021-12-08 12:52:18 +00:00
Aurélien (avd) ce5b81315b [FIX] l10n_in: improve perfs of l10n_in invoice report.
Slightly change the view of account_invoice_report to add
a CTE to prefilter rows before joining with account_move_line.

Add a multicolumn for (product_id, move_id) on account_move_line
to speed-up cess_amount computation.

closes odoo/odoo#77952

X-original-commit: 7b743fbb7a98c45f12979c6c5ac7baa7c34d421a
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-10-06 12:39:54 +00:00
Denis Ledoux e1dee01068 [FIX] l10n_in: expected singleton error when posting multiple moves
```
ceback (most recent call last):
  File "/home/odoo/src/odoo/14.0/odoo/service/server.py", line 1199, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/odoo/src/odoo/14.0/odoo/modules/loading.py", line 474, in load_modules
    migrations.migrate_module(package, 'end')
  File "/home/odoo/src/odoo/14.0/odoo/modules/migration.py", line 180, in migrate_module
    migrate(self.cr, installed_version)
  File "/tmp/tmpgxy7cwao/migrations/account/saas~13.4.1.1/end-09-payment-refactoring.py", line 618, in migrate
    util.iter_browse(env["account.move"].with_context(**ctx), ids, chunk_size=1024).action_post()
  File "/tmp/tmpgxy7cwao/migrations/util/orm.py", line 169, in caller
    return [getattr(chnk, attr)(*args, **kwargs) for chnk in chain(it, self._end())]
  File "/tmp/tmpgxy7cwao/migrations/util/orm.py", line 169, in <listcomp>
    return [getattr(chnk, attr)(*args, **kwargs) for chnk in chain(it, self._end())]
  File "/home/odoo/src/odoo/14.0/addons/sale/models/account_move.py", line 14, in action_post
    res = super(AccountMove, self).action_post()
  File "/home/odoo/src/odoo/14.0/addons/account/models/account_move.py", line 2649, in action_post
    self._post(soft=False)
  File "/home/odoo/src/odoo/14.0/addons/sale/models/account_invoice.py", line 81, in _post
    posted = super()._post(soft)
  File "/home/odoo/src/odoo/14.0/addons/purchase_stock/models/account_invoice.py", line 188, in _post
    return super()._post(soft)
  File "/home/odoo/src/odoo/14.0/addons/l10n_in/models/account_invoice.py", line 108, in _post
    elif self.journal_id.type == 'purchase':
  File "/home/odoo/src/odoo/14.0/odoo/fields.py", line 963, in __get__
    record.ensure_one()
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 4993, in ensure_one
    raise ValueError("Expected singleton: %s" % self)
ValueError: Expected singleton: account.journal(4, 3, 59, 99, 18, 11, 8, 77, 10, 72, 21, 66, 92, 88, 74)
```

upg-30689

closes odoo/odoo#76875

X-original-commit: 4d3774a4d8692293cc89a3b505811172556e2d03
Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2021-09-21 09:38:13 +00:00
Jigar Vaghela a94b78de16 [FIX] l10n_in: quantity in tax and base grouping key create an issue
We need quantity in tax line and we added from this PR https://github.com/odoo/odoo/pull/73402
but after it creates a problem in tax amount
because in tax line, the unit price is set base on quantity and by default is 1 but after PR 73402 it's the same as invoice line so rounding issue is there and this rounded amount is multiplay by quantity so this creates a big difference

before PR 73402:

 Name      | unit price | quantity | taxable amount |
=====================================================
 Product A | 5.55       | 8000     | 44400          | (invoice line)
 Tax 5.0%  | 1          | 8000     | 2220           |
```

After PR 73402:

 Name      | unit price | quantity | taxable amount |
=====================================================
 Product A | 5.55       | 8000     | 44400          | (invoice line)
 Tax 5.0%  | 0.27       | 8000     | 2160           |

So in this PR we remove quantity from grouping key

closes odoo/odoo#74818

X-original-commit: aa160f4c0a04500bd91eea8da2cec165a15270a6
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-08-09 11:44:57 +00:00
Laurent Smet 9581b97c18 [FIX] account: Fix 'amount_by_group' field of invoices
When dealing with multiple taxes per line being on the same tax group, the base wasn't well computed.

closes odoo/odoo#73970

X-original-commit: b04a336c7516486e598bc69b4fee156d17f1b349
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2021-07-19 13:32:40 +00:00
wan 514f640cd1 [FIX] l10n_in: missing .id on uom.uom
Introduced in
https://github.com/odoo/odoo/commit/18a823e379ba023c176299c4034b3b28d09c2336
2021-07-19 10:14:25 +00:00
Jigar Vaghela 18a823e379 [FIX] l10n_in: HSN report not have right quantity and UOM
This is already there before refactoring in saas-12.4
you can check here https://github.com/odoo/odoo/blob/saas-12.3/addons/l10n_in/models/account_invoice.py\#L73

also add id in group by becouse if there is invoice line have same product,qty and uom then qty is wrong.

For example:
we have there is the same product with the same quantity and UOM like

```
 Product | quantity | UOM
 =========================
 Mobile  | 2        | Unit
 Mobile  | 2        | Unit
```
then tax line is not split so report count qty is 2

opw-2563120

closes odoo/odoo#73803

X-original-commit: 49e6bc9c499a511d479282dc67c1560e1c6bae5b
Signed-off-by: Josse Colpaert <jco@openerp.com>
Signed-off-by: Jigar Vaghela <jva-odoo@users.noreply.github.com>
2021-07-15 17:49:42 +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
Jigar Vaghela 8f647c07e4 [FIX] l10n_in: If vat is not available in delivery address then check same in customer
This below case is not working before this commit:
when Bill to Ship to where Delivery address partner is not registered and not have GSTIN

closes odoo/odoo#65599

X-original-commit: d9b409247303c6b165a7df381169f2480a19900f
Signed-off-by: Josse Colpaert <jco@openerp.com>
2021-02-05 12:26:16 +00:00
Laurent Smet bbde182022 [FIX] l10n_in: Fix custom taxes grouping only for indian company
closes odoo/odoo#61378

X-original-commit: cf3258f47b6ddf061e9bb2c525b2fd064cbab85b
Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
2020-11-05 10:14:22 +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
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
Jigar Vaghela 205430ffb5 [IMP] l10n_in: Simplify GST invoice
GST Treatment:
   * Is show that how This invoice or partner is treated in GST
   * Set default value in customer
   * This is help in GST retrun filing.
   * Value of treamtmnet as below
	- Registered Business - Regular
	- Registered Business - Composition
	- Unregistered Business
	- Consumer
	- Overseas
	- Special Economic Zone
	- Deemed Export
   * GSTIN is required in
	- Registered Business - Regular
	- Registered Business - Composition
	- Special Economic Zone
	- Deemed Export

GSTIN:
   * GST identification number or GST number
   * There can be multiple GSTIN for a single person, being an assessee under the Income Tax Act for every State or Union Territory in which such person operates from
   * Add Validate of this number using regular expression

remove field l10n_in_export_type and l10n_in_import_export becouse it's covered by GST Treatment
remove field l10n_in_partner_vat becouse not use anyware.
2020-04-30 07:20:06 +00:00
Ravi Gohil b4f0e758eb [IMP] l10n_xx: hide country specific fields from company/settings view
There are few fields added on settings and on company form view
by various l10n modules which are meant for particular country's
user and are of no use to others. Such fields should be hidden
from unrelated users. With this commit, it will be the case.

closes odoo/odoo#35755

Task: 2049977
Closes: #35755
Related: odoo/enterprise#5158
Related: odoo/enterprise#5158
Signed-off-by: Josse Colpaert <jco@openerp.com>
2020-03-24 06:59:35 +00:00
Jigar Vaghela 616864e968 [FIX] l10n_in: Fix tax grouping key
tax grouping key from base and tax line that will be used as a key to group taxes together
so both functions must have the same dictionary key. (you can check comment here https://github.com/odoo/odoo/blob/13.0/addons/account/models/account_move.py#L412)

here we have three key (product_id,product_uom_id,quantity) in _get_tax_grouping_key_from_base_line
and only one key (product_id) in _get_tax_grouping_key_from_tax_line

so we get wrong tax calculation

now we remove that extra key(product_uom_id, quantity) because we don't need group by these key values.

closes odoo/odoo#41340

X-original-commit: a758e5eace55bad0c11f8a27ba83e8367d293487
Signed-off-by: Josse Colpaert <jco@openerp.com>
2019-12-04 10:41:06 +00:00
Lucas Perais (lpe) e47e74afc4 [FIX] account, l10n_in: amount by group base when overriden
Fine tuning of 7bea912
In india there are as many tax lines on an invoices as there are
repartition lines (classic) * products

So, before this commit, preventing adding the base if tax was already seen
was not enough, the base was still added many times

After this commit, hopefully, the based on amount is correct for each tax

Forward port of #37390

closes odoo/odoo#37784

Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-10-02 13:00:58 +00:00
Jigar Vaghela ea9e8a37d6 [IMP] l10n_in*: multi GSTIN Using journal
=======
Purpose
=======

    government rule that "GST registration should be obtained by a taxable person under GST in each of the State or Union Territory, from where the taxable supply of goods or services is made"
    So we managed this using journal
    User create journal and partner for other states
    After user can select journal in Sale order, Purchase order and warehouse

========
Solution
========

    -Add a field on the journal to define the GSTIN
    -Add sale and purchase journal field in warehouse
    -On the SO/PO, add the journal field and based on the warehouse journal it set automatically fill if warehouse journal is set.

task 1917619
2019-09-27 11:39:39 +00:00
Adrian Torres 4b38cc6590 [REM] *: calls to @api.multi
Multi is the default api for methods, it is not necessary to explicitly
decorate methods with it, adds clutter and most people use it because
they see that the rest of the code uses it.

Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-17 14:13:12 +02:00
Laurent Smet bc131c0cfb [MERGE] manual forward port of accounting-pocalypse (beaa30a3d1)
This commit merges the following models
 * account.invoice and account.move
 * account.invoice.line and account.move.line
 * account.voucher and account.move
 * account.voucher.line and account.move.line

It was the opportunity for a big cleanup of the code, so it also restructures the whole account module, its different models/fields, the tests etc. for a better world and a better code readability.

==== Rationale ====
The rationale of this huge change is that we want journal entries / invoices to be easily edited, and changes reflected in the other model. It's a HUGE feature and very strategic for the fiduciary companies. For example, changing the account of a journal entry needs to be automatically reflected on the related invoice.

The same reasoning applies to sale/purchase vouchers.

==== Changes made in features =====
When creating an invoice, you are now creating a journal entry directly.
--> The object account.invoice no longer exists.
In the same fashion when creating an invoice line, you're now adding journal items directly in the journal entry representing the invoice. If this invoice line has some tax, it may create additional journal items as well.
--> The models account.invoice.line & account.invoice.tax no longer exist

Identically, when creating a sale/purchase receipt with its lines, you are now creating a journal entry directly and there's no more usability difference between encoding a receipt or an invoice.
--> The object account.voucher no longer exists.
--> The object account.voucher.line no longer exists.
--> The whole account_voucher module no longer exists.

Positive side-effects coming from these changes are
* draft invoices/bills/sale or purchase receipts now create a draft accounting entry. Validate these objects now simply post its journal entry. That means that draft invoices/bills/sale or purchase receipt can straightforwardly be included in reporting or budgets.
* opening a journal entry in form view will now always open the correct view: if it's a sale/purchase journal entry we will have a customer invoice/vendor bill view or a sale/purchase receipt view, whatever the menu we're coming from.
* code & business logic simplification. It is also condensed in a single place instead of being partially duplicated on invoices, vouchers and journal entries.

There should be no feature loss, except the one allowing to group multiple journal items together based on the same product during the invoice validation.

==== Changes made in models =====
* account.invoice: model removed. Instead, now use account.move with following mapping

field (account.invoice) 		field (account.move)
-----------------------			--------------------
name 					invoice_payment_ref
number 					name
reference 				ref
comment 				narration
user_id 				invoice_user_id
amount_					total_company_signed amount_total_signed
residual 				amount_residual
state 					state + invoice_payment_state 		/!\ selection changed
date_invoice 				invoice_date
date_due 				invoice_date_due
sent 					invoice_sent
origin 					invoice_origin
payment_term_id 			invoice_payment_term_id
partner_bank_id 			invoice_partner_bank_id
incoterm_id 				invoice_incoterm_id
vendor_bill_id 				invoice_vendor_bill_id
source_email 				invoice_source_email
vendor_display_name 			invoice_vendor_display_name
invoice_icon 				invoice_vendor_icon
cash_rounding_id 			invoice_cash_rounding_id
sequence_number_next 			invoice_sequence_number_next
sequence_number_next_prefix 		invoice_sequence_number_next_prefix

'invoices' subset of account.move can be accessed by using the selection field 'type' or one of the many helpers like is_invoice()

* account.move: now has a valid state 'cancel' that has to be excluded from all business logic
* account.move: field 'amount' renamed into 'amount_total'
* account.move: field 'reverse_entry_id' renamed into 'reversed_entry_id'
* account.move.line: now has a field 'display_type' that has to be excluded from all business logic, in order to support invoice layouting
* account.invoice.line: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.line) 		field (account.move.line)
----------------------------		-------------------------
invoice_id 				move_id
uom_id 					product_uom_id
invoice_line_tax_ids 			tax_ids
account_analytic_id 			analytic_account_id

'invoice lines' subset of all account.move.line from a journal entry can be accessed by using the boolean field 'exclude_from_invoice_tab'

* account.invoice.tax: model removed. Instead, now use account.move.line with following mapping

field (account.invoice.tax) 		field (account.move.line)
---------------------------		-------------------------
invoice_id 				move_id
account_analytic_id 			analytic_account_id
amount 					price_unit
base 					tax_base_amount

'tax lines' subset of all account.move.line from a journal entry can be accessed by using the relational field 'tax_line_id'

* account.invoice.confirm: model removed. Instead, now use the 'post()' function of account.move
* account.invoice.refund: model removed. Instead, now use account.move.reversal to reverse the entries with the same options as we had for invoices
* account.voucher: model removed. Instead, now use account.move of type in ['out_receipt', 'in_receipt]
* account.voucher.line: model removed. Instead, now use account.move.line

==== Changes made in functions ====
* on account.move, method _run_post_draft_to_post() renamed into _autopost_draft_entries()
* on account.move, method action_account_invoice_payment() renamed into action_invoice_register_payment()
* on account.move, method action_invoice_reconcile_to_check() renamed into action_open_matching_suspense_moves()
* on account.move, method _get_domain_edition_mode_available() renamed into _get_domain_matching_supsense_moves()
* on account.move, method _get_intrastat_country_id() renamed into _get_invoice_intrastat_country_id()
* on account.move.line, method _get_domain_for_edition_mode() renamed into _get_suspense_moves_domain()
* in account.bank.statement, contextual key 'edition_mode' renamed into 'suspense_moves_mode'

Was task 1917430
2019-07-01 13:45:57 +02:00
Ravi Gohil d18b5b829a [FIX] l10n_in: fix method parameter
'tax_ids' param was removed in main method by 8f7b6d0d6b, hence removed it from it's overridden method

closes odoo/odoo#33639

Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
2019-05-24 05:05:13 +00:00
Olivier Colson 3936d655c4 [IMP] account, l10n_*: v13 taxes
- Add repartition lines on taxes

- Link account tags directly to account.move.line; remove the tag_ids field from account.tag

- Add a new report engine dedicated to tax reports, directly generating account tags. It is called as an alternate mode of generic tax report, with a dedicated "Use tax grids" toggle.

>> The biggest change lies in the way the new tax report computes its values.
Everything is now aggregated directly using the tags set on the account move lines. Thanks to that,
modifying the configuration of a tax today will not impact the report for the previous periods anymore.
This is a big improvement, as it means the report will keep on reflecting the values that were submitted
to the state before, whatever the configuration change.

- Add an audit char field to account.move.line telling with tax grids are impacted by the line, with the corresponding amount

- Modify the behavior of cash basis taxes: the cash basis account is now used as the transition account, while the regular account given in tax declaration is used to store the final entry (it was the opposite before)

- Modify every l10n_* module in order to keep them consistent with these changes

closes odoo/odoo#32833

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-05-10 11:52:58 +00:00
Jigar Vaghela 451fd6cc90 [IMP] l10n_in: Improve Indian localization to supports GSTR-1 reports
Purpose
=======

GST Invoice Report required to show tax amount product line wise.
This Tax amount is divided in CESS and IGST or CGST and SGST.

Improve GST Tax, Tax Groups and Tag.

Reverse charge under GST
As per GST rules tax will have to be paid directly by the receiver to the Government instead of the supplier.

Reseller(E-commerce) under GST
If you sale through ecommerce then need to specify ecommerce GSTIN.

Import/Export goods under GST
If you export the goods then need to specify
    -Export Type
    -Shipping bill number
    -Shipping bill date
    -Shipping port code

Credit or Debit Note
If u give Credit or Debit note then need to specify Refund reason.

Place of Supply is the state of customer.

Added GSTR reports

GSTR Invoice report covers below GSTR-1 sections(this report is grouped by tax rate and journal entries
B2B, B2CL, B2CS, EXP, CDNR and CDNUR

GSTR payment report
This report is covered under GSTIR-1 section called AT(advance payment) and ATADJ(advance payment adjustment)

GSTR HSN report(it is based on the product HSN code)

GSTR Exempted report(it is based on nil rated and exempt tax)
This report is covered under GSTIR-1 section EXEMP

Added demo data to to have GSTR-1 reports out of the box

Solution
========

fetched values of CESS, IGST, CGST and SGST amount in invoice report from tax groups

added new taxes called "Nil Rated" and "Exempt" and also added it's related tax groups and accounts
added tax tags related to GST tax percentage

Set Reverse charge in negative tax

Improved account move line creation grouping machenism:
Now, move lines related to tax are grouped by product and uom instead of grouping them just by tax(this is for better reporting)

closes odoo/odoo#30332
2019-01-18 08:35:33 +00:00