Skip to content

[IMP] l10n_in: assign gstr section for purchase documents #4823

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

Draft
wants to merge 2 commits into
base: master-l10n_in_reports-gstr-mapping-field-jasa
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 42 additions & 25 deletions addons/account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -3294,47 +3294,64 @@ def changed(fname):
if changed('commercial_partner_id'):
move.line_ids.partner_id = after[move]['commercial_partner_id']

@contextmanager
def _sync_dynamic_lines(self, container):
with self._disable_recursion(container, 'skip_invoice_sync') as disabled:
if disabled:
yield
return
def update_containers():
# Only invoice-like and journal entries in "auto tax mode" are synced
tax_container['records'] = container['records'].filtered(lambda m: m.is_invoice(True) or m.line_ids.tax_ids or m.line_ids.tax_repartition_line_id)
invoice_container['records'] = container['records'].filtered(lambda m: m.is_invoice(True))
misc_container['records'] = container['records'].filtered(lambda m: m.is_entry() and not m.tax_cash_basis_origin_move_id)
def _get_sync_stack(self, container):
tax_container, invoice_container, misc_container = ({} for _ in range(3))

tax_container, invoice_container, misc_container = ({} for __ in range(3))
update_containers()
with ExitStack() as stack:
stack.enter_context(self._sync_dynamic_line(
def update_containers():
# Only invoice-like and journal entries in "auto tax mode" are synced
tax_container['records'] = container['records'].filtered(lambda m: m.is_invoice(True) or m.line_ids.tax_ids or m.line_ids.tax_repartition_line_id)
invoice_container['records'] = container['records'].filtered(lambda m: m.is_invoice(True))
misc_container['records'] = container['records'].filtered(lambda m: m.is_entry() and not m.tax_cash_basis_origin_move_id)

return tax_container, invoice_container, misc_container

update_containers()

stack = [
(10, self._sync_dynamic_line(
existing_key_fname='term_key',
needed_vals_fname='needed_terms',
needed_dirty_fname='needed_terms_dirty',
line_type='payment_term',
container=invoice_container,
))
stack.enter_context(self._sync_unbalanced_lines(misc_container))
stack.enter_context(self._sync_rounding_lines(invoice_container))
stack.enter_context(self._sync_dynamic_line(
)),
(20, self._sync_unbalanced_lines(misc_container)),
(30, self._sync_rounding_lines(invoice_container)),
(40, self._sync_dynamic_line(
existing_key_fname='discount_allocation_key',
needed_vals_fname='line_ids.discount_allocation_needed',
needed_dirty_fname='line_ids.discount_allocation_dirty',
line_type='discount',
container=invoice_container,
))
stack.enter_context(self._sync_tax_lines(tax_container))
stack.enter_context(self._sync_non_deductible_base_lines(invoice_container))
stack.enter_context(self._sync_dynamic_line(
)),
(50, self._sync_tax_lines(tax_container)),
(60, self._sync_non_deductible_base_lines(invoice_container)),
(70, self._sync_dynamic_line(
existing_key_fname='epd_key',
needed_vals_fname='line_ids.epd_needed',
needed_dirty_fname='line_ids.epd_dirty',
line_type='epd',
container=invoice_container,
))
stack.enter_context(self._sync_invoice(invoice_container))
)),
(80, self._sync_invoice(invoice_container)),
]

return stack, update_containers

@contextmanager
def _sync_dynamic_lines(self, container):
with self._disable_recursion(container, 'skip_invoice_sync') as disabled:
if disabled:
yield
return

stack_list, update_containers = self._get_sync_stack(container)
update_containers()
with ExitStack() as stack:
stack_list.sort()
for _seq, contextmgr in stack_list:
stack.enter_context(contextmgr)

line_container = {'records': self.line_ids}
with self.line_ids._sync_invoice(line_container):
yield
Expand Down
8 changes: 0 additions & 8 deletions addons/l10n_in/data/account.account.tag.csv
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
"tax_tag_nil_rated","NIL-RATED","taxes"
"tax_tag_zero_rated","ZERO-RATED","taxes"
"tax_tag_non_gst_supplies","NON GST SUPPLIES","taxes"
"tax_tag_base_sgst_rc","BASE SGST (RC)","taxes"
"tax_tag_base_cgst_rc","BASE CGST (RC)","taxes"
"tax_tag_base_igst_rc","BASE IGST (RC)","taxes"
"tax_tag_base_cess_rc","BASE CESS (RC)","taxes"
"tax_tag_sgst","SGST","taxes"
"tax_tag_cgst","CGST","taxes"
"tax_tag_igst","IGST","taxes"
Expand All @@ -33,16 +29,12 @@
"tax_tag_state_cess","STATE CESS","taxes"
"tax_tag_non_itc_cess","NON ITC CESS","taxes"
"tax_tag_other_non_itc_cess","Other NON ITC CESS","taxes"
"tax_tag_sgst_rc","SGST (RC)","taxes"
"tax_tag_cgst_rc","CGST (RC)","taxes"
"tax_tag_igst_rc","IGST (RC)","taxes"
"tax_tag_non_itc_sgst_rc","NON ITC SGST (RC)","taxes"
"tax_tag_non_itc_cgst_rc","NON ITC CGST (RC)","taxes"
"tax_tag_non_itc_igst_rc","NON ITC IGST (RC)","taxes"
"tax_tag_other_non_itc_sgst_rc","Other NON ITC SGST (RC)","taxes"
"tax_tag_other_non_itc_cgst_rc","Other NON ITC CGST (RC)","taxes"
"tax_tag_other_non_itc_igst_rc","Other NON ITC IGST (RC)","taxes"
"tax_tag_cess_rc","CESS (RC)","taxes"
"tax_tag_non_itc_cess_rc","NON ITC CESS (RC)","taxes"
"tax_tag_other_non_itc_cess_rc","Other NON ITC CESS (RC)","taxes"
"account_tag_closing_stock","Closing Stock","accounts"
Loading