-
-
Notifications
You must be signed in to change notification settings - Fork 602
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Iván Todorovich <ivan.todorovich@gmail.com>
- Loading branch information
1 parent
d196ff7
commit 3350cc5
Showing
13 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (C) 2023-Today: GRAP (<http://www.grap.coop/>) | ||
# @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 - Mergeable Lines", | ||
"summary": "Allows to configure at the product level," | ||
" if an order line can be merged or not.", | ||
"version": "12.0.1.0.1", | ||
"category": "Point of Sale", | ||
"author": "GRAP, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/pos", | ||
"license": "AGPL-3", | ||
"maintainers": ["legalsylvain"], | ||
"depends": [ | ||
"point_of_sale", | ||
], | ||
"data": [ | ||
"views/templates.xml", | ||
"views/view_product_template.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * pos_product_mergeable_line | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 12.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2023-03-30 15:11+0000\n" | ||
"PO-Revision-Date: 2023-03-30 15:11+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_product_mergeable_line | ||
#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_product__pos_mergeable_line | ||
#: model:ir.model.fields,help:pos_product_mergeable_line.field_product_template__pos_mergeable_line | ||
msgid "If unchecked, the product will never be merged with a previous line, in the Point of sale." | ||
msgstr "Si la case est décochée, l'article ne sera jamais regroupé avec la ligne précédente, dans le point de vente." | ||
|
||
#. module: pos_product_mergeable_line | ||
#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_product__pos_mergeable_line | ||
#: model:ir.model.fields,field_description:pos_product_mergeable_line.field_product_template__pos_mergeable_line | ||
msgid "Mergeable Line" | ||
msgstr "Ligne regroupable" | ||
|
||
#. module: pos_product_mergeable_line | ||
#: model:ir.model,name:pos_product_mergeable_line.model_product_template | ||
msgid "Product Template" | ||
msgstr "Modèle d'article" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (C) 2023-Today: GRAP (<http://www.grap.coop/>) | ||
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
pos_mergeable_line = fields.Boolean( | ||
string="Mergeable Line", | ||
default=True, | ||
help="If unchecked, the product will never" | ||
" be merged with a previous line, in the Point of sale.", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This module extends the Odoo Point of Sale to prevent to merge lines if product | ||
is configured. | ||
|
||
By default, new line can be merged with a previous one if the informations are the same. | ||
(same product, same restaurant note, etc...) and if the UoM Category allow it. | ||
|
||
The new module add a boolean field 'Mergeable Line' (default True). | ||
|
||
If unchecked, the product will never be merged into another line. | ||
|
||
That's important in some context, as in the management of returnable products, | ||
where we want to have a record of all movements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright (C) 2023-Today: GRAP (http://www.grap.coop) | ||
@author: Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
*/ | ||
|
||
odoo.define("pos_product_mergeable_line.models", function (require) { | ||
"use strict"; | ||
|
||
const models = require("point_of_sale.models"); | ||
|
||
models.load_fields("product.product", ["pos_mergeable_line"]); | ||
|
||
const OrderlineSuper = models.Orderline.prototype; | ||
|
||
models.Orderline = models.Orderline.extend({ | ||
can_be_merged_with: function(orderline){ | ||
if (! orderline.product.pos_mergeable_line) { | ||
return false; | ||
} | ||
return OrderlineSuper.can_be_merged_with.apply(this, arguments); | ||
}, | ||
}); | ||
|
||
return models; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright 2023 - Today Sylvain LE GAL (https://twitter.com/legalsylvain) | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
--> | ||
|
||
<odoo> | ||
<template id="point_of_sale_assets" name="pos_product_mergeable_line" inherit_id="point_of_sale.assets"> | ||
<xpath expr="." position="inside"> | ||
<script type="text/javascript" src="/pos_product_mergeable_line/static/src/js/models.js"></script> | ||
</xpath> | ||
</template> | ||
</odoo> |
17 changes: 17 additions & 0 deletions
17
pos_product_mergeable_line/views/view_product_template.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
Copyright 2023 - Today 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="product.product_template_form_view"/> | ||
<field name="arch" type="xml"> | ||
<field name="to_weight" position="after"> | ||
<field name="pos_mergeable_line" /> | ||
</field> | ||
</field> | ||
</record> | ||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/pos_product_mergeable_line/odoo/addons/pos_product_mergeable_line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pos_product_mergeable_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |