inventree / InvenTree

Open Source Inventory Management System
https://docs.inventree.org
MIT License
4.3k stars 777 forks source link

Base cost unused? #5099

Closed LavissaWoW closed 1 year ago

LavissaWoW commented 1 year ago

Please verify that this bug has NOT been raised before.

Describe the bug*

Part and SupplierPart models have a field called "base_cost". This has some translations, and in the process of looking these up, I couldn't find it used at all.

To me, it seems that the field base_cost has been all but orphaned at this point.

It appears to me that base_cost exists purely in import wizards, model code and database, but is actually never used

Steps to Reproduce

/InvenTree$ grep -irn base_cost
grep: data/pgdb: Permission denied
docs/docs/report/context_variables.md:193:| base_cost | Base charge added to order independent of quantity e.g. "Reeling Fee" |
InvenTree/common/models.py:2192:    - Don't forget to add in flat-fee cost (base_cost field)
InvenTree/common/models.py:2254:        return InvenTree.helpers.normalize(cost + instance.base_cost)
Binary file InvenTree/common/__pycache__/models.cpython-39.pyc matches
InvenTree/company/migrations/0001_initial.py:55:                ('base_cost', models.DecimalField(decimal_places=3, default=0, help_text='Minimum charge (e.g. stocking fee)', max_digits=10, validators=[django.core.validators.MinValueValidator(0)])),
InvenTree/company/migrations/0032_auto_20210403_1837.py:50:            name='base_cost',
Binary file InvenTree/company/migrations/__pycache__/0001_initial.cpython-39.pyc matches
Binary file InvenTree/company/migrations/__pycache__/0032_auto_20210403_1837.cpython-39.pyc matches
InvenTree/company/models.py:586:        base_cost: Base charge added to order independent of quantity e.g. "Reeling Fee"
InvenTree/company/models.py:749:    base_cost = models.DecimalField(max_digits=10, decimal_places=3, default=0, validators=[MinValueValidator(0)], verbose_name=_('base cost'), help_text=_('Minimum charge (e.g. stocking fee)'))
Binary file InvenTree/company/__pycache__/models.cpython-39.pyc matches
InvenTree/part/migrations/0065_auto_20210505_2144.py:16:            name='base_cost',
InvenTree/part/migrations/0089_auto_20221112_0128.py:21:            name='base_cost',
Binary file InvenTree/part/migrations/__pycache__/0065_auto_20210505_2144.cpython-39.pyc matches
Binary file InvenTree/part/migrations/__pycache__/0089_auto_20221112_0128.cpython-39.pyc matches
InvenTree/part/models.py:1924:    base_cost = models.DecimalField(max_digits=19, decimal_places=6, default=0, validators=[MinValueValidator(0)], verbose_name=_('base cost'), help_text=_('Minimum charge (e.g. stocking fee)'))
InvenTree/part/views.py:88:            'base_cost',
InvenTree/part/views.py:129:        'base_cost': 'base_cost',
InvenTree/part/views.py:224:                base_cost=str2int(part_data.get('base_cost'), 0),
Binary file InvenTree/part/__pycache__/models.cpython-39.pyc matches
Binary file InvenTree/part/__pycache__/views.cpython-39.pyc matches

Expected behaviour

Keep, use, delete?

Deployment Method

Version Information

Version Information:

InvenTree-Version: 0.12.0 dev Django Version: 3.2.19 Commit Hash: 24b554a Commit Date: 2023-06-24 Commit Branch: tl-contexts Database: postgresql Debug-Mode: True Deployed using Docker: True Platform: Linux-5.10.16.3-microsoft-standard-WSL2-x86_64-with-glibc2.31 Installer: DOC

Active plugins: [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.0.0'}, {'name': 'InvenTreeCoreNotificationsPlugin', 'slug': 'inventreecorenotificationsplugin', 'version': '1.0.0'}]

Please verify if you can reproduce this bug on the demo site.

Relevant log output

No response

SchrodingersGat commented 1 year ago

@LavissaWoW correct, it is not actually used anywhere. Looking into it, it is discussed in the documentation, but is not actually included in any calculations.

We can either:

matmair commented 1 year ago

IMO implementing it would be great. Far easier to remove it though. No strong feelings either way.

SchrodingersGat commented 1 year ago

@LavissaWoW do you have any strong attachment to this being implemented? Or happy for it to be removed

LavissaWoW commented 1 year ago

@SchrodingersGat No attachment at all, really. Removal works for me.

github-actions[bot] commented 1 year ago

This issue seems stale. Please react to show this is still important.