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

[ADD] module event_sale_reserve_registration #228

Closed

Conversation

damdam-s
Copy link
Member

No description provided.

@damdam-s damdam-s force-pushed the add_event_sale_reserve_registration2 branch from 41c7708 to 04952d4 Compare June 29, 2021 06:38
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//header/button[@name='action_draft']" position="after">
Copy link
Contributor

Choose a reason for hiding this comment

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

Not blocking, just suggesting

I tend to avoid xpath when it isn't necessary, as IMO it's more readable to do this:

Suggested change
<xpath expr="//header/button[@name='action_draft']" position="after">
<button name="action_draft" position="after">

string="Confirm attendees"
/>
</xpath>
<xpath expr="//div[@name='button_box']" position="inside">
Copy link
Contributor

Choose a reason for hiding this comment

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

Following up on my previous comment, this also works.
It's just my personal opinion though 😃

Suggested change
<xpath expr="//div[@name='button_box']" position="inside">
<div name="button_box" position="inside">

Comment on lines 27 to 49
event_registration_ids = fields.One2many(
"event.registration", "sale_order_id", string="Attendee list"
)
attendees_count = fields.Integer(compute="_compute_attendee_count")

def action_view_attendees(self):
registrations = self.mapped("event_registration_ids")
action = self.env.ref("event.action_registration").read()[0]
if len(registrations) > 1:
action["domain"] = [("id", "in", registrations.ids)]
elif len(registrations) == 1:
form_view = [(self.env.ref("account.view_move_form").id, "form")]
if "views" in action:
action["views"] = form_view + [
(state, view) for state, view in action["views"] if view != "form"
]
else:
action["views"] = form_view
action["res_id"] = registrations.id
else:
action = {"type": "ir.actions.act_window_close"}

return action
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure action_view_attendees, attendees_count and event_registration_ids should be in this module.
Seems generic enough to be in a separate module.

In fact IMO it's something odoo shuold've done in core

class SaleOrder(models.Model):
_inherit = "sale.order"

def do_registrations(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

do_registrations seems too generic for a model like sale.order.
I'd go for something like this

Suggested change
def do_registrations(self):
def update_event_registrations(self):


return True

def confirm_reserved_registrations(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def confirm_reserved_registrations(self):
def confirm_event_registrations(self):

@damdam-s damdam-s force-pushed the add_event_sale_reserve_registration2 branch from c5eeacb to 767eabc Compare June 30, 2021 07:32
@damdam-s damdam-s force-pushed the add_event_sale_reserve_registration2 branch from 767eabc to 67205b3 Compare June 30, 2021 08:17
@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Feb 13, 2022
@github-actions github-actions bot closed this Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale PR/Issue without recent activity, it'll be soon closed automatically.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants