From b2c468647ea91f2c448afa62d2adfb7d0c52170a Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Sun, 24 Oct 2021 16:21:06 +0200 Subject: [PATCH] Deprecate stock_external_party. --- plan.xml | 17 -- setup.py | 10 +- ...enario_product_cost_plan_extras_depend.rst | 262 ------------------ tests/test_product_cost_plan.py | 5 - tryton.cfg | 3 - ..._plan_product_line_form_external_party.xml | 10 - ..._plan_product_line_tree_external_party.xml | 8 - 7 files changed, 1 insertion(+), 314 deletions(-) delete mode 100644 tests/scenario_product_cost_plan_extras_depend.rst delete mode 100644 view/cost_plan_product_line_form_external_party.xml delete mode 100644 view/cost_plan_product_line_tree_external_party.xml diff --git a/plan.xml b/plan.xml index 3b94f59..256195c 100644 --- a/plan.xml +++ b/plan.xml @@ -348,21 +348,4 @@ products_cost - - - product.cost.plan.product_line - - cost_plan_product_line_form_external_party - - - - product.cost.plan.product_line - - cost_plan_product_line_tree_external_party - - diff --git a/setup.py b/setup.py index bf647f1..98622c3 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,6 @@ from configparser import ConfigParser MODULE = 'product_cost_plan' PREFIX = 'nantic' MODULE2PREFIX = { - 'production_external_party': 'nantic', } @@ -42,7 +41,7 @@ major_version = int(major_version) minor_version = int(minor_version) requires = [] -for dep in info.get('depends', []) + ['production_external_party']: +for dep in info.get('depends', []): if not re.match(r'(ir|res)(\W|$)', dep): prefix = MODULE2PREFIX.get(dep, 'trytond') requires.append(get_require_version('%s_%s' % (prefix, dep))) @@ -50,7 +49,6 @@ requires.append(get_require_version('trytond')) tests_require = [ get_require_version('proteus'), - get_require_version('nantic-production_external_party') ] series = '%s.%s' % (major_version, minor_version) @@ -60,12 +58,6 @@ else: branch = series dependency_links = [ - ('hg+https://bitbucket.org/nantic/' - 'trytond-production_external_party@%(branch)s' - '#egg=nantic-production_external_party-%(series)s' % { - 'branch': branch, - 'series': series, - }), ] if minor_version % 2: diff --git a/tests/scenario_product_cost_plan_extras_depend.rst b/tests/scenario_product_cost_plan_extras_depend.rst deleted file mode 100644 index 7fc1a31..0000000 --- a/tests/scenario_product_cost_plan_extras_depend.rst +++ /dev/null @@ -1,262 +0,0 @@ -======================================== -Product Cost Plan Extras Depend Scenario -======================================== - -============= -General Setup -============= - -Imports:: - - >>> import datetime - >>> from dateutil.relativedelta import relativedelta - >>> from decimal import Decimal - >>> from proteus import config, Model, Wizard - >>> from trytond.tests.tools import activate_modules - >>> today = datetime.date.today() - >>> from trytond.modules.company.tests.tools import create_company, \ - ... get_company - >>> today = datetime.date.today() - - -Install product_cost_plan Module:: - - >>> config = activate_modules(['product_cost_plan', 'production_external_party']) - -Create company:: - - >>> _ = create_company() - >>> company = get_company() - >>> tax_identifier = company.party.identifiers.new() - >>> tax_identifier.type = 'eu_vat' - >>> tax_identifier.code = 'BE0897290877' - >>> company.party.save() - -Reload the context:: - - >>> User = Model.get('res.user') - >>> config._context = User.get_preferences(True, config.context) - -Create product:: - - >>> ProductUom = Model.get('product.uom') - >>> unit, = ProductUom.find([('name', '=', 'Unit')]) - >>> ProductTemplate = Model.get('product.template') - >>> template = ProductTemplate() - >>> template.name = 'product' - >>> template.default_uom = unit - >>> template.type = 'goods' - >>> template.list_price = Decimal(30) - >>> template.producible = True - >>> template.save() - >>> product, = template.products - >>> product.cost_price = Decimal(20) - >>> product.save() - - >>> template = ProductTemplate() - >>> template.name = 'product 2' - >>> template.default_uom = unit - >>> template.type = 'goods' - >>> template.list_price = Decimal(30) - >>> template.producible = True - >>> template.save() - >>> product2, = template.products - - >>> template = ProductTemplate() - >>> template.name = 'product 3' - >>> template.default_uom = unit - >>> template.type = 'goods' - >>> template.list_price = Decimal(15) - >>> template.producible = True - >>> template.save() - >>> product3, = template.products - -Create Components:: - - >>> meter, = ProductUom.find([('name', '=', 'Meter')]) - >>> centimeter, = ProductUom.find([('name', '=', 'centimeter')]) - >>> template1 = ProductTemplate() - >>> template1.name = 'component 1' - >>> template1.default_uom = unit - >>> template1.type = 'goods' - >>> template1.list_price = Decimal(5) - >>> template1.may_belong_to_party = True - >>> template1.save() - >>> component1, = template1.products - >>> component1.cost_price = Decimal(2) - >>> component1.save() - - >>> template2 = ProductTemplate() - >>> template2.name = 'component 2' - >>> template2.default_uom = meter - >>> template2.type = 'goods' - >>> template2.list_price = Decimal(7) - >>> template2.save() - >>> component2, = template2.products - >>> component2.cost_price = Decimal(5) - >>> component2.save() - -Create Bill of Material with party stock for component 1:: - - >>> BOM = Model.get('production.bom') - >>> bom = BOM(name='product') - >>> input1 = bom.inputs.new() - >>> input1.product = component1 - >>> input1.party_stock - 1 - >>> input1.quantity = 5 - >>> input2 = bom.inputs.new() - >>> input2.product = component2 - >>> input2.quantity = 150 - >>> input2.uom = centimeter - >>> output = bom.outputs.new() - >>> output.product = product - >>> output.quantity = 1 - >>> bom.save() - - >>> ProductBom = Model.get('product.product-production.bom') - >>> product.boms.append(ProductBom(bom=bom)) - >>> product.save() - -Create a cost plan from BoM:: - - >>> CostPlan = Model.get('product.cost.plan') - >>> plan = CostPlan() - >>> plan.number = '1' - >>> plan.product = product - >>> plan.bom == bom - True - >>> plan.quantity = 1 - >>> plan.save() - >>> plan.click('compute') - >>> plan.reload() - >>> len(plan.products) - 2 - >>> sorted([(p.quantity, p.product.rec_name, bool(p.party_stock), p.cost_price) - ... for p in plan.products]) - [(5.0, 'component 1', True, Decimal('0.0000')), (150.0, 'component 2', False, Decimal('0.0500'))] - >>> cost, = plan.costs - >>> cost.rec_name == 'Raw materials' - True - >>> cost.cost - Decimal('7.5000') - >>> plan.cost_price - Decimal('7.5000') - -Duplicate cost plan and change plan's product:: - - >>> plan2_id, = CostPlan.copy([plan.id], config.context) - >>> plan2 = CostPlan(plan2_id) - >>> plan2.bom == None - True - >>> plan2.product = product2 - >>> plan2.save() - >>> len(plan2.products) - 2 - -Set party stock also for second component:: - - >>> for product_line in plan2.products: - ... if product_line.product == component2: - ... product_line.party_stock = True - >>> plan2.save() - >>> plan2.reload() - >>> sorted([(p.quantity, p.product.rec_name, bool(p.party_stock), p.cost_price) - ... for p in plan2.products]) - [(5.0, 'component 1', True, Decimal('0.0000')), (150.0, 'component 2', True, Decimal('0.0'))] - >>> plan2.cost_price == Decimal(0) - True - -Create BoM from cost plan:: - - >>> create_bom = Wizard('product.cost.plan.create_bom', [plan2]) - >>> create_bom.execute('bom') - >>> plan2.reload() - >>> product2.reload() - >>> product2.boms[0].bom == plan2.bom - True - >>> len(plan2.bom.inputs) - 2 - >>> sorted([(i.quantity, i.product.rec_name, bool(i.party_stock), i.uom.symbol) - ... for i in plan2.bom.inputs]) - [(5.0, 'component 1', True, 'u'), (150.0, 'component 2', True, 'cm')] - >>> len(plan2.bom.outputs) - 1 - >>> plan2.bom.outputs[0].product == product2 - True - >>> plan2.bom.outputs[0].uom == plan2.uom - True - >>> plan2.bom.outputs[0].quantity == plan2.quantity - True - -Create plan from scratch:: - - >>> plan3 = CostPlan() - >>> plan3.product = product3 - >>> plan3.uom.symbol - 'u' - >>> plan3.bom - >>> plan3.quantity = 2 - >>> plan3.click('compute') - >>> plan3.reload() - >>> len(plan3.products) - 0 - >>> len(plan3.costs) - 1 - >>> product_line = plan3.products_tree.new() - >>> product_line.product = component1 - >>> bool(product_line.party_stock) - True - >>> product_line.cost_price - Decimal('0.0') - >>> product_line.quantity = 14 - >>> product_line.uom.symbol - 'u' - >>> product_line2 = product_line.children.new() - >>> product_line2.plan = plan3 - >>> product_line2.product = component2 - >>> product_line2.cost_price - Decimal('5.0000') - >>> product_line2.quantity = 4 - >>> product_line2.uom.symbol - 'm' - >>> product_line2.uom = centimeter - >>> product_line2.cost_price - Decimal('0.0500') - >>> product_line2.cost_price = Decimal('0.0450') - >>> product_line2.uom.symbol - 'cm' - >>> plan3.save() - >>> product_line, = plan3.products_tree - >>> product_line2, = product_line.children - >>> product_line2.unit_cost - Decimal('1.2600') - >>> product_line2.total_cost - Decimal('2.5200') - >>> cost, = plan3.costs - >>> cost.rec_name == 'Raw materials' - True - >>> cost.cost - Decimal('1.2600') - >>> plan3.cost_price - Decimal('1.2600') - -Create BoM from Cost Plan:: - - >>> create_bom = Wizard('product.cost.plan.create_bom', [plan3]) - >>> create_bom.execute('bom') - >>> plan3.reload() - >>> product3.reload() - >>> plan3.bom == product3.boms[0].bom - True - >>> len(plan3.bom.inputs) - 2 - >>> sorted([(i.quantity, i.product.rec_name, bool(i.party_stock), i.uom.symbol) - ... for i in plan3.bom.inputs]) - [(14.0, 'component 1', True, 'u'), (56.0, 'component 2', False, 'cm')] - >>> len(plan3.bom.outputs) - 1 - >>> plan3.bom.outputs[0].product == product3 - True - >>> plan3.bom.outputs[0].quantity - 2.0 diff --git a/tests/test_product_cost_plan.py b/tests/test_product_cost_plan.py index 61640f5..1429985 100644 --- a/tests/test_product_cost_plan.py +++ b/tests/test_product_cost_plan.py @@ -22,9 +22,4 @@ def suite(): tearDown=doctest_teardown, encoding='utf-8', checker=doctest_checker, optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) - suite.addTests( - doctest.DocFileSuite('scenario_product_cost_plan_extras_depend.rst', - tearDown=doctest_teardown, encoding='utf-8', - checker=doctest_checker, - optionflags=doctest.REPORT_ONLY_FIRST_FAILURE)) return suite diff --git a/tryton.cfg b/tryton.cfg index 7cf623c..d9f1b01 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,10 +1,7 @@ [tryton] version=6.1.0 - depends: production -extras_depend: - production_external_party xml: plan.xml configuration.xml diff --git a/view/cost_plan_product_line_form_external_party.xml b/view/cost_plan_product_line_form_external_party.xml deleted file mode 100644 index 1367210..0000000 --- a/view/cost_plan_product_line_form_external_party.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/view/cost_plan_product_line_tree_external_party.xml b/view/cost_plan_product_line_tree_external_party.xml deleted file mode 100644 index 06b8a1c..0000000 --- a/view/cost_plan_product_line_tree_external_party.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - -