Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3438][3894][IMP] account_move_obc_csv #55

Merged
merged 6 commits into from
Oct 27, 2023

Conversation

AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Oct 19, 2023

3438
3894

  • Add demarkator column ("GL0010000") in the output file to indicate the first line of an
    OBC journal entry (stock journal entries from pickings and MOs are grouped into one
    OBC journal entry picking/MO).
  • Show the partner code of the subcontracted partner in the output file (in "GL0012009")
    for journal envries from subcontracting MOs.

@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as draft October 19, 2023 08:52
@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as ready for review October 20, 2023 07:53
@rinaldifirdaus rinaldifirdaus changed the title [16.0][IMP] stock_move_obc_csv [16.0][IMP] Account_move_obc_csv Oct 20, 2023
@rinaldifirdaus rinaldifirdaus changed the title [16.0][IMP] Account_move_obc_csv [16.0][IMP] account_move_obc_csv Oct 20, 2023
@rinaldifirdaus rinaldifirdaus changed the title [16.0][IMP] account_move_obc_csv [3438][IMP] account_move_obc_csv Oct 20, 2023
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-account_move_obc_csv branch 3 times, most recently from 124957b to 7b4d10a Compare October 23, 2023 10:31
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 16.0-imp-account_move_obc_csv branch from 7b4d10a to d0531e2 Compare October 24, 2023 03:14
Comment on lines 187 to 199
# Group records by picking_id
for _p, grouped_records in groupby(
sorted_records, key=lambda r: r.stock_move_id.picking_id.id
):
first_record = True
for record in grouped_records:
vals_dict = self._get_report_vals_dict(record)
if first_record:
vals_dict[1]["GL0010000"] = "*"
first_record = False
for _k, v in sorted(vals_dict.items()):
writer.writerow(v)
record.is_exported = True
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to consider the non-inventory journal entries (e.g. those from vendor bills). The first line need to be marked with * for those as well.

Suggested change
# Group records by picking_id
for _p, grouped_records in groupby(
sorted_records, key=lambda r: r.stock_move_id.picking_id.id
):
first_record = True
for record in grouped_records:
vals_dict = self._get_report_vals_dict(record)
if first_record:
vals_dict[1]["GL0010000"] = "*"
first_record = False
for _k, v in sorted(vals_dict.items()):
writer.writerow(v)
record.is_exported = True
picking = self.env["stock.picking"]
for record in sorted_records:
vals_dict = self._get_report_vals_dict(record)
first_record = False
record_picking = record.stock_move_id.picking_id
if not record_picking:
first_record = True
elif picking != record_picking:
first_record = True
picking = record_picking
if first_record:
vals_dict[1]["GL0010000"] = "*"
for _k, v in sorted(vals_dict.items()):
writer.writerow(v)
record.is_exported = True

@yostashiro yostashiro changed the title [3438][IMP] account_move_obc_csv [3438][3894][IMP] account_move_obc_csv Oct 25, 2023
Copy link
Member

@yostashiro yostashiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be good, but we haven't added consideration to consolidate journal entries of manufacturing orders. @rinaldifirdaus Please check with the client if this should be covered in this update.

@rinaldifirdaus
Copy link
Contributor

rinaldifirdaus commented Oct 26, 2023

Should be good, but we haven't added consideration to consolidate journal entries of manufacturing orders. Please check with the client if this should be covered in this update.

Hi @AungKoKoLin1997 , client request to add the consideration to consolidate the JE of Manufacturing order as well. could you please help to update this PR to handle this request? thanks!

@AungKoKoLin1997
Copy link
Contributor Author

client request to add the consideration to consolidate the JE of Manufacturing order as well

If I am not mistaken, there is no partner_id field in MO. So, when we create MO, the generated stock_move and JE will not be assigned partner_id. Customer wants which value to be partner_ref for MO?

@rinaldifirdaus
Copy link
Contributor

@AungKoKoLin1997 , sorry to confuse you, but this request is about giving "" only for the first line of the same transfer/mo. currently all line on the report of same MO is having "" . could you please check the behavior?

@yostashiro
Copy link
Member

@AungKoKoLin1997 I have updated the code to slightly improve the readability by flipping the conditions, and also to fix an issue with record sorting - production ids need to be considered or the journal entries from the same MO can be split apart.

@rinaldifirdaus Please go ahead and apply the change to the staging server.

@yostashiro yostashiro merged commit de53c71 into 16.0 Oct 27, 2023
2 checks passed
@yostashiro yostashiro deleted the 16.0-imp-account_move_obc_csv branch April 4, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants