Browse Source

Merge PR #463 into 12.0

Signed-off-by legalsylvain
pull/496/head
OCA-git-bot 5 years ago
parent
commit
da6ea9bdab
  1. 1
      oca_dependencies.txt
  2. 1
      pos_supplierinfo_barcode/__init__.py
  3. 26
      pos_supplierinfo_barcode/__manifest__.py
  4. 1
      pos_supplierinfo_barcode/models/__init__.py
  5. 17
      pos_supplierinfo_barcode/models/product.py
  6. 1
      pos_supplierinfo_barcode/readme/CONFIGURE.rst
  7. 1
      pos_supplierinfo_barcode/readme/CONTRIBUTORS.rst
  8. 1
      pos_supplierinfo_barcode/readme/DESCRIPTION.rst
  9. 1
      pos_supplierinfo_barcode/readme/USAGE.rst
  10. 29
      pos_supplierinfo_barcode/static/src/js/db.js
  11. 10
      pos_supplierinfo_barcode/views/assets.xml
  12. 1
      setup/pos_supplierinfo_barcode/odoo/addons/pos_supplierinfo_barcode
  13. 6
      setup/pos_supplierinfo_barcode/setup.py

1
oca_dependencies.txt

@ -1,2 +1,3 @@
queue queue
partner-contact partner-contact
stock-logistics-barcode

1
pos_supplierinfo_barcode/__init__.py

@ -0,0 +1 @@
from . import models

26
pos_supplierinfo_barcode/__manifest__.py

@ -0,0 +1,26 @@
# Copyright 2020 Lorenzo Battistini @ TAKOBI
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Point of sale - Supplier barcodes",
"summary": "Search products by supplier barcode",
"version": "12.0.1.0.0",
"development_status": "Beta",
"category": "Point Of Sale",
"website": "https://github.com/OCA/pos",
"author": "TAKOBI, Odoo Community Association (OCA)",
"maintainers": ["eLBati"],
"license": "LGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"preloadable": True,
"depends": [
"product_supplierinfo_barcode",
"point_of_sale",
],
"data": [
"views/assets.xml",
],
"demo": [
],
}

1
pos_supplierinfo_barcode/models/__init__.py

@ -0,0 +1 @@
from . import product

17
pos_supplierinfo_barcode/models/product.py

@ -0,0 +1,17 @@
import json
from odoo import models, fields, api
class ProductTemplate(models.Model):
_inherit = 'product.template'
# technical field used in POS frontend
supplier_barcode_json = fields.Char(
"Supplier barcode list", readonly=True,
compute="_compute_supplier_barcode_json")
@api.multi
def _compute_supplier_barcode_json(self):
for t in self:
supplier_barcode_json = [x for x in t.mapped('seller_ids.barcode') if x]
t.supplier_barcode_json = json.dumps(supplier_barcode_json)

1
pos_supplierinfo_barcode/readme/CONFIGURE.rst

@ -0,0 +1 @@
Open product form and click purchase tab. In Vendors lines, set Barcode field.

1
pos_supplierinfo_barcode/readme/CONTRIBUTORS.rst

@ -0,0 +1 @@
* Lorenzo Battistini (https://takobi.online)

1
pos_supplierinfo_barcode/readme/DESCRIPTION.rst

@ -0,0 +1 @@
In point of sale interface, allow to scan suppliers barcodes to add products to order.

1
pos_supplierinfo_barcode/readme/USAGE.rst

@ -0,0 +1 @@
In point of sale interface, just scan a barcode configured for a supplier. The product will be added to order.

29
pos_supplierinfo_barcode/static/src/js/db.js

@ -0,0 +1,29 @@
odoo.define('pos_supplierinfo_barcode.db', function (require) {
"use strict";
var PosDB = require('point_of_sale.DB');
var models = require('point_of_sale.models');
models.load_fields("product.product", ["supplier_barcode_json"]);
PosDB.include({
add_products: function(products) {
var res = this._super(products);
if(!products instanceof Array){
products = [products];
}
for(var i = 0, len = products.length; i < len; i++){
var product = products[i];
var supplier_barcode_list = JSON.parse(product.supplier_barcode_json);
for(var j = 0, jlen = supplier_barcode_list.length; j < jlen; j++){
var supplier_barcode = supplier_barcode_list[j];
this.product_by_barcode[supplier_barcode] = product;
}
}
return res;
},
});
});

10
pos_supplierinfo_barcode/views/assets.xml

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets" inherit_id="point_of_sale.assets">
<xpath expr="." position="inside">
<script type="text/javascript" src="/pos_supplierinfo_barcode/static/src/js/db.js"/>
</xpath>
</template>
</odoo>

1
setup/pos_supplierinfo_barcode/odoo/addons/pos_supplierinfo_barcode

@ -0,0 +1 @@
../../../../pos_supplierinfo_barcode

6
setup/pos_supplierinfo_barcode/setup.py

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
Loading…
Cancel
Save