first commit
This commit is contained in:
2
modules/product_price_list_cache/__init__.py
Normal file
2
modules/product_price_list_cache/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
Binary file not shown.
BIN
modules/product_price_list_cache/__pycache__/ir.cpython-311.pyc
Normal file
BIN
modules/product_price_list_cache/__pycache__/ir.cpython-311.pyc
Normal file
Binary file not shown.
Binary file not shown.
14
modules/product_price_list_cache/ir.py
Normal file
14
modules/product_price_list_cache/ir.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class Cron(metaclass=PoolMeta):
|
||||
__name__ = 'ir.cron'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.method.selection.append(
|
||||
('product.price_list|fill_cache', "Fill Product Price List Cache"))
|
||||
39
modules/product_price_list_cache/locale/bg.po
Normal file
39
modules/product_price_list_cache/locale/bg.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/ca.po
Normal file
39
modules/product_price_list_cache/locale/ca.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Patró"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Tarifa"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Producte"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Preus unitaris"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "UdM"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "Tarifes en cache"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "La unitat de mesura."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Actualitza la cache de tarifes"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Actualitza la cache de tarifes"
|
||||
39
modules/product_price_list_cache/locale/cs.po
Normal file
39
modules/product_price_list_cache/locale/cs.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/de.po
Normal file
39
modules/product_price_list_cache/locale/de.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Schema"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Preiskonditionsschema"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Artikel"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Einzelpreise"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "Maßeinheit"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "Preiskonditionsschemata Cache"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "Die Maßeinheit."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Artikel Preiskonditionsschema Cache"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Artikel Preiskonditionsschema Cache aktualisieren"
|
||||
39
modules/product_price_list_cache/locale/es.po
Normal file
39
modules/product_price_list_cache/locale/es.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Patrón"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Tarifa"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Producto"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Precios unitarios"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "UdM"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "Tarifas en cache"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "La unidad de medida."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Actualizar la cache de tarifas"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Actualizar la cache de tarifas"
|
||||
39
modules/product_price_list_cache/locale/es_419.po
Normal file
39
modules/product_price_list_cache/locale/es_419.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/et.po
Normal file
39
modules/product_price_list_cache/locale/et.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/fa.po
Normal file
39
modules/product_price_list_cache/locale/fa.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/fi.po
Normal file
39
modules/product_price_list_cache/locale/fi.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/fr.po
Normal file
39
modules/product_price_list_cache/locale/fr.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Motif"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Liste de prix"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Produit"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Prix unitaires"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "UDM"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "Listes de prix mises en cache"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "L'unité de mesure."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Cache de la liste de prix des produits"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Remplir le cache des listes de prix des produits"
|
||||
39
modules/product_price_list_cache/locale/hu.po
Normal file
39
modules/product_price_list_cache/locale/hu.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/id.po
Normal file
39
modules/product_price_list_cache/locale/id.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/it.po
Normal file
39
modules/product_price_list_cache/locale/it.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/lo.po
Normal file
39
modules/product_price_list_cache/locale/lo.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/lt.po
Normal file
39
modules/product_price_list_cache/locale/lt.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/nl.po
Normal file
39
modules/product_price_list_cache/locale/nl.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Patroon"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Prijslijst"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Product"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Eenheidsprijzen"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "Maateenheid"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "In cache opgeslagen prijslijsten"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "De maateenheid."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Product prijslijst cache"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Vul de cache van de product prijslijst"
|
||||
39
modules/product_price_list_cache/locale/pl.po
Normal file
39
modules/product_price_list_cache/locale/pl.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
40
modules/product_price_list_cache/locale/pt.po
Normal file
40
modules/product_price_list_cache/locale/pt.po
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
#, fuzzy
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr "Padrão"
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr "Lista de Preços"
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr "Produto"
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr "Preço Unitário"
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr "UdM"
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr "Cache da Lista de Preços"
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr "A unidade de medida."
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr "Cache da Lista de Preços dos Produtos"
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr "Preencher Cache da Lista de Preço de Produtos"
|
||||
39
modules/product_price_list_cache/locale/ro.po
Normal file
39
modules/product_price_list_cache/locale/ro.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/ru.po
Normal file
39
modules/product_price_list_cache/locale/ru.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/sl.po
Normal file
39
modules/product_price_list_cache/locale/sl.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/tr.po
Normal file
39
modules/product_price_list_cache/locale/tr.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/uk.po
Normal file
39
modules/product_price_list_cache/locale/uk.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
39
modules/product_price_list_cache/locale/zh_CN.po
Normal file
39
modules/product_price_list_cache/locale/zh_CN.po
Normal file
@@ -0,0 +1,39 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list.cache,pattern:"
|
||||
msgid "Pattern"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,price_list:"
|
||||
msgid "Price List"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,product:"
|
||||
msgid "Product"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,raw_unit_prices:"
|
||||
msgid "Unit Prices"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.price_list.cache,uom:"
|
||||
msgid "UoM"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:product.product,cached_price_lists:"
|
||||
msgid "Cached Price Lists"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.cache,uom:"
|
||||
msgid "The Unit of Measure."
|
||||
msgstr ""
|
||||
|
||||
msgctxt "model:product.price_list.cache,string:"
|
||||
msgid "Product Price List Cache"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:ir.cron,method:"
|
||||
msgid "Fill Product Price List Cache"
|
||||
msgstr ""
|
||||
185
modules/product_price_list_cache/product.py
Normal file
185
modules/product_price_list_cache/product.py
Normal file
@@ -0,0 +1,185 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
import json
|
||||
from functools import partial
|
||||
|
||||
from sql import Null
|
||||
|
||||
from trytond.cache import Cache, freeze
|
||||
from trytond.model import ModelSQL, dualmethod, fields
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.protocols.jsonrpc import JSONDecoder, JSONEncoder
|
||||
from trytond.tools import grouped_slice, reduce_ids
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
dumps = partial(
|
||||
json.dumps, cls=JSONEncoder, separators=(',', ':'), sort_keys=True,
|
||||
ensure_ascii=False)
|
||||
loads = partial(json.loads, object_hook=JSONDecoder())
|
||||
|
||||
|
||||
class Product(metaclass=PoolMeta):
|
||||
__name__ = 'product.product'
|
||||
|
||||
cached_price_lists = fields.One2Many(
|
||||
'product.price_list.cache', 'product',
|
||||
"Cached Price Lists", readonly=True)
|
||||
|
||||
|
||||
class PriceList(metaclass=PoolMeta):
|
||||
__name__ = 'product.price_list'
|
||||
|
||||
@dualmethod
|
||||
def fill_cache(cls, price_lists=None, products=None):
|
||||
pool = Pool()
|
||||
Product = pool.get('product.product')
|
||||
Line = pool.get('product.price_list.line')
|
||||
Cache = pool.get('product.price_list.cache')
|
||||
line = Line.__table__()
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
||||
Cache.clear(price_lists=price_lists, products=products)
|
||||
|
||||
if price_lists is None:
|
||||
price_lists = cls.search([])
|
||||
if products is None:
|
||||
products = Product.search([])
|
||||
|
||||
cursor.execute(*line.select(
|
||||
line.quantity, distinct=True,
|
||||
where=line.quantity != Null))
|
||||
quantities = sorted({0} | {q for q, in cursor})
|
||||
|
||||
for price_list in price_lists:
|
||||
caches = []
|
||||
with Transaction().set_context(Cache.context(price_list)):
|
||||
for product in Product.browse(products):
|
||||
uom = price_list.get_uom(product)
|
||||
for pattern in Cache.patterns(price_list, product):
|
||||
unit_prices = []
|
||||
for quantity in quantities:
|
||||
unit_price = price_list.compute(
|
||||
product, quantity, uom, pattern=pattern)
|
||||
if (unit_prices
|
||||
and unit_prices[-1][1] == unit_price):
|
||||
continue
|
||||
else:
|
||||
unit_prices.append((quantity, unit_price))
|
||||
caches.append(Cache(
|
||||
price_list=price_list,
|
||||
product=product,
|
||||
uom=uom,
|
||||
raw_unit_prices=dumps(unit_prices),
|
||||
pattern=pattern))
|
||||
Cache.save(caches)
|
||||
|
||||
def compute(self, product, quantity, uom, pattern=None):
|
||||
pool = Pool()
|
||||
Cache = pool.get('product.price_list.cache')
|
||||
cache = Cache.get(self, product, pattern=pattern)
|
||||
unit_price = None
|
||||
if cache:
|
||||
unit_price = cache.get_unit_price(quantity, uom)
|
||||
if unit_price is None:
|
||||
unit_price = super().compute(
|
||||
product, quantity, uom, pattern=pattern)
|
||||
return unit_price
|
||||
|
||||
|
||||
class PriceListCache(ModelSQL):
|
||||
__name__ = 'product.price_list.cache'
|
||||
|
||||
price_list = fields.Many2One(
|
||||
'product.price_list', "Price List", required=True, ondelete='CASCADE')
|
||||
product = fields.Many2One(
|
||||
'product.product', "Product", required=True, ondelete='CASCADE')
|
||||
uom = fields.Many2One(
|
||||
'product.uom', "UoM", required=True, ondelete='CASCADE',
|
||||
help="The Unit of Measure.")
|
||||
raw_unit_prices = fields.Char("Unit Prices")
|
||||
pattern = fields.Dict(None, "Pattern")
|
||||
|
||||
_get_cache = Cache('product.price_list.cache.get', context=False)
|
||||
_unit_prices_cache = Cache(
|
||||
'product.price_list.cache.unit_prices', context=False)
|
||||
|
||||
@classmethod
|
||||
def context(cls, price_list):
|
||||
return {
|
||||
'company': price_list.company.id,
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def patterns(cls, price_list, product):
|
||||
yield None
|
||||
|
||||
@property
|
||||
def unit_prices(self):
|
||||
unit_prices = self._unit_prices_cache.get(self.raw_unit_prices)
|
||||
if unit_prices is None:
|
||||
unit_prices = loads(self.raw_unit_prices)
|
||||
self._unit_prices_cache.set(self.raw_unit_prices, unit_prices)
|
||||
return unit_prices
|
||||
|
||||
@classmethod
|
||||
def get(cls, price_list, product, pattern=None):
|
||||
if not price_list or not product:
|
||||
return
|
||||
if not pattern:
|
||||
pattern = None
|
||||
key = (price_list.id, product.id, freeze(pattern))
|
||||
try:
|
||||
cache_id, uom, raw_unit_prices = cls._get_cache.get(key)
|
||||
except TypeError:
|
||||
for cache in product.cached_price_lists:
|
||||
if (cache.price_list == price_list
|
||||
and cache.pattern == pattern):
|
||||
cls._get_cache.set(
|
||||
key, (cache.id, cache.uom.id, cache.raw_unit_prices))
|
||||
return cache
|
||||
else:
|
||||
return cls(cache_id, uom=uom, raw_unit_prices=raw_unit_prices)
|
||||
|
||||
def get_unit_price(self, quantity, uom):
|
||||
pool = Pool()
|
||||
UoM = pool.get('product.uom')
|
||||
quantity = UoM.compute_qty(uom, quantity, self.uom)
|
||||
quantity = abs(quantity)
|
||||
unit_price = None
|
||||
for qty, cur_unit_price in self.unit_prices:
|
||||
if qty > quantity:
|
||||
return unit_price
|
||||
unit_price = cur_unit_price
|
||||
return unit_price
|
||||
|
||||
@classmethod
|
||||
def clear(cls, price_lists=None, products=None):
|
||||
cache = cls.__table__()
|
||||
cursor = Transaction().connection.cursor()
|
||||
cls._get_cache.clear()
|
||||
|
||||
if price_lists is None and products is None:
|
||||
cursor.execute(*cache.delete())
|
||||
elif price_lists and products is None:
|
||||
for sub_price_lists in grouped_slice(price_lists):
|
||||
cursor.execute(*cache.delete(where=reduce_ids(
|
||||
cache.price_list, [
|
||||
p.id for p in sub_price_lists])))
|
||||
elif price_lists is None and products:
|
||||
for sub_products in grouped_slice(products):
|
||||
cursor.execute(*cache.delete(where=reduce_ids(
|
||||
cache.product, [p.id for p in sub_products])))
|
||||
else:
|
||||
for sub_products in grouped_slice(products):
|
||||
for sub_price_lists in grouped_slice(price_lists):
|
||||
cursor.execute(*cache.delete(where=reduce_ids(
|
||||
cache.price_list, [
|
||||
p.id for p in sub_price_lists])
|
||||
& reduce_ids(
|
||||
cache.product, [p.id for p in sub_products])))
|
||||
|
||||
@classmethod
|
||||
def on_modification(cls, mode, records, field_names=None):
|
||||
super().on_modification(mode, records, field_names=field_names)
|
||||
cls._get_cache.clear()
|
||||
12
modules/product_price_list_cache/product.xml
Normal file
12
modules/product_price_list_cache/product.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data noupdate="1">
|
||||
<record model="ir.cron" id="cron_fill_cache">
|
||||
<field name="method">product.price_list|fill_cache</field>
|
||||
<field name="interval_number" eval="1"/>
|
||||
<field name="interval_type">days</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
2
modules/product_price_list_cache/tests/__init__.py
Normal file
2
modules/product_price_list_cache/tests/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
Binary file not shown.
Binary file not shown.
131
modules/product_price_list_cache/tests/test_module.py
Normal file
131
modules/product_price_list_cache/tests/test_module.py
Normal file
@@ -0,0 +1,131 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
|
||||
from decimal import Decimal
|
||||
from unittest.mock import patch
|
||||
|
||||
from trytond.modules.company.tests import create_company, set_company
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class ProductPriceListCacheTestCase(ModuleTestCase):
|
||||
"Test Product Price List Cache module"
|
||||
module = 'product_price_list_cache'
|
||||
|
||||
@with_transaction()
|
||||
def test_price_list_cache(self):
|
||||
"Test caching price list"
|
||||
pool = Pool()
|
||||
Cache = pool.get('product.price_list.cache')
|
||||
PriceList = pool.get('product.price_list')
|
||||
Product = pool.get('product.product')
|
||||
Template = pool.get('product.template')
|
||||
Uom = pool.get('product.uom')
|
||||
|
||||
company = create_company()
|
||||
with set_company(company):
|
||||
kilogram, = Uom.search([
|
||||
('name', '=', 'Kilogram'),
|
||||
])
|
||||
gram, = Uom.search([
|
||||
('name', '=', 'Gram'),
|
||||
])
|
||||
|
||||
template = Template(
|
||||
name='Test Lot Sequence',
|
||||
list_price=Decimal(10),
|
||||
default_uom=kilogram,
|
||||
)
|
||||
template.save()
|
||||
product = Product(template=template)
|
||||
product.save()
|
||||
|
||||
price_list, = PriceList.create([{
|
||||
'name': "Price List",
|
||||
'price': 'list_price',
|
||||
'lines': [('create', [{
|
||||
'quantity': 10.0,
|
||||
'formula': 'unit_price * 0.9',
|
||||
}, {
|
||||
'quantity': 5,
|
||||
'formula': 'unit_price',
|
||||
}, {
|
||||
'formula': 'unit_price',
|
||||
}])],
|
||||
}])
|
||||
|
||||
# Test filling cache
|
||||
price_list.fill_cache()
|
||||
self.assertEqual(Cache.search([], count=True), 1)
|
||||
|
||||
price_list.fill_cache(products=[product])
|
||||
self.assertEqual(Cache.search([], count=True), 1)
|
||||
|
||||
PriceList.fill_cache(products=[product])
|
||||
self.assertEqual(Cache.search([], count=True), 1)
|
||||
|
||||
PriceList.fill_cache()
|
||||
self.assertEqual(Cache.search([], count=True), 1)
|
||||
|
||||
cache, = Cache.search([])
|
||||
self.assertEqual(cache.price_list, price_list)
|
||||
self.assertEqual(cache.product, product)
|
||||
self.assertEqual(cache.uom, kilogram)
|
||||
self.assertEqual(
|
||||
cache.unit_prices, [[0, Decimal(10)], [10, Decimal(9)]])
|
||||
self.assertEqual(cache.pattern, None)
|
||||
|
||||
# Test cached compute
|
||||
with patch.object(
|
||||
Cache, 'get',
|
||||
side_effect=Cache.get) as get, \
|
||||
patch.object(
|
||||
Cache, 'get_unit_price',
|
||||
autospec=True,
|
||||
side_effect=Cache.get_unit_price) as get_unit_price:
|
||||
self.assertEqual(
|
||||
price_list.compute(product, 1, kilogram),
|
||||
Decimal(10))
|
||||
get.assert_called_once()
|
||||
get_unit_price.assert_called_once()
|
||||
|
||||
get_unit_price.return_value = None
|
||||
get_unit_price.reset_mock()
|
||||
self.assertEqual(
|
||||
price_list.compute(product, 1, kilogram),
|
||||
Decimal(10))
|
||||
get_unit_price.assert_called_once()
|
||||
|
||||
get.return_value = None
|
||||
get.side_effect = None
|
||||
get.reset_mock()
|
||||
get_unit_price.reset_mock()
|
||||
self.assertEqual(
|
||||
price_list.compute(product, 1, kilogram),
|
||||
Decimal(10))
|
||||
get.assert_called_once()
|
||||
get_unit_price.assert_not_called()
|
||||
|
||||
# test get
|
||||
self.assertEqual(Cache.get(price_list, product), cache)
|
||||
self.assertEqual(
|
||||
Cache.get(price_list, product, pattern={'foo': 'bar'}), None)
|
||||
|
||||
# Test get_unit_price
|
||||
for quantity, uom, result in [
|
||||
(1, kilogram, Decimal(10)),
|
||||
(1_000, gram, Decimal(10)),
|
||||
(2, kilogram, Decimal(10)),
|
||||
(2_000, gram, Decimal(10)),
|
||||
(10, kilogram, Decimal(9)),
|
||||
(10_000, gram, Decimal(9)),
|
||||
(11, kilogram, Decimal(9)),
|
||||
(11_000, gram, Decimal(9)),
|
||||
]:
|
||||
with self.subTest(quantity=quantity, uom=uom.rec_name):
|
||||
self.assertEqual(
|
||||
cache.get_unit_price(quantity, uom), result)
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
15
modules/product_price_list_cache/tryton.cfg
Normal file
15
modules/product_price_list_cache/tryton.cfg
Normal file
@@ -0,0 +1,15 @@
|
||||
[tryton]
|
||||
version=7.8.0
|
||||
depends:
|
||||
ir
|
||||
product
|
||||
product_price_list
|
||||
xml:
|
||||
product.xml
|
||||
|
||||
[register]
|
||||
model:
|
||||
ir.Cron
|
||||
product.Product
|
||||
product.PriceList
|
||||
product.PriceListCache
|
||||
Reference in New Issue
Block a user