Skip to content

Commit

Permalink
[MIG] sale_stock_picking_invoicing: Analytic Lines
Browse files Browse the repository at this point in the history
  • Loading branch information
mbcosta committed Jan 14, 2025
1 parent e02e713 commit 6d9450c
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions sale_stock_picking_invoicing/wizards/stock_invoice_onshipping.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,40 +158,41 @@ def _get_invoice_line_values(self, moves, invoice_values, invoice):
values = super()._get_invoice_line_values(moves, invoice_values, invoice)
move = fields.first(moves)
if move.sale_line_id:
# Same make above, get fields informed in Sale Line dict
sale_line_values = move.sale_line_id._prepare_invoice_line()
# Vals informed in any case
values["sale_line_ids"] = [(6, 0, moves.sale_line_id.ids)]
# values[
# "analytic_account_id"
# ] = moves.sale_line_id.order_id.analytic_account_id.id
# values["analytic_tag_ids"] = [
# (6, 0, moves.sale_line_id.analytic_tag_ids.ids)
# ]
values["analytic_distribution"] = sale_line_values.get(
"analytic_distribution"
)
# Refund case don't get values from Sale Line Dict
# TODO: Should get any value?
if self._get_invoice_type() != "out_refund":
# Same make above, get fields informed in Sale Line dict
sale_line_values = move.sale_line_id._prepare_invoice_line()
# Original fields from sale module
# Fields do get
# "sequence": self.sequence,
# "discount": self.discount,
# "display_type": self.display_type or 'product'
# "is_downpayment": self.is_downpayment
# * optional_values
# * 'N field' included in _prepare_invoice_line method
# by another module

# Fields to remove
vals_to_remove = {
# Fields from Move has priority
"name",
"product_id",
"product_uom_id",
"quantity",
"price_unit",
"tax_ids",
"analytic_account_id",
"analytic_tag_ids",
# Already get
"sale_line_ids",
"anlytic_distribution",
# another fields
"__last_update",
"display_name",
"currency_id",
"analytic_precision",
}
sale_line_values_rm = {
k: sale_line_values[k]
Expand Down

0 comments on commit 6d9450c

Please sign in to comment.