[IMP] lunch: improve lunch again

This commit is contained in:
RomainLibert
2019-09-04 07:26:43 +00:00
parent e09d7d1b25
commit ba8bdcfaf2
6 changed files with 40 additions and 4 deletions
+4
View File
@@ -102,6 +102,7 @@
<field name="street">Rr. e Durrësit, Pall. M.C. Inerte</field>
<field name="street2">Kati.1, Laprakë, Tirana, Shqipëri</field>
<field name="email">coin.gourmand@yourcompany.example.com</field>
<field name="phone">+32485562388</field>
</record>
<record id="partner_pizza_inn" model="res.partner">
@@ -112,6 +113,7 @@
<field name="street2">Gandhi Gramam,Gandhi Nagar</field>
<field name="zip">607308</field>
<field name="email">pizza.inn@yourcompany.example.com</field>
<field name="phone">+32456325289</field>
</record>
<record model="res.partner" id="partner_corner">
@@ -121,6 +123,7 @@
<field name="street">Genessee Ave SW</field>
<field name="zip">607409</field>
<field name="email">info@corner.com</field>
<field name="phone">+32654321515</field>
</record>
<record model="res.partner" id="partner_sushi_shop">
@@ -130,6 +133,7 @@
<field name="street">Boulevard Saint-Germain</field>
<field name="zip">486624</field>
<field name="email">order@sushi.com</field>
<field name="phone">+32498859912</field>
</record>
<record model="lunch.supplier" id="supplier_coin_gourmand">
+1 -1
View File
@@ -153,7 +153,7 @@ class LunchSupplier(models.Model):
for supplier in self:
now = now.astimezone(pytz.timezone(supplier.tz))
if supplier.recurrency_end_date and now.date() > supplier.recurrency_end_date:
if supplier.recurrency_end_date and now.date() >= supplier.recurrency_end_date:
supplier.available_today = False
else:
fieldname = 'recurrency_%s' % (WEEKDAY_TO_NAME[now.weekday()])
@@ -6,6 +6,7 @@ odoo.define('lunch.LunchKanbanController', function (require) {
* override of the KanbanController.
*/
var session = require('web.session');
var core = require('web.core');
var KanbanController = require('web.KanbanController');
var LunchKanbanWidget = require('lunch.LunchKanbanWidget');
@@ -32,6 +33,7 @@ var LunchKanbanController = KanbanController.extend({
this.editMode = false;
this.updated = false;
this.widgetData = null;
this.context = session.user_context;
return this._super.apply(this, arguments);
},
/**
@@ -55,6 +57,9 @@ var LunchKanbanController = KanbanController.extend({
_fetchPaymentInfo: function () {
return this._rpc({
route: '/lunch/payment_message',
params: {
context: this.context,
},
});
},
_fetchWidgetData: function () {
@@ -64,6 +69,7 @@ var LunchKanbanController = KanbanController.extend({
route: '/lunch/infos',
params: {
user_id: this.userId,
context: this.context,
},
}).then(function (data) {
self.widgetData = data;
@@ -148,6 +154,7 @@ var LunchKanbanController = KanbanController.extend({
params: {
user_id: this.userId,
location_id: ev.data.locationId,
context: this.context,
},
}).then(function () {
self.model._updateLocation(ev.data.locationId).then(function () {
@@ -184,6 +191,7 @@ var LunchKanbanController = KanbanController.extend({
route: '/lunch/pay',
params: {
user_id: this.userId,
context: this.context,
},
}).then(function (isPaid) {
if (isPaid) {
@@ -225,6 +233,7 @@ var LunchKanbanController = KanbanController.extend({
route: '/lunch/trash',
params: {
user_id: this.userId,
context: this.context,
},
}).then(function () {
self.reload();
@@ -6,6 +6,7 @@ odoo.define('lunch.LunchKanbanModel', function (require) {
* override of the KanbanModel.
*/
var session = require('web.session');
var KanbanModel = require('web.KanbanModel');
var LunchKanbanModel = KanbanModel.extend({
@@ -70,6 +71,7 @@ var LunchKanbanModel = KanbanModel.extend({
return this._rpc({
route: '/lunch/user_location_get',
params: {
context: session.user_context,
user_id: this.userId,
},
});
+22 -1
View File
@@ -23,6 +23,27 @@
</field>
</record>
<record id="lunch_product_report_view_search" model="ir.ui.view">
<field name="name">lunch.product.report.search</field>
<field name="model">lunch.product.report</field>
<field name="arch" type="xml">
<search string="Product Search">
<field name="name" string="Product"/>
<field name="category_id" string="Category"/>
<field name="supplier_id"/>
<field name="description"/>
<group expand="0" string="Group By">
<filter name="group_by_supplier" string="Vendor" context="{'group_by': 'supplier_id'}"/>
<filter name="group_by_category" string="Category" context="{'group_by': 'category_id'}"/>
</group>
<searchpanel>
<field name="category_id" select="multi" string="Categories" icon="fa-cutlery" color="#875A7B"/>
<field name="supplier_id" select="multi" string="Vendors" icon="fa-truck"/>
</searchpanel>
</search>
</field>
</record>
<record id="lunch_product_view_tree" model="ir.ui.view">
<field name="name">lunch.product.tree</field>
<field name="model">lunch.product</field>
@@ -275,7 +296,7 @@
<field name="res_model">lunch.product.report</field>
<field name="view_mode">kanban</field>
<field name="view_id" ref="view_lunch_product_kanban_order"/>
<field name="search_view_id" ref="lunch_product_view_search"/>
<field name="search_view_id" ref="lunch_product_report_view_search"/>
<field name="domain">[('supplier_id.available_today', '=', True), '|', ('user_id', '=', False), ('user_id', '=', uid)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
+2 -2
View File
@@ -60,8 +60,8 @@
<field name="delivery"/>
<field name="available_location_ids" widget="many2many_tags"/>
<field name="send_by" widget="radio"/>
<label for="automatic_email_time"/>
<div class="o_row"><field name="automatic_email_time" widget="float_time"/> <field name="moment"/></div>
<label for="automatic_email_time" attrs="{'invisible': [('send_by', '!=', 'mail')]}"/>
<div class="o_row" attrs="{'invisible': [('send_by', '!=', 'mail')]}"><field name="automatic_email_time" widget="float_time"/> <field name="moment"/></div>
</group>
</group>
</sheet>