first commit
This commit is contained in:
2
modules/product_price_list_parent/__init__.py
Normal file
2
modules/product_price_list_parent/__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.
13
modules/product_price_list_parent/locale/bg.po
Normal file
13
modules/product_price_list_parent/locale/bg.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/ca.po
Normal file
15
modules/product_price_list_parent/locale/ca.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Pare"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: el preu unitari del pare"
|
||||
13
modules/product_price_list_parent/locale/cs.po
Normal file
13
modules/product_price_list_parent/locale/cs.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/de.po
Normal file
15
modules/product_price_list_parent/locale/de.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Übergeordnet (Preiskonditionsschema)"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: Der Einzelpreis des übergeordneten Preiskonditionsschemas"
|
||||
15
modules/product_price_list_parent/locale/es.po
Normal file
15
modules/product_price_list_parent/locale/es.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Padre"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: precio unitario del padre"
|
||||
13
modules/product_price_list_parent/locale/es_419.po
Normal file
13
modules/product_price_list_parent/locale/es_419.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/et.po
Normal file
15
modules/product_price_list_parent/locale/et.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Ülem"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- ülem_ühiku_hind: ühiku_hind ülemalt"
|
||||
13
modules/product_price_list_parent/locale/fa.po
Normal file
13
modules/product_price_list_parent/locale/fa.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "مرجع"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/fi.po
Normal file
13
modules/product_price_list_parent/locale/fi.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/fr.po
Normal file
15
modules/product_price_list_parent/locale/fr.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Parent"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price : le prix unitaire du parent"
|
||||
15
modules/product_price_list_parent/locale/hu.po
Normal file
15
modules/product_price_list_parent/locale/hu.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Fölérendelt"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: a fölérendelt árlista egységára"
|
||||
13
modules/product_price_list_parent/locale/id.po
Normal file
13
modules/product_price_list_parent/locale/id.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Induk"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/it.po
Normal file
15
modules/product_price_list_parent/locale/it.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Padre"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: il prezzo unitario dal padre"
|
||||
13
modules/product_price_list_parent/locale/lo.po
Normal file
13
modules/product_price_list_parent/locale/lo.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/lt.po
Normal file
13
modules/product_price_list_parent/locale/lt.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/nl.po
Normal file
15
modules/product_price_list_parent/locale/nl.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Bovenliggend niveau"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: de eenheidsprijs van het bovenliggend niveau"
|
||||
13
modules/product_price_list_parent/locale/pl.po
Normal file
13
modules/product_price_list_parent/locale/pl.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
15
modules/product_price_list_parent/locale/pt.po
Normal file
15
modules/product_price_list_parent/locale/pt.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Pai"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: o preço unitário do pai"
|
||||
15
modules/product_price_list_parent/locale/ro.po
Normal file
15
modules/product_price_list_parent/locale/ro.po
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr "Parinte"
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
"\n"
|
||||
"- parent_unit_price: unit_price de la părinte"
|
||||
13
modules/product_price_list_parent/locale/ru.po
Normal file
13
modules/product_price_list_parent/locale/ru.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/sl.po
Normal file
13
modules/product_price_list_parent/locale/sl.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/tr.po
Normal file
13
modules/product_price_list_parent/locale/tr.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/uk.po
Normal file
13
modules/product_price_list_parent/locale/uk.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
13
modules/product_price_list_parent/locale/zh_CN.po
Normal file
13
modules/product_price_list_parent/locale/zh_CN.po
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "field:product.price_list,parent:"
|
||||
msgid "Parent"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "help:product.price_list.line,formula:"
|
||||
msgid ""
|
||||
"\n"
|
||||
"- parent_unit_price: the unit_price from the parent"
|
||||
msgstr ""
|
||||
33
modules/product_price_list_parent/product.py
Normal file
33
modules/product_price_list_parent/product.py
Normal file
@@ -0,0 +1,33 @@
|
||||
# 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.model import fields, tree
|
||||
from trytond.modules.product_price_list.price_list import Null
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
|
||||
class PriceList(tree(), metaclass=PoolMeta):
|
||||
__name__ = 'product.price_list'
|
||||
|
||||
parent = fields.Many2One('product.price_list', "Parent")
|
||||
|
||||
def get_context_formula(self, product, quantity, uom, pattern=None):
|
||||
context = super().get_context_formula(
|
||||
product, quantity, uom, pattern=pattern)
|
||||
if self.parent:
|
||||
parent_unit_price = self.parent.compute(
|
||||
product, quantity, uom, pattern=pattern)
|
||||
if parent_unit_price is None:
|
||||
parent_unit_price = Null()
|
||||
context['names']['parent_unit_price'] = parent_unit_price
|
||||
return context
|
||||
|
||||
|
||||
class PriceListLine(metaclass=PoolMeta):
|
||||
__name__ = 'product.price_list.line'
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super().__setup__()
|
||||
cls.formula.help += (
|
||||
'\n- parent_unit_price: the unit_price from the parent')
|
||||
12
modules/product_price_list_parent/product.xml
Normal file
12
modules/product_price_list_parent/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>
|
||||
<record model="ir.ui.view" id="product_price_list_view_form">
|
||||
<field name="model">product.price_list</field>
|
||||
<field name="inherit" ref="product_price_list.price_list_view_form"/>
|
||||
<field name="name">product_price_list_form</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
2
modules/product_price_list_parent/tests/__init__.py
Normal file
2
modules/product_price_list_parent/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.
64
modules/product_price_list_parent/tests/test_module.py
Normal file
64
modules/product_price_list_parent/tests/test_module.py
Normal file
@@ -0,0 +1,64 @@
|
||||
# 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 trytond.modules.company.tests import (
|
||||
CompanyTestMixin, create_company, set_company)
|
||||
from trytond.pool import Pool
|
||||
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
|
||||
|
||||
|
||||
class ProductPriceListParentTestCase(CompanyTestMixin, ModuleTestCase):
|
||||
'Test Product Price List Parent module'
|
||||
module = 'product_price_list_parent'
|
||||
|
||||
@with_transaction()
|
||||
def test_price_list_parent(self):
|
||||
"Test price list with parent"
|
||||
pool = Pool()
|
||||
Template = pool.get('product.template')
|
||||
Product = pool.get('product.product')
|
||||
Uom = pool.get('product.uom')
|
||||
PriceList = pool.get('product.price_list')
|
||||
|
||||
company = create_company()
|
||||
with set_company(company):
|
||||
unit, = Uom.search([('name', '=', "Unit")])
|
||||
|
||||
template = Template(
|
||||
name="Template", list_price=Decimal(10), default_uom=unit)
|
||||
template.save()
|
||||
product = Product(template=template)
|
||||
product.save()
|
||||
|
||||
price_list_parent, = PriceList.create([{
|
||||
'name': "Parent",
|
||||
'price': 'list_price',
|
||||
'lines': [('create', [{
|
||||
'formula': 'unit_price * 2',
|
||||
}])],
|
||||
}])
|
||||
price_list, = PriceList.create([{
|
||||
'name': "List",
|
||||
'parent': price_list_parent.id,
|
||||
'lines': [('create', [{
|
||||
'formula': 'parent_unit_price * 2',
|
||||
}])],
|
||||
}])
|
||||
|
||||
self.assertEqual(
|
||||
price_list.compute(product, 1, unit), Decimal('40'))
|
||||
|
||||
@with_transaction()
|
||||
def test_line_formula_help(self):
|
||||
"Test help of line formula"
|
||||
pool = Pool()
|
||||
PriceListLine = pool.get('product.price_list.line')
|
||||
|
||||
fields = PriceListLine.fields_get(['formula'])
|
||||
|
||||
self.assertIn('parent_unit_price', fields['formula']['help'])
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
12
modules/product_price_list_parent/tryton.cfg
Normal file
12
modules/product_price_list_parent/tryton.cfg
Normal file
@@ -0,0 +1,12 @@
|
||||
[tryton]
|
||||
version=7.8.0
|
||||
depends:
|
||||
ir
|
||||
product_price_list
|
||||
xml:
|
||||
product.xml
|
||||
|
||||
[register]
|
||||
model:
|
||||
product.PriceList
|
||||
product.PriceListLine
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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. -->
|
||||
<data>
|
||||
<xpath expr="//field[@name='company']" position="after">
|
||||
<label name="parent"/>
|
||||
<field name="parent"/>
|
||||
</xpath>
|
||||
</data>
|
||||
Reference in New Issue
Block a user