[IMP] point_of_sale: B2B ease navigation within PoS

TASK-ID: 2050245

closes odoo/odoo#35716

Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
This commit is contained in:
Joseph Caburnay
2019-08-19 07:27:13 +00:00
parent 632c04a1cc
commit 2913337fd7
14 changed files with 68 additions and 20 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class PosCategory(models.Model):
if not self._check_recursion():
raise ValueError(_('Error ! You cannot create recursive categories.'))
name = fields.Char(required=True, translate=True)
name = fields.Char(string='Category Name', required=True, translate=True)
parent_id = fields.Many2one('pos.category', string='Parent Category', index=True)
child_id = fields.One2many('pos.category', 'parent_id', string='Children Categories')
sequence = fields.Integer(help="Gives the sequence order when displaying a list of product categories.")
@@ -202,6 +202,7 @@ class PosConfig(models.Model):
"the closing of his session saying that he needs to contact his manager.")
payment_method_ids = fields.Many2many('pos.payment.method', string='Payment Methods', default=lambda self: self._default_payment_methods())
company_has_template = fields.Boolean(string="Company has chart of accounts", compute="_compute_company_has_template")
current_user_id = fields.Many2one('res.users', string='Current Session Responsible', compute='_compute_current_session_user')
@api.depends('company_id')
def _compute_company_has_template(self):
@@ -262,10 +263,12 @@ class PosConfig(models.Model):
pos_config.pos_session_duration = (
datetime.now() - session[0].start_at
).days if session[0].start_at else 0
pos_config.current_user_id = session[0].user_id
else:
pos_config.pos_session_username = False
pos_config.pos_session_state = False
pos_config.pos_session_duration = 0
pos_config.current_user_id = False
@api.constrains('cash_control')
def _check_session_state(self):
+1 -1
View File
@@ -186,7 +186,7 @@ class PosOrder(models.Model):
)
note = fields.Text(string='Internal Notes')
nb_print = fields.Integer(string='Number of Print', readonly=True, copy=False, default=0)
pos_reference = fields.Char(string='PoS Order Reference', readonly=True, copy=False)
pos_reference = fields.Char(string='Receipt Number', readonly=True, copy=False)
sale_journal = fields.Many2one('account.journal', related='session_id.config_id.journal_id', string='Sales Journal', store=True, readonly=True)
fiscal_position_id = fields.Many2one(
comodel_name='account.fiscal.position', string='Fiscal Position',
+15 -2
View File
@@ -882,8 +882,8 @@ td {
border: 1px solid #cecbcb;
padding: 10px 20px;
padding-left: 38px;
padding-right: 33px;
margin: 6px;
background: url("../img/search.png") no-repeat 15px;
background-color: white;
border-radius: 20px;
font-family: "Lato","Lucida Grande", Helvetica, Verdana, Arial;
@@ -894,12 +894,25 @@ td {
box-shadow: 0px 0px 0px 2px rgb(153, 153, 255) inset;
color: rgb(153, 153, 255);
}
.pos .search-clear {
position: absolute;
top: 9px;
width: 30px;
height: 30px;
top: 11px;
display: flex;
align-items: center;
justify-content: center;
}
.search-clear.left {
left: 11px;
color: #808080;
}
.search-clear.right {
left: 145px;
color: #808080;
cursor: pointer;
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

@@ -811,7 +811,7 @@ var ProductCategoriesWidget = PosBaseWidget.extend({
this.el.querySelector('.searchbox input').addEventListener('keydown',this.search_handler);
this.el.querySelector('.search-clear').addEventListener('click',this.clear_search_handler);
this.el.querySelector('.search-clear.right').addEventListener('click',this.clear_search_handler);
if(this.pos.config.iface_vkeyboard && this.chrome.widget.keyboard){
this.chrome.widget.keyboard.connect($(this.el.querySelector('.searchbox input')));
@@ -840,11 +840,11 @@ var ProductCategoriesWidget = PosBaseWidget.extend({
this.pos.get_order().add_product(products[0]);
this.clear_search();
}else{
this.product_list_widget.set_product_list(products);
this.product_list_widget.set_product_list(products, query);
}
}else{
products = this.pos.db.get_product_by_category(this.category.id);
this.product_list_widget.set_product_list(products);
this.product_list_widget.set_product_list(products, query);
}
},
@@ -867,6 +867,7 @@ var ProductListWidget = PosBaseWidget.extend({
this.weight = options.weight || 0;
this.show_scale = options.show_scale || false;
this.next_screen = options.next_screen || false;
this.search_word = false;
this.click_product_handler = function(){
var product = self.pos.db.get_product_by_id(this.dataset.productId);
@@ -894,8 +895,9 @@ var ProductListWidget = PosBaseWidget.extend({
this.renderElement();
}, this);
},
set_product_list: function(product_list){
set_product_list: function(product_list, search_word){
this.product_list = product_list;
this.search_word = !!search_word ? search_word : false;
this.renderElement();
},
get_product_image_url: function(product){
@@ -11,12 +11,14 @@ tour.register('point_of_sale_tour', {
rainbowMan: false,
}, [tour.STEPS.SHOW_APPS_MENU_ITEM, {
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]',
content: _t("Ready to launch your <b>point of sale</b>? <i>Click here</i>."),
content: _t("Ready to launch your <b>point of sale</b>?"),
width: 215,
position: 'right',
edition: 'community'
}, {
trigger: '.o_app[data-menu-xmlid="point_of_sale.menu_point_root"]',
content: _t("Ready to launch your <b>point of sale</b>? <i>Click here</i>."),
content: _t("Ready to launch your <b>point of sale</b>?"),
width: 215,
position: 'bottom',
edition: 'enterprise'
}, {
+20 -3
View File
@@ -229,7 +229,12 @@
</div>
<div class="searchbox">
<input placeholder="Search Products" />
<span class="search-clear"></span>
<span class="search-clear left">
<i class="fa fa-search" />
</span>
<span class="search-clear right">
<i class="fa fa-remove" />
</span>
</div>
</header>
<t t-if="widget.subcategories.length > 0">
@@ -246,8 +251,20 @@
<t t-name="ProductListWidget">
<div class='product-list-container'>
<div class="product-list-scroller touch-scrollable">
<div class="product-list">
</div>
<t t-if="widget.product_list.length != 0">
<div class="product-list">
</div>
</t>
<t t-else="">
<div class="product-list-empty">
<t t-if="widget.product_list.length == 0 &amp;&amp; !!widget.search_word">
<p>No results found for "<b t-esc="widget.search_word"></b>".</p>
</t>
<t t-else="">
<p>There are no products in this category.</p>
</t>
</div>
</t>
</div>
<span class="placeholder-ScrollbarWidget" />
</div>
@@ -43,6 +43,7 @@
<field name="model">pos.config</field>
<field name="arch" type="xml">
<kanban create="false" class="o_kanban_dashboard o_pos_kanban">
<field name="current_user_id" invisible="1" />
<field name="name"/>
<field name="current_session_id"/>
<field name="current_session_state"/>
@@ -112,6 +113,16 @@
</div>
</div>
</div>
<div style="text-align:right;" t-if="record.current_user_id.value">
<img
class="oe_kanban_avatar"
t-att-src="kanban_image('res.users', 'image_64', record.current_user_id.raw_value)"
t-att-title="record.current_user_id.value"
t-att-alt="record.current_user_id.value"
width="24"
height="24"
/>
</div>
</div><div class="container o_kanban_card_manage_pane dropdown-menu" role="menu">
<div class="row">
<div class="col-6 o_kanban_card_manage_section o_kanban_manage_view">
@@ -4,8 +4,8 @@
<record id="seq_pos_session" model="ir.sequence">
<field name="name">POS Session</field>
<field name="code">pos.session</field>
<field name="prefix">POS/%(year)s/%(month)s/%(day)s/</field>
<field name="padding">2</field>
<field name="prefix">POS/</field>
<field name="padding">5</field>
<field name="company_id" eval="False" />
</record>
</data>
@@ -10,13 +10,13 @@
<div class="oe_title">
<label for="name" class="oe_edit_only"/>
<h1>
<field name="name" placeholder="POS Category Name" required="True"/>
<field name="name" placeholder="e.g. Soft Drinks" required="True"/>
</h1>
</div>
<group>
<group>
<field name="parent_id"/>
<field name="sequence"/>
<field name="sequence" groups="base.group_no_one" />
</group>
</group>
</sheet>
@@ -65,7 +65,7 @@
<field name="module_pos_hr"/>
</div>
<div class="o_setting_right_pane" id="login_with_employees">
<span class="o_form_label">Log in with Employees</span>
<span class="o_form_label">Login with Employees</span>
<div class="text-muted">
Use employee credentials to log in to the PoS session and switch cashier
</div>
@@ -201,8 +201,8 @@
<field name="date_order"/>
<field name="pos_reference"/>
<field name="partner_id"/>
<field name="amount_total" sum="Amount total" widget="monetary"/>
<field string="Cashier" name="user_id"/>
<field name="amount_total" sum="Amount total" widget="monetary"/>
</tree>
</field>
</record>
@@ -313,6 +313,7 @@
<field name="arch" type="xml">
<search string="Search Sales Order">
<field name="name"/>
<field name="pos_reference"/>
<field name="date_order"/>
<field name="user_id"/>
<field name="partner_id"/>
@@ -56,7 +56,6 @@
</button>
</div>
<h1 class="oe_title">
Session:
<field name="name" attrs="{'invisible': [('name','=','/')]}" class="oe_inline"/>
</h1>
<group>