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
[MERGE] lunch, lunch_hr: automatize lunch flow #28442
Conversation
f105405
to
0b124dc
Compare
0b124dc
to
b896ab3
Compare
b896ab3
to
1903bf2
Compare
@RomainLibert awesome, really nice to see. @mart-e recently told me I was not allowed to split one Python file into multiple to preserve history. I'm curious if that is not the case here also then? |
1903bf2
to
36a10db
Compare
36a10db
to
aea9d6c
Compare
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.
Small review for some little things to change, some questions, and some renaming asked before continue building thing on it.
lines = orders.mapped('order_line_ids').filtered(lambda line: line.supplier == supplier) | ||
lines = [{'product': line.product_id.name, 'note': line.note, 'quantity': line.qty, 'price': line.price} for line in lines] | ||
|
||
order['amount_total'] = sum(l['price'] for l in lines) |
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.
Is there multi currency in lunch ? if not, then it's ok.
But you can use sum(lines.mapped('price'))
recurrency_saturday = fields.Boolean('Saturday') | ||
recurrency_sunday = fields.Boolean('Sunday') | ||
|
||
available_today = fields.Boolean('', compute='_compute_available_today', search='_search_available_today') |
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.
No label ? O_0
order = request.env['lunch.order'].search([('user_id', '=', user_id), ('date', '=', fields.Date.today())], limit=1) | ||
return order | ||
|
||
def _make_payment(self, order): |
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.
useless method IMHO
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.
It will be used when doing the payments
addons/lunch/controllers/main.py
Outdated
|
||
return False | ||
|
||
@http.route('/lunch/paymentMessage', type='json', auth='user') |
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.
Please, no camel case in URL :s
phone = fields.Char(related='partner_id.phone') | ||
street = fields.Char(related='partner_id.street') | ||
street2 = fields.Char(related='partner_id.street2') | ||
zip = fields.Char(related='partner_id.zip') |
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.
Since we just have a commit renaming all the named type
fields into machin_type
(which break couple of things), maybe we can name this field zip_code
directly to avoid having the same commit applied for 'zip' as it is also a reserved word in python.
addons/lunch/models/lunch_order.py
Outdated
self.cashmove.unlink() | ||
else: | ||
raise AccessError(_("Only your lunch manager cancels the orders.")) | ||
qty = fields.Float('Quantity', required=True, default=1) |
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.
Can you call it quantity
? pleaseeeeeeee :D
tz = fields.Selection(_tz_get, string='Timezone', required=True, default='UTC') | ||
|
||
_sql_constraints = [ | ||
('automatic time', 'CHECK(automatic_email_time >= 0 AND automatic_email_time <= 24)', 'Automatic Email Sending Time should be between 0 and 24'), |
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.
use underscored notation for the technical name, and be more precise. Like "automatic_email_time_range"
return float_round(t.hour + t.minute/60 + t.second/3600, precision_digits=2) | ||
|
||
class LunchSupplier(models.Model): | ||
_name = 'lunch.supplier' |
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.
\0/
aea9d6c
to
2d75bed
Compare
2d75bed
to
6de5e31
Compare
6de5e31
to
fa0a5ad
Compare
fa0a5ad
to
61154c1
Compare
61154c1
to
ad726cf
Compare
398c208
to
be701ce
Compare
be701ce
to
9beae6b
Compare
9beae6b
to
c747aa2
Compare
c747aa2
to
5b88fc4
Compare
5b88fc4
to
3ad6b51
Compare
We should basically have one model per file, as this will facilitate the reading and maintenance of the code
We would like to automatize lunch as currently all orders are manually ordered and validated, and a cash move has to be manually created each time you want to credit the wallet of some user. In this commit we add a new widget that comes with the kanban view and will allow to take orders in a friendly manner. We also add a lunch.supplier model and an integration with the hr module in order to filter what products you can order depending on your working location, this also allows you to configure an automatic ordering via email. TaskID: 1856876
41bcc0d
to
f727b8f
Compare
@robodoo merge |
@robodoo r+ |
@robodoo merge |
@robodoo merge |
We would like to automatize lunch as currently all orders are manually ordered and validated, and a cash move has to be manually created each time you want to credit the wallet of some user. In this commit we add a new widget that comes with the kanban view and will allow to take orders in a friendly manner. We also add a lunch.supplier model and an integration with the hr module in order to filter what products you can order depending on your working location, this also allows you to configure an automatic ordering via email. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr closes #28442
We would like to automatize lunch as currently all orders are manually ordered and validated, and a cash move has to be manually created each time you want to credit the wallet of some user. In this commit we add a new widget that comes with the kanban view and will allow to take orders in a friendly manner. We also add a lunch.supplier model and an integration with the hr module in order to filter what products you can order depending on your working location, this also allows you to configure an automatic ordering via email. -- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr closes #28442
Merged, thanks! |
We would like to automatize lunch as currently all orders are manually ordered and validated, and a cash move has to be manually created each time you want to credit the wallet of some user.
In this commit we add a new widget that comes with the kanban view and will allow to take orders in a friendly manner.
We also add a lunch.supplier model and an integration with the hr module in order to filter what products you can order depending on your working location, this also allows you to configure an automatic ordering via email.
--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr