mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-15 03:23:07 +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:
|
except ValueError:
|
||||||
pass
|
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)
|
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
|
```html
|
||||||
{% raw %}
|
{% raw %}
|
||||||
|
{% load l10n %}
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@page {
|
@page {
|
||||||
@ -133,6 +134,9 @@ So, if you are writing a template which has custom formatting, (or any other sec
|
|||||||
!!! tip "Close it out"
|
!!! tip "Close it out"
|
||||||
Don't forget to end with a `{% raw %}{% endlocalize %}{% endraw %}` tag!
|
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
|
### Extending with Plugins
|
||||||
|
|
||||||
The [ReportMixin plugin class](../extend/plugins/report.md) allows reporting functionality to be extended with custom features.
|
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;
|
renderContent: (id?: string) => React.ReactNode;
|
||||||
urlPrefix?: string;
|
urlPrefix?: string;
|
||||||
size?: MantineNumberSize;
|
size?: MantineNumberSize;
|
||||||
|
closeOnEscape?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const useStyles = createStyles(() => ({
|
const useStyles = createStyles(() => ({
|
||||||
@ -40,6 +41,7 @@ function DetailDrawerComponent({
|
|||||||
title,
|
title,
|
||||||
position = 'right',
|
position = 'right',
|
||||||
size,
|
size,
|
||||||
|
closeOnEscape = true,
|
||||||
renderContent
|
renderContent
|
||||||
}: DrawerProps) {
|
}: DrawerProps) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -62,6 +64,7 @@ function DetailDrawerComponent({
|
|||||||
addDetailDrawer(false);
|
addDetailDrawer(false);
|
||||||
}}
|
}}
|
||||||
position={position}
|
position={position}
|
||||||
|
closeOnEscape={closeOnEscape}
|
||||||
size={size}
|
size={size}
|
||||||
classNames={{ root: classes.flex, body: classes.flex }}
|
classNames={{ root: classes.flex, body: classes.flex }}
|
||||||
scrollAreaComponent={Stack}
|
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 { ModelType } from '../../enums/ModelType';
|
||||||
import { Thumbnail } from '../images/Thumbnail';
|
import { Thumbnail } from '../images/Thumbnail';
|
||||||
import { RenderBuildOrder } from './Build';
|
import { RenderBuildLine, RenderBuildOrder } from './Build';
|
||||||
import {
|
import {
|
||||||
RenderAddress,
|
RenderAddress,
|
||||||
RenderCompany,
|
RenderCompany,
|
||||||
@ -42,6 +42,7 @@ const RendererLookup: EnumDictionary<
|
|||||||
> = {
|
> = {
|
||||||
[ModelType.address]: RenderAddress,
|
[ModelType.address]: RenderAddress,
|
||||||
[ModelType.build]: RenderBuildOrder,
|
[ModelType.build]: RenderBuildOrder,
|
||||||
|
[ModelType.buildline]: RenderBuildLine,
|
||||||
[ModelType.company]: RenderCompany,
|
[ModelType.company]: RenderCompany,
|
||||||
[ModelType.contact]: RenderContact,
|
[ModelType.contact]: RenderContact,
|
||||||
[ModelType.manufacturerpart]: RenderManufacturerPart,
|
[ModelType.manufacturerpart]: RenderManufacturerPart,
|
||||||
|
@ -92,6 +92,14 @@ export const ModelInformationDict: ModelDict = {
|
|||||||
cui_detail: '/build/:pk/',
|
cui_detail: '/build/:pk/',
|
||||||
api_endpoint: ApiEndpoints.build_order_list
|
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: {
|
company: {
|
||||||
label: t`Company`,
|
label: t`Company`,
|
||||||
label_multiple: t`Companies`,
|
label_multiple: t`Companies`,
|
||||||
|
@ -13,6 +13,7 @@ export enum ModelType {
|
|||||||
stocklocation = 'stocklocation',
|
stocklocation = 'stocklocation',
|
||||||
stockhistory = 'stockhistory',
|
stockhistory = 'stockhistory',
|
||||||
build = 'build',
|
build = 'build',
|
||||||
|
buildline = 'buildline',
|
||||||
company = 'company',
|
company = 'company',
|
||||||
purchaseorder = 'purchaseorder',
|
purchaseorder = 'purchaseorder',
|
||||||
purchaseorderline = 'purchaseorderline',
|
purchaseorderline = 'purchaseorderline',
|
||||||
|
@ -64,7 +64,7 @@ export default function TemplateManagementPanel() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t`Stock item`,
|
name: t`Stock Item`,
|
||||||
key: 'stock',
|
key: 'stock',
|
||||||
icon: 'stock',
|
icon: 'stock',
|
||||||
preview: {
|
preview: {
|
||||||
@ -73,12 +73,12 @@ export default function TemplateManagementPanel() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t`Build line`,
|
name: t`Build Line`,
|
||||||
key: 'buildline',
|
key: 'buildline',
|
||||||
icon: 'builds',
|
icon: 'builds',
|
||||||
preview: {
|
preview: {
|
||||||
itemKey: 'line',
|
itemKey: 'line',
|
||||||
model: ModelType.build
|
model: ModelType.buildline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -96,7 +96,7 @@ export default function TemplateManagementPanel() {
|
|||||||
defaultTemplate: defaultReportTemplate,
|
defaultTemplate: defaultReportTemplate,
|
||||||
variants: [
|
variants: [
|
||||||
{
|
{
|
||||||
name: t`Purchase order`,
|
name: t`Purchase Order`,
|
||||||
key: 'po',
|
key: 'po',
|
||||||
icon: 'purchase_orders',
|
icon: 'purchase_orders',
|
||||||
preview: {
|
preview: {
|
||||||
@ -105,7 +105,7 @@ export default function TemplateManagementPanel() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t`Sales order`,
|
name: t`Sales Order`,
|
||||||
key: 'so',
|
key: 'so',
|
||||||
icon: 'sales_orders',
|
icon: 'sales_orders',
|
||||||
preview: {
|
preview: {
|
||||||
@ -114,7 +114,7 @@ export default function TemplateManagementPanel() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t`Return order`,
|
name: t`Return Order`,
|
||||||
key: 'ro',
|
key: 'ro',
|
||||||
icon: 'return_orders',
|
icon: 'return_orders',
|
||||||
preview: {
|
preview: {
|
||||||
@ -151,7 +151,7 @@ export default function TemplateManagementPanel() {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: t`Stock location`,
|
name: t`Stock Location`,
|
||||||
key: 'slr',
|
key: 'slr',
|
||||||
icon: 'default_location',
|
icon: 'default_location',
|
||||||
preview: {
|
preview: {
|
||||||
|
@ -286,6 +286,7 @@ export function TemplateTable({
|
|||||||
<DetailDrawer
|
<DetailDrawer
|
||||||
title={t`Edit` + ' ' + templateTypeTranslation}
|
title={t`Edit` + ' ' + templateTypeTranslation}
|
||||||
size={'90%'}
|
size={'90%'}
|
||||||
|
closeOnEscape={false}
|
||||||
renderContent={(id) => {
|
renderContent={(id) => {
|
||||||
return (
|
return (
|
||||||
<TemplateDrawer
|
<TemplateDrawer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user