mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Reporting: Build line label fix (#6717)
* Fix "BuildLine" label in PUI - Point to "buildline" not "build" * Prevent escape closing template ediror * Update report docs * Fix for format_number - Prevent number from being represented as scientific notation
This commit is contained in:
parent
0196dd2f60
commit
57a1a81e9b
@ -410,7 +410,10 @@ def format_number(number, **kwargs):
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
value = str(number)
|
||||
# Re-encode, and normalize again
|
||||
value = Decimal(number).normalize()
|
||||
value = format(value, 'f')
|
||||
value = str(value)
|
||||
|
||||
leading = kwargs.get('leading', None)
|
||||
|
||||
|
@ -117,6 +117,7 @@ So, if you are writing a template which has custom formatting, (or any other sec
|
||||
|
||||
```html
|
||||
{% raw %}
|
||||
{% load l10n %}
|
||||
<head>
|
||||
<style>
|
||||
@page {
|
||||
@ -133,6 +134,9 @@ So, if you are writing a template which has custom formatting, (or any other sec
|
||||
!!! tip "Close it out"
|
||||
Don't forget to end with a `{% raw %}{% endlocalize %}{% endraw %}` tag!
|
||||
|
||||
!!! tip "l10n"
|
||||
You will need to add `{% raw %}{% load l10n %}{% endraw %}` to the top of your template file to use the `{% raw %}{% localize %}{% endraw %}` tag.
|
||||
|
||||
### Extending with Plugins
|
||||
|
||||
The [ReportMixin plugin class](../extend/plugins/report.md) allows reporting functionality to be extended with custom features.
|
||||
|
@ -27,6 +27,7 @@ export interface DrawerProps {
|
||||
renderContent: (id?: string) => React.ReactNode;
|
||||
urlPrefix?: string;
|
||||
size?: MantineNumberSize;
|
||||
closeOnEscape?: boolean;
|
||||
}
|
||||
|
||||
const useStyles = createStyles(() => ({
|
||||
@ -40,6 +41,7 @@ function DetailDrawerComponent({
|
||||
title,
|
||||
position = 'right',
|
||||
size,
|
||||
closeOnEscape = true,
|
||||
renderContent
|
||||
}: DrawerProps) {
|
||||
const navigate = useNavigate();
|
||||
@ -62,6 +64,7 @@ function DetailDrawerComponent({
|
||||
addDetailDrawer(false);
|
||||
}}
|
||||
position={position}
|
||||
closeOnEscape={closeOnEscape}
|
||||
size={size}
|
||||
classNames={{ root: classes.flex, body: classes.flex }}
|
||||
scrollAreaComponent={Stack}
|
||||
|
@ -20,3 +20,20 @@ export function RenderBuildOrder({ instance }: { instance: any }): ReactNode {
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Inline rendering of a single BuildLine instance
|
||||
*/
|
||||
export function RenderBuildLine({ instance }: { instance: any }): ReactNode {
|
||||
return (
|
||||
<RenderInlineModel
|
||||
primary={instance.part_detail.full_name}
|
||||
secondary={instance.quantity}
|
||||
suffix={StatusRenderer({
|
||||
status: instance.status,
|
||||
type: ModelType.build
|
||||
})}
|
||||
image={instance.part_detail.thumbnail || instance.part_detail.image}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { ReactNode } from 'react';
|
||||
|
||||
import { ModelType } from '../../enums/ModelType';
|
||||
import { Thumbnail } from '../images/Thumbnail';
|
||||
import { RenderBuildOrder } from './Build';
|
||||
import { RenderBuildLine, RenderBuildOrder } from './Build';
|
||||
import {
|
||||
RenderAddress,
|
||||
RenderCompany,
|
||||
@ -42,6 +42,7 @@ const RendererLookup: EnumDictionary<
|
||||
> = {
|
||||
[ModelType.address]: RenderAddress,
|
||||
[ModelType.build]: RenderBuildOrder,
|
||||
[ModelType.buildline]: RenderBuildLine,
|
||||
[ModelType.company]: RenderCompany,
|
||||
[ModelType.contact]: RenderContact,
|
||||
[ModelType.manufacturerpart]: RenderManufacturerPart,
|
||||
|
@ -92,6 +92,14 @@ export const ModelInformationDict: ModelDict = {
|
||||
cui_detail: '/build/:pk/',
|
||||
api_endpoint: ApiEndpoints.build_order_list
|
||||
},
|
||||
buildline: {
|
||||
label: t`Build Line`,
|
||||
label_multiple: t`Build Lines`,
|
||||
url_overview: '/build/line',
|
||||
url_detail: '/build/line/:pk/',
|
||||
cui_detail: '/build/line/:pk/',
|
||||
api_endpoint: ApiEndpoints.build_line_list
|
||||
},
|
||||
company: {
|
||||
label: t`Company`,
|
||||
label_multiple: t`Companies`,
|
||||
|
@ -13,6 +13,7 @@ export enum ModelType {
|
||||
stocklocation = 'stocklocation',
|
||||
stockhistory = 'stockhistory',
|
||||
build = 'build',
|
||||
buildline = 'buildline',
|
||||
company = 'company',
|
||||
purchaseorder = 'purchaseorder',
|
||||
purchaseorderline = 'purchaseorderline',
|
||||
|
@ -64,7 +64,7 @@ export default function TemplateManagementPanel() {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t`Stock item`,
|
||||
name: t`Stock Item`,
|
||||
key: 'stock',
|
||||
icon: 'stock',
|
||||
preview: {
|
||||
@ -73,12 +73,12 @@ export default function TemplateManagementPanel() {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t`Build line`,
|
||||
name: t`Build Line`,
|
||||
key: 'buildline',
|
||||
icon: 'builds',
|
||||
preview: {
|
||||
itemKey: 'line',
|
||||
model: ModelType.build
|
||||
model: ModelType.buildline
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -96,7 +96,7 @@ export default function TemplateManagementPanel() {
|
||||
defaultTemplate: defaultReportTemplate,
|
||||
variants: [
|
||||
{
|
||||
name: t`Purchase order`,
|
||||
name: t`Purchase Order`,
|
||||
key: 'po',
|
||||
icon: 'purchase_orders',
|
||||
preview: {
|
||||
@ -105,7 +105,7 @@ export default function TemplateManagementPanel() {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t`Sales order`,
|
||||
name: t`Sales Order`,
|
||||
key: 'so',
|
||||
icon: 'sales_orders',
|
||||
preview: {
|
||||
@ -114,7 +114,7 @@ export default function TemplateManagementPanel() {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t`Return order`,
|
||||
name: t`Return Order`,
|
||||
key: 'ro',
|
||||
icon: 'return_orders',
|
||||
preview: {
|
||||
@ -151,7 +151,7 @@ export default function TemplateManagementPanel() {
|
||||
}
|
||||
},
|
||||
{
|
||||
name: t`Stock location`,
|
||||
name: t`Stock Location`,
|
||||
key: 'slr',
|
||||
icon: 'default_location',
|
||||
preview: {
|
||||
|
@ -286,6 +286,7 @@ export function TemplateTable({
|
||||
<DetailDrawer
|
||||
title={t`Edit` + ' ' + templateTypeTranslation}
|
||||
size={'90%'}
|
||||
closeOnEscape={false}
|
||||
renderContent={(id) => {
|
||||
return (
|
||||
<TemplateDrawer
|
||||
|
Loading…
x
Reference in New Issue
Block a user