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

[14.0][MIG] delivery_auto_refresh: Migration to 14.0 #466

Closed
wants to merge 36 commits into from

Conversation

simahawk
Copy link
Contributor

Replaces #439.
In addition to it:

  1. include fix from [13.0][FIX] delivery_auto_refresh: Fix error when adding products to cart on website #440
  2. speed up tests w/ setUpClass + no tracking
  3. unify lookup of params and use the right converter for boolean strings

pedrobaeza and others added 30 commits February 24, 2022 11:58
Auto-refresh delivery price in sales orders
===========================================

This module automates the delivery price handling for the following cases:

* If you change any line in your draft sales order (SO), when saving, the
  delivery price will be adjusted without having to click on "→ Set price".
* If specified in the system parameter, the delivery line can be also
  auto-added when creating/saving.
* If you deliver a different quantity than the ordered one, the delivery price
  is adjusted on the linked SO when the picking is transferred.

Configuration
=============

* Activate developer mode.
* Go to *Settings > Technical > Parameters > System Parameters*.
* Locate the setting with key "delivery_auto_refresh.auto_add_delivery_line"
  or create a new one if not exists.
* Put a non Falsy value (1, True...) if you want to add automatically the
  delivery line on save.

Known issues / Roadmap
======================

* After confirming the sales order, the price of the delivery line (if exists)
  will be only updated after the picking is transferred, but not when you
  might modify the order lines.
* There can be some duplicate delivery unset/set for assuring that the refresh
  is done on all cases.
* On multiple deliveries, second and successive pickings update the delivery
  price, but you can't invoice the new delivery price.
* This is only working from user interface, as there's no way of making
  compatible the auto-refresh intercepting create/write methods from sale order
  lines.
Currently translated at 100.0% (2 of 2 strings)

Translation: delivery-carrier-12.0/delivery-carrier-12.0-delivery_auto_refresh
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_auto_refresh/zh_CN/
Currently translated at 100.0% (2 of 2 strings)

Translation: delivery-carrier-12.0/delivery-carrier-12.0-delivery_auto_refresh
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_auto_refresh/zh_CN/
Currently translated at 100.0% (2 of 2 strings)

Translation: delivery-carrier-12.0/delivery-carrier-12.0-delivery_auto_refresh
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_auto_refresh/pt_BR/
…+ add on create

As the used method now has a check for not being used when the order is confirmed, so
it collapses when you want to add the delivery line in that moment.

Previous code didn't take into account the direct creation of the sales order.
For not having bad interaction with the rest of the tests.
new() doesn't invoke defaults, so you can get an SO without company for example,
and interacts bad with other modules.
Currently translated at 100.0% (2 of 2 strings)

Translation: delivery-carrier-12.0/delivery-carrier-12.0-delivery_auto_refresh
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-12-0/delivery-carrier-12-0-delivery_auto_refresh/sl/
In the core the onchange is now aligned with `partner_shipping_id`
instead of `partner_id`.
odoo/odoo@b6f91e3
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: delivery-carrier-13.0/delivery-carrier-13.0-delivery_auto_refresh
Translate-URL: https://translation.odoo-community.org/projects/delivery-carrier-13-0/delivery-carrier-13-0-delivery_auto_refresh/
When the company has different currency than the pricelist asociated to the partner. The final price is converted to the currency of the pricelist.

With this changes we achieve to avoid this recomputation and solve this problems on tests.

TT26914
…n website

The steps to reproduce the problem are these:
    - Set delivery_auto_refresh.auto_add_delivery_line.
    - Set a default delivery method on the user's partner.
    - Place a new ecommerce order with that user adding to the cart.

Doing this steps we get the error:
    Record does not exist or has been deleted.
    (Record: sale.order.line(63,), User: 1)
We should get as the same default carrier as Odoo does.

TT34020
Added new config paramerter that automates de voiding of the delivery
line for the case of returning a picking that just didn't go away from
the warehouse (due to several causes like the customer cancelling the
sale order in the last minute).

This will only be performed if the order wasn't already invoiced and the
return was set to refund.

TT30359
@simahawk
Copy link
Contributor Author

/ocabot migration delivery_auto_refresh

@OCA-git-bot OCA-git-bot added this to the 14.0 milestone Feb 24, 2022
@OCA-git-bot OCA-git-bot mentioned this pull request Feb 24, 2022
21 tasks
@simahawk
Copy link
Contributor Author

tests failure seems unrelated. I'll get back to them when possible.

FAIL: TestRoutePutaway.test_wizard_send_shipping
Traceback (most recent call last):
  File "/home/travis/build/OCA/delivery-carrier/setup/delivery_carrier_pricelist/odoo/addons/delivery_carrier_pricelist/tests/test_delivery_pricelist.py", line 103, in test_wizard_send_shipping
    self.assertEqual(result, [{"exact_price": 0.0, "tracking_number": False}])
AssertionError: Lists differ: [{'exact_price': 10.0, 'tracking_number': False}] != [{'exact_price': 0.0, 'tracking_number': False}]
First differing element 0:
{'exact_price': 10.0, 'tracking_number': False}
{'exact_price': 0.0, 'tracking_number': False}
- [{'exact_price': 10.0, 'tracking_number': False}]
?                  -
+ [{'exact_price': 0.0, 'tracking_number': False}]
 
Module delivery_carrier_pricelist: 1 failures, 0 errors of 4 tests
FAIL: TestDeliveryMultiDestination.test_delivery_multi_destination
Traceback (most recent call last):
  File "/home/travis/build/OCA/delivery-carrier/setup/delivery_multi_destination/odoo/addons/delivery_multi_destination/tests/test_delivery_multi_destination.py", line 161, in test_delivery_multi_destination
    self.assertAlmostEqual(sale_order_line.price_unit, 50, 2)
AssertionError: 10.0 != 50 within 2 places
 
FAIL: TestDeliveryMultiDestination.test_picking_validation
Traceback (most recent call last):
  File "/home/travis/build/OCA/delivery-carrier/setup/delivery_multi_destination/odoo/addons/delivery_multi_destination/tests/test_delivery_multi_destination.py", line 203, in test_picking_validation
    self.assertEqual(picking.carrier_id, self.carrier_multi)
AssertionError: delivery.carrier(3,) != delivery.carrier(12,)

@chienandalu
Copy link
Member

Can you add: #469

@elvise
Copy link

elvise commented Mar 31, 2022

hi @simahawk any chance for this PR ?

@francesco-ooops
Copy link
Contributor

@simahawk porting was finished in PR #472 , could you review?

thanks!

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

Successfully merging this pull request may close these issues.

None yet