Browse Source

[ADD] new module 'pos_return_order';

pull/269/head
Sylvain LE GAL 9 years ago
committed by David
parent
commit
616379ab87
  1. 96
      pos_return_order/README.rst
  2. 2
      pos_return_order/__init__.py
  3. 28
      pos_return_order/__openerp__.py
  4. 18
      pos_return_order/demo/product_product.xml
  5. 189
      pos_return_order/i18n/fr.po
  6. 6
      pos_return_order/models/__init__.py
  7. 80
      pos_return_order/models/pos_order.py
  8. 65
      pos_return_order/models/pos_order_line.py
  9. 40
      pos_return_order/models/pos_partial_return_wizard.py
  10. 28
      pos_return_order/models/pos_partial_return_wizard_line.py
  11. 15
      pos_return_order/models/product_template.py
  12. BIN
      pos_return_order/static/description/icon.png
  13. BIN
      pos_return_order/static/description/initial_pos_order_required.png
  14. BIN
      pos_return_order/static/description/partial_return_wizard.png
  15. BIN
      pos_return_order/static/description/product_returnable_bottle.png
  16. BIN
      pos_return_order/static/description/returned_qty_over_initial.png
  17. BIN
      pos_return_order/static/description/sum_returned_qty_over_initial.png
  18. BIN
      pos_return_order/static/img/product_returnable_bottle-image.jpg
  19. 20
      pos_return_order/views/action.xml
  20. 23
      pos_return_order/views/pos_order_line_view.xml
  21. 37
      pos_return_order/views/pos_order_view.xml
  22. 32
      pos_return_order/views/pos_partial_return_wizard_view.xml
  23. 20
      pos_return_order/views/product_product_view.xml

96
pos_return_order/README.rst

@ -0,0 +1,96 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
==================
PoS - Return Order
==================
This module extends the functionality of odoo Point Of Sale about POS Order
returns.
With this module, it is now forbidden to return more quantity than the initial
one.
A link is created between the returned Order and the initial Order.
A link is created between the returned Order Line and the initial Order Line.
Implemented Features
====================
* A wizard that allow to select just some products to return:
.. image:: /pos_return_order/static/description/partial_return_wizard.png
Implemented Constraints
=======================
* User can not return more products than the initial quantity:
.. image:: /pos_return_order/static/description/returned_qty_over_initial.png
* If a line has been partially refund, only a reduced quantity can be returned:
.. image:: /pos_return_order/static/description/sum_returned_qty_over_initial.png
* It is not possible to set a negative quantity if the initial Pos Order is
not indicated:
.. image:: /pos_return_order/static/description/initial_pos_order_required.png
Configuration
=============
In some case, you want to let the possibility to allow negative quantity
in a PoS Order, without mentioning initial order. This can happen for special
products like returnable products, ...
In that case, a checkbox is possible on Product Form View to allow such case
.. image:: /pos_return_order/static/description/product_returnable_bottle.png
Usage
=====
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/184/9.0
Bug Tracker
===========
Bugs are tracked on `GitHub Issues
<https://github.com/OCA/pos/issues>`_. In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
Credits
=======
Contributors
------------
* Sylvain LE GAL <https://twitter.com/legalsylvain>
Funders
-------
The development of this module has been financially supported by:
* La Louve (www.lalouve.net)
* GRAP, Groupement Régional Alimentaire de Proximité (www.grap.coop)
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

2
pos_return_order/__init__.py

@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import models

28
pos_return_order/__openerp__.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Point of Sale Return Order',
'version': '9.0.1.0.0',
'category': 'Point Of Sale',
'summary': 'Point of Sale Return Order',
'author': 'La Louve, GRAP, Odoo Community Association (OCA)',
'website': 'http://www.lalouve.net',
'depends': [
'point_of_sale',
],
'data': [
'views/action.xml',
'views/pos_order_view.xml',
'views/pos_order_line_view.xml',
'views/product_product_view.xml',
'views/pos_partial_return_wizard_view.xml',
],
'demo': [
'demo/product_product.xml',
],
'installable': True,
}

18
pos_return_order/demo/product_product.xml

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="product_product_returnable_bottle" model="product.product">
<field name="name">Returnable Bottle</field>
<field name="default_code">RET-BOTL</field>
<field name="categ_id" ref="product.product_category_all" />
<field name="uom_id" ref="product.product_uom_unit" />
<field name="pos_categ_id" ref="point_of_sale.soft" />
<field name="sale_ok" eval="True" />
<field name="available_in_pos" eval="True" />
<field name="pos_allow_negative_qty" eval="True" />
<field name="list_price" eval="0.20" />
<field name="image" type="base64" file="pos_return_order/static/img/product_returnable_bottle-image.jpg"/>
</record>
</odoo>

189
pos_return_order/i18n/fr.po

@ -0,0 +1,189 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pos_return_order
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 9.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-03 23:54+0000\n"
"PO-Revision-Date: 2016-04-03 23:54+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_product_template_pos_allow_negative_qty
msgid "Allow Negative Quantity on PoS"
msgstr "PdV - Autoriser les quantités négatives"
#. module: pos_return_order
#: model:ir.ui.view,arch_db:pos_return_order.view_partial_return_wizard_form
msgid "Cancel"
msgstr "Annuler"
#. module: pos_return_order
#: model:ir.model.fields,help:pos_return_order.field_pos_partial_return_wizard_line_max_returnable_qty
msgid "Compute maximum quantity that can be returned for this line, depending of the quantity of the line and other possible refunds."
msgstr "Calcule la quantité maximum qui peut être retournée pour cette ligne, en fonction de la quantité de la ligne original, et des possibles retours."
#. module: pos_return_order
#: model:ir.ui.view,arch_db:pos_return_order.view_partial_return_wizard_form
msgid "Confirm"
msgstr "Confirmer"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_create_uid
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_create_uid
msgid "Created by"
msgstr "Créé par"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_create_date
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_create_date
msgid "Created on"
msgstr "Créé le"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_display_name
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_display_name
msgid "Display Name"
msgstr "Nom affiché"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_id
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_id
msgid "ID"
msgstr "ID"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_initial_qty
msgid "Initial Quantity"
msgstr "Quantité initial"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard___last_update
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line___last_update
msgid "Last Modified on"
msgstr "Dernière modification le"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_write_uid
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_write_uid
msgid "Last Updated by"
msgstr "Mis à jour par"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_write_date
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_write_date
msgid "Last Updated on"
msgstr "Mis à jour le"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_pos_order_line_id
msgid "Line To Return"
msgstr "Ligne à retourner"
#. module: pos_return_order
#: model:ir.model,name:pos_return_order.model_pos_order_line
msgid "Lines of Point of Sale"
msgstr "Lignes de Points de Vente"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_ids
#: model:ir.ui.view,arch_db:pos_return_order.view_partial_return_wizard_form
msgid "Lines to Return"
msgstr "Lignes à retourner"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_order_id
msgid "Order to Return"
msgstr "Vente à retourner"
#. module: pos_return_order
#: model:ir.ui.view,arch_db:pos_return_order.view_partial_return_wizard_form
#: model:ir.ui.view,arch_db:pos_return_order.view_pos_order_form
msgid "Partial Return"
msgstr "Retourner partiellement"
#. module: pos_return_order
#: model:ir.actions.act_window,name:pos_return_order.action_pos_partial_return_wizard
msgid "Partial Return Wizard"
msgstr "Assistant de retour partiel"
#. module: pos_return_order
#: model:ir.model,name:pos_return_order.model_pos_order
msgid "Point of Sale"
msgstr "Point de vente"
#. module: pos_return_order
#: model:ir.model,name:pos_return_order.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"
#. module: pos_return_order
#: model:ir.model.fields,help:pos_return_order.field_pos_partial_return_wizard_line_initial_qty
msgid "Quantity of Product initially sold"
msgstr "Quantité de produit initialement vendue"
#. module: pos_return_order
#: model:ir.ui.view,arch_db:pos_return_order.view_pos_order_form
#: model:ir.ui.view,arch_db:pos_return_order.view_pos_order_line_form
msgid "Refund"
msgstr "Avoir"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_order_line_refund_line_ids
msgid "Refund Lines"
msgstr "Lignes de vente retournées"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_order_refund_order_ids
msgid "Refund Orders"
msgstr "Ventes retournées"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_order_refund_order_qty
msgid "Refund Orders Quantity"
msgstr "Nombre de ventes retournées"
#. module: pos_return_order
#: model:product.product,name:pos_return_order.product_product_returnable_bottle
#: model:product.template,name:pos_return_order.product_product_returnable_bottle_product_template
msgid "Returnable Bottle"
msgstr "Bouteille consignée"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_max_returnable_qty
msgid "Returnable Quantity"
msgstr "Quantité retournable"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_order_line_returned_line_id
#: model:ir.model.fields,field_description:pos_return_order.field_pos_order_returned_order_id
msgid "Returned Order"
msgstr "Vente retournée"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_qty
msgid "Returned Quantity"
msgstr "Quantité retournée"
#. module: pos_return_order
#: model:ir.model.fields,field_description:pos_return_order.field_pos_partial_return_wizard_line_wizard_id
msgid "Wizard"
msgstr "Assistant"
#. module: pos_return_order
#: model:ir.model,name:pos_return_order.model_pos_partial_return_wizard
msgid "pos.partial.return.wizard"
msgstr "pos.partial.return.wizard"
#. module: pos_return_order
#: model:ir.model,name:pos_return_order.model_pos_partial_return_wizard_line
msgid "pos.partial.return.wizard.line"
msgstr "pos.partial.return.wizard.line"

6
pos_return_order/models/__init__.py

@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
from . import product_template
from . import pos_order
from . import pos_order_line
from . import pos_partial_return_wizard
from . import pos_partial_return_wizard_line

80
pos_return_order/models/pos_order.py

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
from openerp.addons import decimal_precision as dp
class PosOrder(models.Model):
_inherit = 'pos.order'
# Column Section
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',
digits=dp.get_precision('Product Unit of Measure'))
# Compute Section
@api.multi
def _compute_refund_order_qty(self):
for order in self:
order.refund_order_qty = len(order.refund_order_ids)
@api.multi
def _blank_refund(self):
self.ensure_one()
# Call super to use original refund algorithm (session management, ...)
ctx = self.env.context.copy()
ctx.update({'do_not_check_negative_qty': True})
res = super(PosOrder, self.with_context(ctx)).refund()
# Link Order
original_order = self[0]
new_order = self.browse(res['res_id'])
new_order.returned_order_id = original_order.id
# Remove created lines and recreate and link Lines
new_order.lines.unlink()
return res, new_order
# Action Section
@api.multi
def refund(self):
res, new_order = self._blank_refund()
for line in self[0].lines:
qty = - line.max_returnable_qty([])
if qty != 0:
copy_line = line.copy()
copy_line.write({
'order_id': new_order.id,
'returned_line_id': line.id,
'qty': qty,
})
return res
# Action Section
@api.multi
def partial_refund(self, partial_return_wizard):
res, new_order = self._blank_refund()
for wizard_line in partial_return_wizard.line_ids:
qty = - wizard_line.qty
if qty != 0:
copy_line = wizard_line.pos_order_line_id.copy()
copy_line.write({
'order_id': new_order.id,
'returned_line_id': wizard_line.pos_order_line_id.id,
'qty': qty,
})
return res

65
pos_return_order/models/pos_order_line.py

@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
from openerp.exceptions import ValidationError
from openerp.tools.translate import _
class PosOrderLine(models.Model):
_inherit = 'pos.order.line'
# Column Section
returned_line_id = fields.Many2one(
comodel_name='pos.order.line', string='Returned Order',
readonly=True)
refund_line_ids = fields.One2many(
comodel_name='pos.order.line', inverse_name='returned_line_id',
string='Refund Lines', readonly=True)
# Compute Section
@api.model
def max_returnable_qty(self, ignored_line_ids):
qty = self.qty
for refund_line in self.refund_line_ids:
if refund_line.id not in ignored_line_ids:
qty += refund_line.qty
return qty
# Constraint Section
@api.one
@api.constrains('returned_line_id', 'qty')
def _check_return_qty(self):
if self.env.context.get('do_not_check_negative_qty', False):
return True
if self.returned_line_id:
if - self.qty > self.returned_line_id.qty:
raise ValidationError(_(
"You can not return %d %s of %s because the original"
" Order line only mentions %d %s.") % (
- self.qty, self.product_id.uom_id.name,
self.product_id.name, self.returned_line_id.qty,
self.product_id.uom_id.name))
elif - self.qty >\
self.returned_line_id.max_returnable_qty([self.id]):
raise ValidationError(_(
"You can not return %d %s of %s because some refunds"
" has been yet done.\n Maximum quantity allowed :"
" %d %s.") % (
- self.qty, self.product_id.uom_id.name,
self.product_id.name,
self.returned_line_id.max_returnable_qty([self.id]),
self.product_id.uom_id.name))
else:
if self.qty < 0 and\
not self.product_id.product_tmpl_id.pos_allow_negative_qty:
raise ValidationError(_(
"For legal and traceability reasons, you can not set a"
" negative quantity (%d %s of %s), without using return"
" wizard.") % (
self.qty, self.product_id.uom_id.name,
self.product_id.name))

40
pos_return_order/models/pos_partial_return_wizard.py

@ -0,0 +1,40 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class PosPartialReturnWizard(models.TransientModel):
_name = 'pos.partial.return.wizard'
order_id = fields.Many2one(
comodel_name='pos.order', string='Order to Return')
line_ids = fields.One2many(
comodel_name='pos.partial.return.wizard.line',
inverse_name='wizard_id', string='Lines to Return')
@api.multi
def confirm(self):
self.ensure_one()
return self[0].order_id.partial_refund(self[0])
@api.model
def default_get(self, fields):
order_obj = self.env['pos.order']
res = super(PosPartialReturnWizard, self).default_get(fields)
order = order_obj.browse(self.env.context.get('active_id', False))
if order:
line_ids = []
for line in order.lines:
line_ids.append((0, 0, {
'pos_order_line_id': line.id,
'initial_qty': line.qty,
'max_returnable_qty': line.max_returnable_qty([]),
}))
res.update({
'order_id': order.id,
'line_ids': line_ids})
return res

28
pos_return_order/models/pos_partial_return_wizard_line.py

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class PosPartialReturnWizardLine(models.TransientModel):
_name = 'pos.partial.return.wizard.line'
wizard_id = fields.Many2one(
comodel_name='pos.partial.return.wizard', string='Wizard')
pos_order_line_id = fields.Many2one(
comodel_name='pos.order.line', required=True, readonly=True,
string='Line To Return')
initial_qty = fields.Float(
string='Initial Quantity', readonly=True,
help="Quantity of Product initially sold")
max_returnable_qty = fields.Float(
string='Returnable Quantity', readonly=True,
help="Compute maximum quantity that can be returned for this line,"
" depending of the quantity of the line and other possible refunds.")
qty = fields.Float(string='Returned Quantity', default=0.0)

15
pos_return_order/models/product_template.py

@ -0,0 +1,15 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
# Column Section
pos_allow_negative_qty = fields.Boolean(
string='Allow Negative Quantity on PoS')

BIN
pos_return_order/static/description/icon.png

After

Width: 64  |  Height: 64  |  Size: 4.6 KiB

BIN
pos_return_order/static/description/initial_pos_order_required.png

After

Width: 590  |  Height: 179  |  Size: 10 KiB

BIN
pos_return_order/static/description/partial_return_wizard.png

After

Width: 890  |  Height: 386  |  Size: 24 KiB

BIN
pos_return_order/static/description/product_returnable_bottle.png

After

Width: 849  |  Height: 324  |  Size: 48 KiB

BIN
pos_return_order/static/description/returned_qty_over_initial.png

After

Width: 592  |  Height: 181  |  Size: 10 KiB

BIN
pos_return_order/static/description/sum_returned_qty_over_initial.png

After

Width: 592  |  Height: 182  |  Size: 12 KiB

BIN
pos_return_order/static/img/product_returnable_bottle-image.jpg

After

Width: 600  |  Height: 600  |  Size: 22 KiB

20
pos_return_order/views/action.xml

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="action_pos_partial_return_wizard" model="ir.actions.act_window">
<field name="name">Partial Return Wizard</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">pos.partial.return.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

23
pos_return_order/views/pos_order_line_view.xml

@ -0,0 +1,23 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_pos_order_line_form" model="ir.ui.view">
<field name="model">pos.order.line</field>
<field name="inherit_id" ref="point_of_sale.view_pos_order_line_form"/>
<field name="arch" type="xml">
<group position="after">
<group col="4" string="Refund">
<field name="returned_line_id" colspan="4"/>
<field name="refund_line_ids" />
</group>
</group>
</field>
</record>
</odoo>

37
pos_return_order/views/pos_order_view.xml

@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_pos_order_form" model="ir.ui.view">
<field name="model">pos.order</field>
<field name="inherit_id" ref="point_of_sale.view_pos_pos_form"/>
<field name="arch" type="xml">
<button name="refund" position="attributes">
<attribute name="attrs">{'invisible':['|', ('state','=','draft'), ('returned_order_id', '!=', False)]}</attribute>
</button>
<button name="refund" position="after">
<button name="%(action_pos_partial_return_wizard)d" string="Partial Return" type="action"
attrs="{'invisible':['|', ('state','=','draft'), ('returned_order_id', '!=', False)]}"/>
</button>
<notebook>
<page string="Refund" attrs="{'invisible':[('returned_order_id', '=', False), ('refund_order_qty', '=', 0)]}">
<field name="returned_order_id" attrs="{'invisible':[('returned_order_id', '=', False)]}"/>
<field name="refund_order_ids" attrs="{'invisible':[('refund_order_qty', '=', 0)]}"/>
<field name="refund_order_qty" invisible="1"/>
</page>
</notebook>
<xpath expr="//field[@name='lines']/form/group" position="after">
<group col="4" string="Refund">
<field name="returned_line_id" colspan="4"/>
<field name="refund_line_ids" />
</group>
</xpath>
</field>
</record>
</odoo>

32
pos_return_order/views/pos_partial_return_wizard_view.xml

@ -0,0 +1,32 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_partial_return_wizard_form" model="ir.ui.view">
<field name="model">pos.partial.return.wizard</field>
<field name="arch" type="xml">
<form string="Partial Return">
<group string="Lines to Return">
<field name="line_ids" nolabel="1">
<tree editable="bottom">
<field name="pos_order_line_id"/>
<field name="initial_qty"/>
<field name="max_returnable_qty"/>
<field name="qty"/>
</tree>
</field>
</group>
<footer>
<button string="Confirm" name="confirm" type="object" class="btn-primary"/>
<button string="Cancel" special="cancel" class="btn-default"/>
</footer>
</form>
</field>
</record>
</odoo>

20
pos_return_order/views/product_product_view.xml

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2016-Today: La Louve (<http://www.lalouve.net/>)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>
<record id="view_product_template_form" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="point_of_sale.product_template_form_view"/>
<field name="arch" type="xml">
<field name="to_weight" position="after">
<field name="pos_allow_negative_qty" />
</field>
</field>
</record>
</odoo>
Loading…
Cancel
Save