-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Conversation
41c7708
to
04952d4
Compare
<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"> |
There was a problem hiding this comment.
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:
<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"> |
There was a problem hiding this comment.
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 😃
<xpath expr="//div[@name='button_box']" position="inside"> | |
<div name="button_box" position="inside"> |
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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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
def do_registrations(self): | |
def update_event_registrations(self): |
|
||
return True | ||
|
||
def confirm_reserved_registrations(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def confirm_reserved_registrations(self): | |
def confirm_event_registrations(self): |
c5eeacb
to
767eabc
Compare
767eabc
to
67205b3
Compare
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. |
No description provided.