Skip to content

Commit

Permalink
[14.0][ADD] repair_sale_order, partner_invoice_id same behavior of fi…
Browse files Browse the repository at this point in the history
…eld partner_shipping_id
  • Loading branch information
ChrisOForgeFlow authored and PauBForgeFlow committed Dec 22, 2023
1 parent 69e4342 commit fad31d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion repair_sale_order/models/repair_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def _get_sale_order_data(self):
self.address_id = addresses["delivery"]
res = {
"partner_id": self.partner_id.id,
"partner_invoice_id": self.partner_invoice_id.id,
"partner_shipping_id": self.address_id.id,
"origin": self.display_name,
"note": self.quotation_notes,
Expand All @@ -66,11 +67,15 @@ def action_create_sale_order(self):
orders |= sale_order
self.onchange_partner_id()
partner_shipping_id = False
partner_invoice_id = False
if sale_order.partner_shipping_id != sale_order.partner_id:
partner_shipping_id = sale_order.partner_shipping_id

Check warning on line 72 in repair_sale_order/models/repair_order.py

View check run for this annotation

Codecov / codecov/patch

repair_sale_order/models/repair_order.py#L72

Added line #L72 was not covered by tests
sale_order.onchange_partner_id()
if sale_order.partner_invoice_id != sale_order.partner_id:
partner_invoice_id = sale_order.partner_invoice_id

Check warning on line 74 in repair_sale_order/models/repair_order.py

View check run for this annotation

Codecov / codecov/patch

repair_sale_order/models/repair_order.py#L74

Added line #L74 was not covered by tests
if partner_shipping_id:
sale_order.partner_shipping_id = partner_shipping_id

Check warning on line 76 in repair_sale_order/models/repair_order.py

View check run for this annotation

Codecov / codecov/patch

repair_sale_order/models/repair_order.py#L76

Added line #L76 was not covered by tests
if partner_invoice_id:
sale_order.partner_invoice_id = partner_invoice_id

Check warning on line 78 in repair_sale_order/models/repair_order.py

View check run for this annotation

Codecov / codecov/patch

repair_sale_order/models/repair_order.py#L78

Added line #L78 was not covered by tests
for line in rec.operations:
sale_order_line = order_line_model.create(
line._get_sale_line_data(sale_order)
Expand Down
1 change: 1 addition & 0 deletions repair_sale_order/tests/test_repair_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def setUp(self):
"product_id": self.product1.id,
"partner_id": self.partner.id,
"location_id": self.env.ref("stock.stock_location_14").id,
"partner_invoice_id": self.partner.id,
"repair_type_id": self.repair_type.id,
}
)
Expand Down

0 comments on commit fad31d1

Please sign in to comment.