Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] intrastat_product #214

Merged
merged 130 commits into from
Jun 9, 2023
Merged

Conversation

alexis-via
Copy link
Contributor

This migration has been made from the v14 PR #198 and the changes of v15 has been re-integrated.

As discussed on #194 the intrastat transaction codes are now integrated in the module intrastat_product. The default value for transaction_id depending on the move_type of the invoice have been dropped on fiscal position and company: Odoo sets 11 when fiscal position is B2B and 12 when fiscal position is B2C. As a consequence: intrastat.transaction: company_id = False by default.

partner_id on computation line is not a related field any more: it allows to auto-fill VAT from partner_id when creating a line manually.

@alexis-via
Copy link
Contributor Author

I have another idea: currently, we have 2 XLS Export buttons : one in the computation tab and a second one in the declaration tab. My idea is to have the XLS Export in the Print menu and/or top menu and use 2 tabs : one for computation lines and another one for the declaration lines. If you think it's not a good idea, please yell NOW !

@alexis-via
Copy link
Contributor Author

alexis-via commented Feb 9, 2023

Done!
There is now a single XLSX export that has 2 tabs:

  1. computation lines
  2. declaration lines

There is a single button at the top to generate it.
The declaration type is now mentioned in the XLSX export (surprisingly, nobody complained about it so far!).
Ability to export several declarations in 1 XLSX file: in the tree view, select several declarations and click on "Print > Excel Export".

@victoralmau
Copy link
Member

Please, cherry-pick #216 to commit history

Alexis de Lattre and others added 26 commits March 6, 2023 10:11
Rename report.intrastat.product to l10n.fr.report.intrastat.product (same for service and for lines) + migration scripts

Rename field country_id to origin_country_id (TODO : write mig script) and move this field from l10n_fr_intrastat_product to intrastat_product

Move intrastat_code and uom_id of report.intrastat.code from l10n_fr_intrastat_product to intrastat_product, as discussed with Luc de Meyer

Use display_name instead of an inherit of name_get (better use of new API) Inherit write and create of intrastat codes to remove spaces (patch by Luc De Meyer from Noviat) Add O2M fields from intrastat code to products and product categs
…cant, for instance, import files with name_search
* Update README.rst and translation files
* Add index=True on some fields on which we often search, as suggested by Yannick
* Remove description in __openerp__.py
* Move ACL from l10n_fr_intrastat_product module to intrastat_product module
* Large code re-engineering following the Akretion-Noviat code sprint on intrastat
  This code has been written both by Luc de Meyer and myself.
* Add first draft of code to generate decl lines
* Add product_origin_country_id on declaration/computation lines

  Copy incoterms and destination country from SO to invoice when invoicing from SO
  We need weight even when supplementary units is used
  Small cleanups and enhancements

* Add support for accessory costs

  Add default values for intrastat transaction on company
  Code cleanup

* If rounded weight is 0, put 1

  Take into account the taxes for B2C
  Small code cleanup

* Remove field exclude_from_intrastat

  Re-organise view of intrastat.product.declaration

* Add option intrastat_accessory_costs on company

  Set more fields as invisible (localisation should put them visible if they need it)
  Fix handling of suppl. units when hs_code is empty on invoice line (but set on product)
  Small usability enhancements

* Include selection of type of invoice in search, for better perf

  Isolate domain in a _prepare method, for easier inheritance
  WARNING: I changed the default selection of invoice type ; adapt it in your localization m
  odule if necessary
  Add intrastat_transaction_in_refund for company (not needed for France, but may be needed elsewhere)
  Add a log when an invoice line is skipped

* Include product code in warning msg on weight

* Inspired by the PR akretion/account-financial-reporting#8 of Luc de Meyer
* Improve logs and messages
* total_amount is a sum of integers, so it should be an integer
* Add transport mode in computation tree view
* FIX intrastat_country for invoices without src_dest_country_id
* FIX wrong model for seach method
* Use stock_picking_invoice_link for a better identification of the intrastat region

  With this commit, we now support the following scenario: I order to my supplier a quantity of 50 kg and he delivers/invoices 52kg ; odoo will create an additional invoice line of 2kg which is linked to the stock move, but not to any PO line.
* Modularise a piece of code
* Add ACL on hs.code to financial manager (I can't do it in product_harmonized_system because it doesn't depend on account)
* Handle scenario where an invoice has products with 0 value (samples for example) and shipping costs (accessory costs) with value > 0.
Because we can have intrastat unit that will never be mapped to an odoo unit (will always be set manually)
intrastat_base: Move company view params to account config page
* Add readonly on some fields when state of declaration is done
* Division by zero in computation of accessory costs
* Add FR translation
* Fix strings
* Minor code updates
* Small fixes in intrastat_base
* account_tax_template
OCA-git-bot and others added 15 commits March 6, 2023 10:11
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: intrastat-extrastat-14.0/intrastat-extrastat-14.0-intrastat_product
Translate-URL: https://translation.odoo-community.org/projects/intrastat-extrastat-14-0/intrastat-extrastat-14-0-intrastat_product/
This commit aims at removing the over-complexity of intrastat modules
while increasing simplicity/usability for users.

- Move default intrastat transaction from res.company to account.fiscal.position to add su
pport for B2C (and not just B2B)
- improve usability: auto-generate declaration lines and XML export when
going from draft to done. Auto-delete declaration lines and XML export
when going from done to draft (and add confirmation pop-up).
- declaration lines are now readonly. Only computation lines can be created/edited manuall
y
- add field region_code on computation lines and declaration lines.
Remove region_id on declaration lines. This change allows big
simplification in some localization modules such as
l10n_fr_intrastat_product.
- simplify Brexit implementation. Northern Ireland is important, but we
can't afford to have so many lines of code and add a field on
product.template (origin_state_id) for a territory of 1.9 million
inhabitants! This is too costly to maintain and too complex for users.
- improve default visibility of fields when reporting_level = 'standard'
- add support for weight calculation from uom categories other than
units and weight, supposing that the 'weight' field on product.template
is the weight per uom of the product
- add EU companies from several different countries in demo data with valid VAT numbers
…ND company

Odoo uses, by order of priority:
1) intrastat transaction of the invoice
2) default intrastat transaction of the fiscal position of the invoice
3) default intrastat transaction of the company
…ning pop-up

This is completely new implementation of the messages that are displayed
in the warning pop-up:
- no double messages
- messages are grouped by section and record
- nice HTML display insead of raw text
This migration has been made from the v14 branch akretion/14-brexit-simplification-and-type-on-fp and the changes of v15 has been re-integrated.

As discussed on OCA#194
the intrastat transaction codes are now integrated in the module intrastat_product

The default value for transaction_id depending on the move_type of the
invoice have been dropped on fiscal position and company: Odoo sets 11
when fiscal position is B2B and 12 when fiscal position is B2C.
As a consequence: intrastat.transaction: company_id = False by default

Use textwrap for name_get() of intrastat.transaction

partner_id on computation line is not a related field any more: it allows
to auto-fill VAT from partner_id when creating a line manually.

computation and declaration line tree view: display transaction code
instead of transaction_id to save space
@alexis-via alexis-via force-pushed the 16-mig-intrastat_product branch 2 times, most recently from f39e8af to 93e03e0 Compare March 6, 2023 10:45
@alexis-via
Copy link
Contributor Author

Tests are all green, cool!

Copy link

Choose a reason for hiding this comment

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

Please remove the migrations folder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. thanks !

There is now a single XLSX export that has 2 tabs:
1) computation lines
2) declaration lines
The declaration type is now mentionned in the XLSX export.
Ability to export several declarations in 1 XLSX file.
<field name="description">Supply for sale on approval or after trial (including call-off and consignment stock)</field>
<field
name="description"
>Supply for sale on approval or after trial (including call-off and consignment stock)</field>
Copy link
Member

Choose a reason for hiding this comment

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

Why these changes in the migration commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In a perfect world...

@alexis-via
Copy link
Contributor Author

@victoralmau No need to forward port this fix, because my refactor removed and simplified all this code that caused such bug. The method _get_intrastat_country_code() doesn't exist any more here.

@alexis-via
Copy link
Contributor Author

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 16.0-ocabot-merge-pr-214-by-alexis-via-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3f787aa into OCA:16.0 Jun 9, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 5656d74. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.