Error while inserting Journal Transactions - acumatica

I am trying to create a Journal Transaction of AR module from Shipment screen with new button, on this new button click, it should create Journal Transactions document with credit amount in one account and debit amount in one account, These two accounts are configured in shipment screen only. but am getting below error. I am passing Project and all the other mandatory field values from code.
Error: Inserting 'GL Transaction' record raised at least one error.
Please review the errors. Project is Required but was not specified. Account '40000' used in the GL Transaction is mapped to Project Account Group.

You need to either pass in the project from the shipment (if the journal transaction should hit the project) or pass in the default non project value.
for example if not setting the project from the shipment you can set your project field on the journal lines using the following:
myInTran.ProjectID = ProjectDefaultAttribute.NonProject();
If you are pulling the project from the shipment you need to set the journal tran lines for the ProjectID, TaskID, & CostCodeID fields.
Depending on the version of Acumatica you are using, you might not have CostCodeID. I think it was added in 2018R1.
If using the Non project value, the TaskID and CostCodeID are not required.

Related

Is it possible to link the opportunity and project with a different constituent in NetSuite?

i am not able to populate the system field "Prject" on opportunity record if the project and opportunity records have a different constituent
I have created the project from opportunity, but by some reason the opportunity has not been linked with the created project. I tried to connect them(populate the project field on opportunity) using a script but get the error: Invalid job reference key for the entity . It seems that netsuite doesn't allow project to be linked with the opportunity with a different client. Is there a way to populate the program field "Project" on opportunity and link the record with each other without changing the constituent on the records?
You would have to create a new Custom body or column field that would allow you to select any Project (regardless of which constituent/institution it is attached to). From there make considerations for why you want the 2 linked, and note that NetSuite will not complete any automation based on this custom field. You will have to make other modifications depending on business needs.

How to get 'Bills and Adjustment' grid fields in an endpoint extension

I'm working with a client on obtaining Bills and Adjustments values through the Contract based web services. I understand that certain fields aren't available in the Default Endpoint, and have to be obtained through an extension.
I'm trying to add fields from the Bills and Adjustments' Applications tab, but I'm running into a warning that I don't understand. If I extend the Default endpoint for 'Bills' (call it 'BillExt'), and I try to add the Reference Number field from the 'Applications' tab/grid (or any other field from that grid) - I get the following warning (see screenshot below)...
Can someone explain what the issue is, and how I go about adding these fields from the 'Applictaions' tab/grid? I've added fields from the 'Approval Details' grid without this warning without a problem. Is this a warning I can disregard?
You are trying to add a field from another table/view that can return multiple rows for a single Bill.
The correct way to do this is by adding a separate collection on the object and map the view on that collection. e.g: Applications or Details collections here.
That collection will have the information for all records related to the header once you retrieve them using the ?$expand=Details on the query string request.

Unexpected behaviour of inverse_name in Odoo 11

You know about inverse_name parameter, available for One2many fields. It just tells Odoo which is the mandatory Many2one field in the related comodel to know the records to show.
In standard module account, in account.invoice model, there is a Many2one field named move_id. It is related to account.move model and its purpose is to show the journal entry generated for the invoice when this one is validated.
The only thing I want to do is to show in journal entries form (account.move) the invoice (account.invoice) whose validation has generated that journal entry. So it looked easy for me, I have just created the other part of the relationship in account.move model:
invoice_ids = fields.One2many(
comodel_name='account.invoice',
inverse_name='move_id',
string='Invoices whose validation generated this journal entry',
)
The logical between account.invoice and account.move should be 1:1, but for this case I can use 1:N since the One2many is just informative and readonly for users. So this one seemed to work OK, I was able to see the invoice in the journal entry, but after a while I realised that I had destroyed the workflow with that code.
This is what happens now, I describe it with examples:
I create and validate the invoice SALE/INV/00001.
The validation generates the journal entry 2019/00001. I can see this journal entry in the invoice form, and I can see the invoice in the journal entry form (in the One2many I have created). Right.
I pay the invoice, and here is where everything breaks down. The payment generates the journal entry 2019/00002, which is OK, but now, in the invoice SALE/INV/00001, I see this journal entry instead of 2019/00001, which is wrong, and if I go to the form of the journal entry 2019/00001, the One2many field I have created to show the related invoice is empty, whereas the one in the journal entry generated by the payment shows SALE/INV/00001, when it should be empty.
I expected journal entry's invoice_ids field to show only the invoices whose validation generated that journal entry, since move_id in invoices only shows the journal entries generated by validations.
To correct this I have replaced the One2many invoice_ids by the Many2one invoice_id in journal entry, and I fill this in automatically in account.move ORM create method. But this solution does not link old records in the database, and I still do not understand the behaviour of the code described above.
So, does anyone have an explanation for that? I would like to know why inverse_name behaves like that.
After wasting a lot of time filling in the core with log messages, I found my unfortunate problem.
When you pay an invoice through the standard method (clicking on the Register Payment button), a pop-up of the account.payment model is opened. This model has already a field named invoice_ids, and Odoo is using the context of the action which opens the pop-up to fill it in automatically with the current invoice:
<field name="context">{'default_invoice_ids': [(4, active_id, None)]}</field>
When the payment is accepted, a call to account.move create method is done to generate the payment journal entry. The problem is that the context of the action still remains in that call, which means that Odoo thinks that I want to fill in my custom field invoice_ids of account.move with that value (which is always the active id, the invoice we keep opened)... and that is not the truth.
I guess that is very bad luck.
Finally I fixed it just modifying the technical name of my One2many field to avoid Odoo to be confused:
validated_invoice_ids = fields.One2many(
comodel_name='account.invoice',
inverse_name='move_id',
string='Invoices whose validation generated this journal entry',
)

User event Before Submit doesn't work in case of automatic PO creation (NETSUITE)

Is it possible to restrict the purchase order created automatically like when any dropship or special offer item selected in sales order?
I can confirm as of very recent discussions and testing with Netsuite that before submit does not trigger on automatically generated purchase orders.
We have an approvals system in place and were hoping purchase orders could be auto generated and stay pending supervisor approval but this is not possible as the before submit does not trigger.
An enhancement request has been raised by Netsuite for this functionality.
The behaviour of dropship and special order items is dependent on a checkbox. If you clear the checkbox when the order is approved then the automatic POs will not be created.
Checkbox clearing may be done by the user or may be done via a Before Submit user event script on the Sales Order.
If the need to restrict PO creation has something to do with PO vendor characteristics where you may also need to restrict general PO creation then you should extract the vendor check to a library file. that way it could be used in the SO beforeSubmit to clear the createpo flag and the PO beforeSubmit to throw an error.
You could also use the PO After Submit "specialorder" or "dropship" events to check the PO vendor after submit and delete the created PO.
However given your explanation in the comments the SO shouldn't be able to be approved. i.e. why take a drop ship order where the components are not orderable?

Error occurs when creating an overdue charge

I use the framework to create an Overdue Charge. In previous 5.20 version, there is no issue. I upgraded the site to 6.0. Now an error occurs:
Error #115: An error occurred during processing of the field IsRUTROTDeductible : Index was outside the bounds of the array..
I create the ARInvoiceEntry graph. Next the ARInvoice DAC, and populate the header fields. Finally I call graph.Document.Insert(overduecharge). Transactions are inserted later.
I do have some user fields in an extension table 'ARRegisterExtension'. But that table uses the default InnerJoin, with the matching records from ARRegister included in the table
Please advise if an extra step must happen with RUTROTDeductible. I'm not familiar with this entity.
Try to search for RUTROT in your code.
These fields were moved to an extension in 6.0, so these fields will not be available in ARInvoice DAC any more.
If you are setting these fields anywhere, please remove this code.
These fields are for Sweden users only, so, I don't think you need to set it.

Resources