Skip to content

Commit

Permalink
access to sales (#1621)
Browse files Browse the repository at this point in the history
  • Loading branch information
danila12 authored Jul 26, 2024
1 parent 30384c3 commit aa74376
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ addon | version | maintainers | summary | price
[deltatech_service_consumable](deltatech_service_consumable/) | 14.0.1.1.3 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Service Consumable | Free
[deltatech_service_equipment](deltatech_service_equipment/) | 14.0.1.2.0 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Service Equipment Management | Free
[deltatech_service_equipment_base](deltatech_service_equipment_base/) | 14.0.1.1.3 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Service Equipment Management | Free
[deltatech_service_maintenance](deltatech_service_maintenance/) | 14.0.1.1.3 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Services Maintenance | Free
[deltatech_service_maintenance](deltatech_service_maintenance/) | 14.0.1.1.4 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Services Maintenance | Free
[deltatech_service_maintenance_agreement](deltatech_service_maintenance_agreement/) | 14.0.1.0.4 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Services Maintenance | Free
[deltatech_service_maintenance_plan](deltatech_service_maintenance_plan/) | 14.0.1.0.6 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Services Maintenance Plan | Free
[deltatech_sms](deltatech_sms/) | 14.0.1.0.0 | [![dhongu](https:/dhongu.png?size=30px)](https:/dhongu) | Send SMS to custom endpoint | Free
Expand Down
2 changes: 1 addition & 1 deletion deltatech_service_maintenance/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deltatech Services Maintenance
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a9779586e3d4dc40d441ae70e7bc88ede142466019d9a047f67e70c0fdd6f8ed
!! source digest: sha256:f0381c9f50a805a1f567df81f38596a76b431067e0b80a306c916284187889e2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
Expand Down
2 changes: 1 addition & 1 deletion deltatech_service_maintenance/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Deltatech Services Maintenance",
"summary": "Services Maintenance",
"version": "14.0.1.1.3",
"version": "14.0.1.1.4",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"category": "Services/Maintenance",
Expand Down
32 changes: 18 additions & 14 deletions deltatech_service_maintenance/models/service_warranty.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ def onchange_equipment_id(self):
if self.equipment_id:
self.user_id = self.equipment_id.technician_user_id or self.user_id
if self.equipment_id.serial_id:
move_lines = self.env["stock.move.line"].search(
[
("lot_id", "=", self.equipment_id.serial_id.id),
("state", "=", "done"),
("product_id", "=", self.equipment_id.product_id.id),
],
order="date DESC",
move_lines = (
self.env["stock.move.line"]
.sudo()
.search(
[
("lot_id", "=", self.equipment_id.serial_id.id),
("state", "=", "done"),
("product_id", "=", self.equipment_id.product_id.id),
],
order="date DESC",
)
)
if move_lines:
last_move = False
Expand All @@ -107,13 +111,13 @@ def onchange_equipment_id(self):
if move.location_dest_id.usage == "customer":
last_move = move
break
if last_move and last_move.move_id.sale_line_id:
self.sale_order_id = last_move.move_id.sale_line_id.order_id
invoice_lines = last_move.move_id.sale_line_id.invoice_lines
invoices = invoice_lines.move_id
if len(invoices) == 1:
if invoices.state == "posted" and invoices.move_type == "out_invoice":
self.invoice_id = invoices
if last_move and last_move.sudo().move_id.sale_line_id:
self.sudo().sale_order_id = last_move.move_id.sudo().sale_line_id.order_id
invoice_lines = last_move.move_id.sudo().sale_line_id.invoice_lines
invoices = invoice_lines.sudo().move_id
if len(invoices.sudo()) == 1:
if invoices.sudo().state == "posted" and invoices.sudo().move_type == "out_invoice":
self.invoice_id = invoices.sudo()
self.partner_id = invoices.partner_id
else:
self.invoice_id = False
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ <h1 class="title">Deltatech Services Maintenance</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a9779586e3d4dc40d441ae70e7bc88ede142466019d9a047f67e70c0fdd6f8ed
!! source digest: sha256:f0381c9f50a805a1f567df81f38596a76b431067e0b80a306c916284187889e2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https:/dhongu/deltatech/tree/14.0/deltatech_service_maintenance"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
Expand Down

0 comments on commit aa74376

Please sign in to comment.