Skip to content

Commit

Permalink
fixup! fix stock move
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaniszewska-dev committed Jun 2, 2022
1 parent 7d37ac4 commit 76ebdf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 3 additions & 3 deletions stock_picking_invoice_link/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class SaleOrderLine(models.Model):
def get_stock_moves_link_invoice(self):
return self.mapped("move_ids")._filter_for_invoice_link()

def _prepare_invoice_line(self, qty):
vals = super()._prepare_invoice_line(qty)
def _prepare_invoice_line(self, **optional_values):
vals = super()._prepare_invoice_line(**optional_values)
stock_moves = self.get_stock_moves_link_invoice()
# Invoice returned moves marked as to_refund
precision = self.env["decimal.precision"].precision_get(
"Product Unit of Measure"
)
if float_compare(qty, 0.0, precision_digits=precision) < 0:
if float_compare(self.product_uom_qty, 0.0, precision_digits=precision) < 0:
stock_moves = stock_moves.filtered(
lambda m: m.to_refund and not m.invoice_line_ids
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@ def setUpClass(cls, chart_template_ref=None):

def test_00_sale_stock_invoice_link(self):
pick_obj = self.env["stock.picking"]
inv_obj = self.env["account.invoice"]
# invoice on order
inv_id = self.so.action_invoice_create()
inv_0 = inv_obj.browse(inv_id)
inv_0 = self.so._create_invoices()
# deliver partially
self.assertEqual(
self.so.invoice_status,
Expand Down

0 comments on commit 76ebdf9

Please sign in to comment.