2
0
mirror of https://github.com/frappe/books.git synced 2024-09-19 19:19:02 +00:00

make place of supply and gst into seperate entries

This commit is contained in:
Ankit Singhaniya 2021-12-29 09:54:57 +05:30
parent 99dfc93129
commit 21dace3e03
4 changed files with 16 additions and 31 deletions

View File

@ -182,7 +182,6 @@ async function generateB2clData(invoices) {
const b2cl = [];
for (let invoice of invoices) {
const stateInvoiceRecord = {
pos: stateCodeMap[invoice.place.toUpperCase()],
inv: []

View File

@ -7,6 +7,7 @@ export default {
'addressLine1',
'addressLine2',
'city',
'state',
'country',
'postalCode'
],
@ -31,6 +32,12 @@ export default {
fieldtype: 'Data',
required: 1
},
{
fieldname: 'state',
label: 'State',
placeholder: 'State',
fieldtype: 'Data',
},
{
fieldname: 'country',
label: 'Country',
@ -84,6 +91,7 @@ export default {
'addressLine1',
'addressLine2',
'city',
'state',
'country',
'postalCode'
],

View File

@ -8,44 +8,22 @@ export default function getAugmentedAddress({ country }) {
return Address;
}
const cityFieldIndex = Address.fields.findIndex(
(i) => i.fieldname === 'city'
);
if (country === 'India') {
Address.fields = [
...Address.fields.slice(0, cityFieldIndex + 1),
...Address.fields,
{
fieldname: 'state',
label: 'State / UT',
fieldname: 'pos',
label: 'Place of Supply',
fieldtype: 'Select',
placeholder: 'State / UT',
placeholder: 'Place of Supply',
options: Object.keys(stateCodeMap).map((key) => capitalize(key)),
},
...Address.fields.slice(cityFieldIndex + 1, Address.fields.length),
];
// Setting country as India for customers as default for SMBs in India
Address.fields.forEach((field) => {
if (field.fieldname === 'country') {
field.default = 'India';
}
});
} else {
Address.fields = [
...Address.fields.slice(0, cityFieldIndex + 1),
{
fieldname: 'state',
label: 'State',
placeholder: 'State',
fieldtype: 'Data',
},
...Address.fields.slice(cityFieldIndex + 1, Address.fields.length),
];
}
Address.quickEditFields = [
...Address.quickEditFields.slice(0, cityFieldIndex + 1),
'state',
...Address.quickEditFields.slice(cityFieldIndex + 1, Address.fields.length),
...Address.quickEditFields,
'pos',
];
return Address;

View File

@ -41,14 +41,14 @@ class BaseGSTR {
);
if (party.address) {
let addressDetails = await frappe.getDoc('Address', party.address);
row.place = addressDetails.state || '';
row.place = addressDetails.pos || '';
}
row.gstin = party.gstin;
row.partyName = ledgerEntry.customer || ledgerEntry.supplier;
row.invNo = ledgerEntry.name;
row.invDate = ledgerEntry.date;
row.rate = 0;
row.inState = gstin.substring(0, 2) === stateCodeMap[row.place];
row.inState = gstin && gstin.substring(0, 2) === stateCodeMap[row.place];
row.reverseCharge = !party.gstin ? 'Y' : 'N';
ledgerEntry.taxes?.forEach(tax => {
row.rate += tax.rate;