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] sale_resource_booking: Migration to 16.0 #2661

Open
wants to merge 12 commits into
base: 16.0
Choose a base branch
from

Conversation

norlinhenrik
Copy link

No description provided.

@rrebollo
Copy link

rrebollo commented Feb 1, 2024

@norlinhenrik me over here to. In my doodba local environment no tests are failling this same branch. Is there any way to trigger checks again???

@rrebollo
Copy link

rrebollo commented Feb 2, 2024

@jguenat @stefan-tecnativa @norlinhenrik I can´t see failling tests. I even didn´t find any when running in my local doodba. Could anyone trigger tests again?
image

@norlinhenrik
Copy link
Author

I think OCA cannot successfully test sale_resource_booking until resource_booking is merged. But you can do it on your local computer with these parameters:
--test-enable --test-tags=/sale_resource_booking --stop-after-init (optional)

@rrebollo
Copy link

rrebollo commented Feb 2, 2024

@norlinhenrik I'm considering to make an small improvement: trigger an onchange to auto select first product when booking type is selected. Why? I was testing to create a quote directly from booking, an error raises, looking at the trace I figure out it's because I forgot to select product. What do U think? Is there any convention against "onchanges"? Anyway we need to prevent quote action from calling if no product is selected? Which path would U suggest??
image

@norlinhenrik
Copy link
Author

"onchange to auto select first product" is good if there is only one product available. If there are many products available, I think it is better to select the product manually.

"prevent quote action from calling if no product is selected" is also good to implement.

@rrebollo
Copy link

rrebollo commented Feb 5, 2024

"onchange to auto select first product" is good if there is only one product available. If there are many products available, I think it is better to select the product manually.

"prevent quote action from calling if no product is selected" is also good to implement.

Last two commits here to implement mentioned improvements https://github.com/BinhexSystemss/sale-workflow/tree/16.0-dev. Could U merge it???

@rrebollo
Copy link

rrebollo commented Feb 12, 2024

Sale order isn't been "reload" after booking confirmation wizard closes. U need to manually reload browser tab to see the state changed to confirmed. It doesn't matter which button U click on wizard.
sale order doesn´t reload after booking confirmation
I did some digging so I think the root cause it's maybe in web_ir_actions_act_multi.
By our part the problem lies here:

https://github.com/ows-cloud/sale-workflow/blob/d68949ea1212ed5c458a1adb61930fce34c9adb3/sale_resource_booking/models/sale_order.py#L48-L66

    def action_confirm(self):
        """Ask to fill booking values, if necessary."""
        result = super().action_confirm()
        try:
            # Only open wizard if doing this from a single record with bookings
            if len(self) > 1 or not self.resource_booking_ids:
                return result
        except exceptions.AccessError:
            # User without access to resource.booking; no confirm wizard
            return result
        # Support chained actions, like when event_sale is installed
        action = self.env["ir.actions.act_window"]._for_xml_id(
            "sale_resource_booking.sale_order_booking_confirm_action"
        )
        action["context"] = {"default_order_id": self.id}
        actions = [action]
        if isinstance(result, dict):
            actions.insert(0, result)
        return {"type": "ir.actions.act_multi", "actions": actions}

Following web_ir_actions_act_multi README instructions I tried to just add reload action client to actions list but then tab is reloaded and wizard got never called. As a temporal (and awful) workaround I'm just directly returning reload action client from both wizard 's buttons actions. Any thougths @norlinhenrik @pedrobaeza?

@norlinhenrik
Copy link
Author

@rrebollo I made a commit with a workaround similar to what you described. This is how it will be then after CONFIRM.
Confirm order with resource booking

Copy link

@augustodinizl augustodinizl left a comment

Choose a reason for hiding this comment

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

typo error

<field name="model">resource.booking</field>
<field name="inherit_id" ref="resource_booking.resource_booking_view_tree" />
<field name="arch" type="xml">
<field name="partner_id" position="after">
Copy link

@augustodinizl augustodinizl Apr 2, 2024

Choose a reason for hiding this comment

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

i think that the correct field here, is partner_ids

Copy link
Author

Choose a reason for hiding this comment

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

Done

@norlinhenrik
Copy link
Author

@rrebollo @augustodinizl Are you ready to approve, or do you see more things to do first?

Copy link

@augustodinizl augustodinizl left a comment

Choose a reason for hiding this comment

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

LGTM

@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch from 7cbb3cc to 8e40b7c Compare April 19, 2024 08:39
@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch from 8e40b7c to 950f27e Compare June 11, 2024 08:00
@norlinhenrik
Copy link
Author

I have squahed my commits now, and I think it is ready to merge.

@pedrobaeza
Copy link
Member

CI seems to be red. Can you check?

@rrebollo
Copy link

CI seems to be red. Can you check?

Hi, it looks none of the failing tests are linked to sale_resource_booking, maybe re triggering?

@pedrobaeza
Copy link
Member

Try to rebase to see

@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch 2 times, most recently from 6a52908 to e84f84c Compare July 21, 2024 15:06
@norlinhenrik
Copy link
Author

I have rebased now.

First failing check: sale_resource_booking is installed in lines 515-559.
The test fails at line 924. Bottom: psycopg2.errors.SerializationFailure: could not serialize access due to concurrent update

sale.order.line
In the last push, resource_booking_id is renamed to "Resource Booking" (singular).
Still the log complains about 2 fields named "Resource Bookings" (plural)...

Jairo Llopis and others added 7 commits July 24, 2024 19:59
This module extends the functionality of sale and resource bookings to support
creating pending resource bookings automatically when confirming a sale order
and to allow you to generate those sale orders easily from a resource booking
type.

@Tecnativa TT28202
- Set `resource.booking` new `combination_auto_assign` field depending on `product.template`'s `resource_booking_type_combination_rel_id`.
- Adapt tests.
- The rest is normal migration stuff.

@Tecnativa TT31324
OCA-git-bot and others added 4 commits July 24, 2024 19:59
[FIX] sale_resource_booking: Migration to 16.0
[IMP] sale_resource_booking: booking.product_id, Buttons (product variant -> booking -> sale order)

[FIX] sale_resource_booking: fix tests

[ADD] sale_resource_booking_product_variant

[IMP] sale_resource_booking_product_variant: documentation etc.

[FIX] sale_resource_booking_product_variant: search Booking Type

[FIX] sale_resource_booking_product_variant: text

[FIX] sale_resource_booking_product_variant: code is in sale_resource_booking

[IMP] sale_resource_booking: Types are connected with product variants. Set defaults on product.attribute form view.

[FIX] sale_resource_booking: many2one was missing comodel

[FIX] sale_resource_booking: migration

[IMP] sale_resource_booking: do not auto-assign combination if timeline is installed

[FIX] sale_resource_booking: pre-commit

[FIX] sale_resource_booking: a sale order may have multiple lines (sale_product_pack)

[IMP] sale_resource_booking: multiple order lines for one booking

[IMP] sale_resource_booking: when change type for booking, product gets selected when there is just one

[IMP] sale_resource_booking: raise UserError when trying to quote from booking with no product selected

sale_resource_booking: confirm sale order with bookings: show updated sale order

Return the sale order window action to show the correct status of the sale order

sale_resource_booking: add info to sale.order.line

A sale order line with a resource booking product and quantity == 1
will have correct resource_booking_id and its partner_id.

sale_resource_booking: tiny change to trigger tests

[FIX] sale_resource_booking: booking list changed partner_id to partner_ids

[FIX] sale_resource_booking: default_partner_ids (not default_partner_id)

[FIX] sale_resource_booking: Show the booking button Quote

[BUG] sale_resource_booking: create product.product

[FIX] sale_resource_booking: product inherit booking type from attribute value
@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch 2 times, most recently from 4cce8d1 to 0eab7b0 Compare July 31, 2024 12:51
@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch 2 times, most recently from e93e034 to 00abf57 Compare August 9, 2024 16:03
@norlinhenrik norlinhenrik force-pushed the 16.0-mig-sale_resource_booking branch from 00abf57 to a71bb94 Compare August 9, 2024 16:08
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.

7 participants