IO-1673 Posting bills to removed lines for credit memos.

This commit is contained in:
Patrick Fic
2022-01-27 08:37:26 -08:00
parent 25fd90f881
commit 9b444a130b
2 changed files with 51 additions and 35 deletions

View File

@@ -59,10 +59,19 @@ export function BillEnterModalLinesComponent({
}; };
}, },
formInput: (record, index) => ( formInput: (record, index) => (
<Form.Item
noStyle
shouldUpdate={(prev, cur) =>
prev.is_credit_memo !== cur.is_credit_memo
}
>
{() => {
return (
<BillLineSearchSelect <BillLineSearchSelect
disabled={disabled} disabled={disabled}
options={lineData} options={lineData}
style={{ width: "100%", minWidth: "10rem" }} style={{ width: "100%", minWidth: "10rem" }}
allowRemoved={form.getFieldValue("is_credit_memo") || false}
onSelect={(value, opt) => { onSelect={(value, opt) => {
setFieldsValue({ setFieldsValue({
billlines: getFieldsValue(["billlines"]).billlines.map( billlines: getFieldsValue(["billlines"]).billlines.map(
@@ -74,7 +83,8 @@ export function BillEnterModalLinesComponent({
quantity: opt.part_qty || 1, quantity: opt.part_qty || 1,
actual_price: opt.cost, actual_price: opt.cost,
cost_center: opt.part_type cost_center: opt.part_type
? bodyshop.pbs_serialnumber || bodyshop.cdk_dealerid ? bodyshop.pbs_serialnumber ||
bodyshop.cdk_dealerid
? opt.part_type !== "PAE" ? opt.part_type !== "PAE"
? opt.part_type ? opt.part_type
: null : null
@@ -92,6 +102,9 @@ export function BillEnterModalLinesComponent({
}); });
}} }}
/> />
);
}}
</Form.Item>
), ),
}, },
{ {

View File

@@ -4,9 +4,12 @@ import { useTranslation } from "react-i18next";
//To be used as a form element only. //To be used as a form element only.
const { Option } = Select; const { Option } = Select;
const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => { const BillLineSearchSelect = (
{ options, disabled, allowRemoved, ...restProps },
ref
) => {
const { t } = useTranslation(); const { t } = useTranslation();
console.log(allowRemoved);
return ( return (
<Select <Select
disabled={disabled} disabled={disabled}
@@ -36,7 +39,7 @@ const BillLineSearchSelect = ({ options, disabled, ...restProps }, ref) => {
{options {options
? options.map((item) => ( ? options.map((item) => (
<Option <Option
disabled={item.removed} disabled={allowRemoved ? false : item.removed}
key={item.id} key={item.id}
value={item.id} value={item.id}
cost={item.act_price ? item.act_price : 0} cost={item.act_price ? item.act_price : 0}