Browse Source

[MIG] 12.0 with integration of pos_return

pull/416/head
Pierrick Brun 6 years ago
committed by Roberto Fichera
parent
commit
7a11b6cc2b
  1. 4
      pos_order_mgmt/__manifest__.py
  2. 26
      pos_order_mgmt/models/pos_order.py
  3. 4
      pos_order_mgmt/views/view_pos_config.xml

4
pos_order_mgmt/__manifest__.py

@ -5,7 +5,7 @@
{ {
'name': 'POS Frontend Orders Management', 'name': 'POS Frontend Orders Management',
'summary': 'Manage old POS Orders from the frontend', 'summary': 'Manage old POS Orders from the frontend',
'version': '11.0.1.0.1',
'version': '12.0.1.0.1',
'category': 'Point of Sale', 'category': 'Point of Sale',
'author': 'GRAP, ' 'author': 'GRAP, '
'Tecnativa, ' 'Tecnativa, '
@ -13,7 +13,7 @@
'website': 'https://github.com/OCA/pos', 'website': 'https://github.com/OCA/pos',
'license': 'AGPL-3', 'license': 'AGPL-3',
'depends': [ 'depends': [
'pos_order_return',
'point_of_sale',
], ],
'data': [ 'data': [
'views/assets.xml', 'views/assets.xml',

26
pos_order_mgmt/models/pos_order.py

@ -2,12 +2,28 @@
# Copyright 2018 Tecnativa S.L. - David Vidal # Copyright 2018 Tecnativa S.L. - David Vidal
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, models
from odoo import api, models, fields
class PosOrder(models.Model): class PosOrder(models.Model):
_inherit = 'pos.order' _inherit = 'pos.order'
returned_order_id = fields.Many2one(
comodel_name='pos.order',
string='Returned Order',
readonly=True,
)
refund_order_ids = fields.One2many(
comodel_name='pos.order',
inverse_name='returned_order_id',
string='Refund Orders',
readonly=True,
)
refund_order_qty = fields.Integer(
compute='_compute_refund_order_qty',
string='Refund Orders Quantity',
)
@api.model @api.model
def _prepare_filter_for_pos(self, pos_session_id): def _prepare_filter_for_pos(self, pos_session_id):
return [ return [
@ -43,9 +59,9 @@ class PosOrder(models.Model):
# Search globally by criteria # Search globally by criteria
condition += self._prepare_filter_query_for_pos(pos_session_id, condition += self._prepare_filter_query_for_pos(pos_session_id,
query) query)
fields = self._prepare_fields_for_pos_list()
field_names = self._prepare_fields_for_pos_list()
return self.search_read( return self.search_read(
condition, fields, limit=config.iface_load_done_order_max_qty)
condition, field_names, limit=config.iface_load_done_order_max_qty)
@api.multi @api.multi
def _prepare_done_order_for_pos(self): def _prepare_done_order_for_pos(self):
@ -102,9 +118,7 @@ class PosOrder(models.Model):
if (not pos_order.get('return') or if (not pos_order.get('return') or
not pos_order.get('returned_order_id')): not pos_order.get('returned_order_id')):
return super()._process_order(pos_order) return super()._process_order(pos_order)
order = super(PosOrder,
self.with_context(do_not_check_negative_qty=True)
)._process_order(pos_order)
order = super(PosOrder, self)._process_order(pos_order)
returned_order_id = pos_order.get('returned_order_id') returned_order_id = pos_order.get('returned_order_id')
if isinstance(returned_order_id, int): if isinstance(returned_order_id, int):
order.returned_order_id = self.browse(returned_order_id) order.returned_order_id = self.browse(returned_order_id)

4
pos_order_mgmt/views/view_pos_config.xml

@ -16,7 +16,7 @@
<field name="iface_load_done_order"/> <field name="iface_load_done_order"/>
</div> </div>
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label string="Load Done Orders"/>
<label string="Load Done Orders" for="iface_load_done_order"/>
<div class="text-muted"> <div class="text-muted">
Allow to load done orders in this POS Allow to load done orders in this POS
</div> </div>
@ -25,7 +25,7 @@
<div class="col-xs-12 col-md-6 o_setting_box" id="load_done_order_max_qty" <div class="col-xs-12 col-md-6 o_setting_box" id="load_done_order_max_qty"
attrs="{'invisible': [('iface_load_done_order', '=', False)]}"> attrs="{'invisible': [('iface_load_done_order', '=', False)]}">
<div class="o_setting_right_pane"> <div class="o_setting_right_pane">
<label string="Load Done Order Max Qty."/>
<label string="Load Done Order Max Qty." for="iface_load_done_order_max_qty"/>
<div class="text-muted"> <div class="text-muted">
Maximum number orders to load Maximum number orders to load
</div> </div>

Loading…
Cancel
Save