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

[MERGE] lunch, lunch_hr: automatize lunch flow #28442

Merged
merged 2 commits into from Dec 4, 2018

Conversation

RomainLibert
Copy link
Contributor

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

@RomainLibert RomainLibert added the RD research & development, internal work label Nov 6, 2018
@RomainLibert RomainLibert force-pushed the master-automatize-lunch-rli branch 2 times, most recently from f105405 to 0b124dc Compare November 7, 2018 11:30
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 7, 2018
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Nov 9, 2018
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Nov 13, 2018
@Yenthe666
Copy link
Collaborator

@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?

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 14, 2018
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Nov 14, 2018
Copy link
Contributor

@jem-odoo jem-odoo left a 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.

addons/lunch/models/lunch_supplier.py Show resolved Hide resolved
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)
Copy link
Contributor

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')
Copy link
Contributor

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):
Copy link
Contributor

Choose a reason for hiding this comment

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

useless method IMHO

Copy link
Contributor Author

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


return False

@http.route('/lunch/paymentMessage', type='json', auth='user')
Copy link
Contributor

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')
Copy link
Contributor

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.

self.cashmove.unlink()
else:
raise AccessError(_("Only your lunch manager cancels the orders."))
qty = fields.Float('Quantity', required=True, default=1)
Copy link
Contributor

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'),
Copy link
Contributor

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"

addons/lunch/models/lunch_supplier.py Show resolved Hide resolved
return float_round(t.hour + t.minute/60 + t.second/3600, precision_digits=2)

class LunchSupplier(models.Model):
_name = 'lunch.supplier'
Copy link
Contributor

Choose a reason for hiding this comment

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

\0/

@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Nov 19, 2018
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 19, 2018
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Nov 20, 2018
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Nov 20, 2018
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Nov 26, 2018
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 30, 2018
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 3, 2018
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 3, 2018
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 3, 2018
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Dec 4, 2018
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
@tivisse
Copy link
Contributor

tivisse commented Dec 4, 2018

@robodoo merge

@tivisse tivisse dismissed jem-odoo’s stale review December 4, 2018 10:57

Thanks JEM, changes applied.

@tivisse
Copy link
Contributor

tivisse commented Dec 4, 2018

@robodoo r+

@robodoo robodoo added the r+ 👌 label Dec 4, 2018
@tivisse
Copy link
Contributor

tivisse commented Dec 4, 2018

@robodoo merge

@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Dec 4, 2018
@tivisse
Copy link
Contributor

tivisse commented Dec 4, 2018

@robodoo merge

robodoo added a commit that referenced this pull request Dec 4, 2018
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
robodoo added a commit that referenced this pull request Dec 4, 2018
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
@robodoo
Copy link
Contributor

robodoo commented Dec 4, 2018

Merged, thanks!

@robodoo robodoo closed this Dec 4, 2018
@robodoo robodoo merged commit f727b8f into odoo:master Dec 4, 2018
@RomainLibert RomainLibert deleted the master-automatize-lunch-rli branch December 4, 2018 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI 🤖 Robodoo has seen passing statuses RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants