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][IMP] sale_resource_booking #3560

Closed

Conversation

norlinhenrik
Copy link

@norlinhenrik norlinhenrik commented Feb 2, 2025

PURPOSE

The main purpose of this PR is to use a resource booking type as a product attribute value.

  1. Enable product variants in the settings.
  2. Create a product attribute value (Resource Bookings - Configuration - Product Attributes).
  3. Create a resource booking type, and use the field Product Attribute Value to connect the two records.
  4. Create a product template. Use the Attributes & Variants tab to set the attribute & attribute value of the booking type.
  5. Automatic: The product variant has the resource booking type.

A migration script updates product.product with resource_booking_type_id and resource_booking_type_combination_rel_id.

Other changes (may go into a separate PR, separate module?):

  • *Set the product on the resource booking, and make a quote (sale order) without the wizard.
  • **Associate multiple order lines with the same booking. From the sale order line, see the booking and its partner.
  • ***Wizard: action_invite and action_noop will return the sale order in form view.

USER INTERFACE

Resource Bookings - Configuration - has 3 new menuitems:

  • Products - Search filter: Has booking type - Form view: readonly the booking type if there are multiple variants
  • Product Variants - List view: button to BOOK if the booking type is set - Form view: button to see Bookings
  • Product Attributes - Form view: see (readonly) the booking type of each attribute value

Other changes in the user interface:

  • Resource Booking Type - Form field: product_attribute_value_id
  • *Resource Booking - List field: product_id
  • */**Resource Booking - Form button: Quote - Form fields: product_id, sale_order_line_ids
  • **Sale Order - Form view - sale order line: order_id (invisible), resource_booking_id (hide), partner_id (hide)

NEW FIELDS & ACTIONS

product.attribute.value

  • resource_booking_type_ids (many2many)

product.product

  • resource_booking_type_id
  • resource_booking_type_combination_rel_id
  • resource_booking_count
  • resource_booking_ids (one2many)
  • def action_view_resource_booking
  • def _set_resource_booking_type_id

product.template

  • def _compute_resource_booking_type_and_combination_rel
  • def _inverse_resource_booking_type_and_combination_rel

resource.booking

  • **sale_order_line_ids (one2many)
  • *product_id
  • *def _onchange_type_id
  • *def action_generate (generate sale order directly from resource.booking, not via wizard)

resource.booking.type

  • *product_ids (one2many)
  • product_attribute_value_ids (many2many)
  • def _check_unique_product_attribute_value_ids

sale.order.line

  • **resource_booking_id
  • **partner_id

wizard/sale_order_booking_confirm.py

  • ***action_invite and action_noop will return the sale order in form view

Jairo Llopis and others added 10 commits February 2, 2025 12:05
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
[FIX] sale_resource_booking: Migration to 16.0
@norlinhenrik norlinhenrik force-pushed the 16.0-imp-sale_resource_booking branch from 507235f to beb5b7f Compare February 2, 2025 12:12
[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

[IMP] sale_resource_booking: Auto-assign booking type to product variant
@norlinhenrik norlinhenrik force-pushed the 16.0-imp-sale_resource_booking branch from beb5b7f to 15f912a Compare February 2, 2025 14:13
@norlinhenrik
Copy link
Author

Superseded by #3561

norlinhenrik added a commit to norlinhenrik/oca-sale-workflow that referenced this pull request Feb 2, 2025
Resource Booking - List field: product_id
Resource Booking - Form button: Quote - Form fields: product_id, sale_order_line_ids
Sale Order - Form view - sale order line: order_id (invisible), resource_booking_id (hide), partner_id (hide)

See details in OCA#3560
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.

4 participants