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

[17.0][MIG] intrastat_product #261

Merged
merged 181 commits into from
Sep 12, 2024
Merged

Conversation

alexis-via
Copy link
Contributor

Migration from v16 PR #260

There are still 6 ruff errors "B023 Function definition does not bind loop variable rec", but I'm not sure if they are relevant or not.

Copy link

@njeudy njeudy left a comment

Choose a reason for hiding this comment

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

Test on real database to check if all is working as it does in V16. Don't understand precommit error ...

@GuillemCForgeFlow
Copy link

Hi @alexis-via could you rebase here so I can review? Module product_harmonized_system was not yet added in v17.0

@GuillemCForgeFlow
Copy link

/ocabot rebase

@OCA-git-bot
Copy link
Contributor

Sorry @GuillemCForgeFlow you are not allowed to rebase.

To do so you must either have push permissions on the repository, or be a declared maintainer of all modified addons.

If you wish to adopt an addon and become it's maintainer, open a pull request to add your GitHub login to the maintainers key of its manifest.

Alexis de Lattre and others added 25 commits March 26, 2024 17:07
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 18 commits March 26, 2024 17:07
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: intrastat-extrastat-16.0/intrastat-extrastat-16.0-intrastat_product
Translate-URL: https://translation.odoo-community.org/projects/intrastat-extrastat-16-0/intrastat-extrastat-16-0-intrastat_product/
Currently translated at 100.0% (274 of 274 strings)

Translation: intrastat-extrastat-16.0/intrastat-extrastat-16.0-intrastat_product
Translate-URL: https://translation.odoo-community.org/projects/intrastat-extrastat-16-0/intrastat-extrastat-16-0-intrastat_product/es/
Currently translated at 100.0% (274 of 274 strings)

Translation: intrastat-extrastat-16.0/intrastat-extrastat-16.0-intrastat_product
Translate-URL: https://translation.odoo-community.org/projects/intrastat-extrastat-16-0/intrastat-extrastat-16-0-intrastat_product/es/
Add a third step "confirmed" between "draft" and "done". It is necessary
to have error messages of XML file generation that refer to declaration
lines.

Add line_number on declaration line, to be used in error message when
generating XML file.

note field moved from fields.Text to fields.Html

Improve display_name of intrastat.product.declaration

Add store=True on 3 computed fields (reporting_level on
declaration, src_dest_country_code and product_origin_country_code on
computation lines). It fixes a bug on src_dest_country_code and
product_origin_country_code on computation lines, when you could not set
manually a country code while leaving the m2o field empty.
@alexis-via
Copy link
Contributor Author

rebased

Copy link

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

General code review LGTM 👍🏿

@api.depends("code", "description")
def _compute_display_name(self):
for this in self:
name = this.code

Choose a reason for hiding this comment

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

Suggested change
name = this.code
name = this.code or ""

Same error as what was fixed here: #268

def _compute_hs_code_id(self):
for rec in self:
intrastat_line = self.move_id.intrastat_line_ids.filtered(
lambda r: r.invoice_line_id == rec

Choose a reason for hiding this comment

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

Suggested change
lambda r: r.invoice_line_id == rec
lambda r, rec=rec: r.invoice_line_id == rec

To fix the pre-commit error you need to like so for all cases.

@dreispt
Copy link
Member

dreispt commented May 25, 2024

Added fixes in #276

Copy link

@traitrantrobz traitrantrobz left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@gurneyalex
Copy link
Member

I triggered a merge of #276

@OCA-git-bot OCA-git-bot merged commit bd2eedc into OCA:17.0 Sep 12, 2024
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.