Skip to content

Commit

Permalink
Merge pull request #1177 from dhongu/15.0-deltatech_invoice_receipt
Browse files Browse the repository at this point in the history
[15.0] update invoice
  • Loading branch information
dhongu authored Jan 3, 2024
2 parents a611beb + 7ace227 commit 539bab8
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ addon | version | maintainers | summary | price
[deltatech_fleet_geo](deltatech_fleet_geo/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Fleet Geographical Information | Free
[deltatech_followup](deltatech_followup/) | 15.0.0.0.4 | | Simple invoice followup, with automatic e-mails | Free
[deltatech_generic_partner_restriction](deltatech_generic_partner_restriction/) | 15.0.2.0.0 | [![cojocariudaniel1](https://github.com/cojocariudaniel1.png?size=30px)](https://github.com/cojocariudaniel1) | Generic Partner restriction | Free
[deltatech_invoice_color](deltatech_invoice_color/) | 15.0.0.0.0 | [![VoicuStefan2001](https://github.com/VoicuStefan2001.png?size=30px)](https://github.com/VoicuStefan2001) | Colors Invoice Lines | Free
[deltatech_invoice_color](deltatech_invoice_color/) | 15.0.0.0.1 | [![VoicuStefan2001](https://github.com/VoicuStefan2001.png?size=30px)](https://github.com/VoicuStefan2001) | Colors Invoice Lines | Free
[deltatech_invoice_delivery](deltatech_invoice_delivery/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Create delivery form invoice | Free
[deltatech_invoice_number](deltatech_invoice_number/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Renumbering invoice | Free
[deltatech_invoice_payment](deltatech_invoice_payment/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Show payments from invoice | Free
[deltatech_invoice_picking](deltatech_invoice_picking/) | 15.0.1.0.9 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Facturare livrari | 5.0 EUR
[deltatech_invoice_product_filter](deltatech_invoice_product_filter/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Searching invoice using product | Free
[deltatech_invoice_receipt](deltatech_invoice_receipt/) | 15.0.2.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Create receipt form invoice | Free
[deltatech_invoice_receipt](deltatech_invoice_receipt/) | 15.0.2.0.1 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Create receipt form invoice | Free
[deltatech_invoice_report](deltatech_invoice_report/) | 15.0.1.0.4 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Invoice Report | Free
[deltatech_invoice_to_draft](deltatech_invoice_to_draft/) | 15.0.2.0.1 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Restricted access to reset account move to draft | Free
[deltatech_invoice_weight](deltatech_invoice_weight/) | 15.0.1.0.0 | [![dhongu](https://github.com/dhongu.png?size=30px)](https://github.com/dhongu) | Invoice Weight | Free
Expand Down
2 changes: 1 addition & 1 deletion deltatech_invoice_color/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deltatech Invoice Color
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a20edb30e65822ff892540d57d23ff9e0a34c4c94b0690281db70ec25c0829c2
!! source digest: sha256:c2c9de7cc12b16aa14f3ef419580810fc51d94e92fa92982d5f51e98baf54205
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand Down
2 changes: 1 addition & 1 deletion deltatech_invoice_color/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Deltatech Invoice Color",
"summary": "Colors Invoice Lines",
"version": "15.0.0.0.0",
"version": "15.0.0.0.1",
"author": "Terrabit, Voicu Stefan",
"license": "OPL-1",
"website": "https://www.terrabit.ro",
Expand Down
29 changes: 18 additions & 11 deletions deltatech_invoice_color/models/account_invoice_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,28 @@


class AccountMoveLine(models.Model):
"""Override AccountInvoice_line to add the link to the purchase order line it is related to"""

_inherit = "account.move.line"

color_trigger = fields.Boolean(string="Trigger", compute="_compute_color_trigger")
color_trigger = fields.Selection(
[("danger", "Danger"), ("warning", "Warning")], string="Trigger", compute="_compute_color_trigger"
)

@api.depends("purchase_line_id", "sale_line_ids")
def _compute_color_trigger(self):
for line in self:
if (
line.purchase_line_id
and line.move_id.move_type == "in_invoice"
or line.sale_line_ids
and line.move_id.move_type == "out_invoice"
):
line.color_trigger = True
color_trigger = False
if line.move_id.move_type not in ("in_invoice", "in_refund", "out_invoice", "out_refund"):
line.color_trigger = color_trigger
continue
if not line.product_id:
color_trigger = "warning"
else:
line.color_trigger = False
if line.product_id.type == "product":
if line.move_id.move_type in ("in_invoice", "in_refund"):
if not line.purchase_line_id:
color_trigger = "danger"
else:
if not line.sale_line_ids:
color_trigger = "danger"

line.color_trigger = color_trigger
2 changes: 1 addition & 1 deletion deltatech_invoice_color/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Deltatech Invoice Color</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a20edb30e65822ff892540d57d23ff9e0a34c4c94b0690281db70ec25c0829c2
!! source digest: sha256:c2c9de7cc12b16aa14f3ef419580810fc51d94e92fa92982d5f51e98baf54205
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="https://www.odoo.com/documentation/master/legal/licenses.html"><img alt="License: OPL-1" src="https://img.shields.io/badge/licence-OPL--1-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/deltatech/tree/15.0/deltatech_invoice_color"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
Expand Down
4 changes: 2 additions & 2 deletions deltatech_invoice_color/views/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<field name="color_trigger" invisible="1" />
</xpath>
<xpath expr="//field[@name='invoice_line_ids']/tree" position="attributes">
<attribute name="decoration-danger">not color_trigger</attribute>
<attribute name="decoration-warning">not product_id</attribute>
<attribute name="decoration-danger">color_trigger == 'danger'</attribute>
<attribute name="decoration-warning">color_trigger == 'warning'</attribute>
</xpath>
</field>
</record>
Expand Down
2 changes: 1 addition & 1 deletion deltatech_invoice_receipt/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Deltatech Invoice Receipt
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e3c7b260d52ace66ba28d69ea29ce037b829a93c9ae36e36e95a3fc5bd7c118b
!! source digest: sha256:959a1d144ec9d526ca617b266736c456ae39c4d0d6cfadfc80cc832bd4aadecd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
Expand Down
3 changes: 2 additions & 1 deletion deltatech_invoice_receipt/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Deltatech Invoice Receipt",
"summary": "Create receipt form invoice",
"version": "15.0.2.0.0",
"version": "15.0.2.0.1",
"author": "Terrabit, Dorin Hongu",
"license": "OPL-1",
"website": "https://www.terrabit.ro",
Expand All @@ -15,6 +15,7 @@
"data": [
# 'account_invoice_view.xml'
# 'views/invoice_view.xml'
"views/account_move_view.xml"
],
"images": ["static/description/main_screenshot.png"],
"development_status": "Mature",
Expand Down
5 changes: 5 additions & 0 deletions deltatech_invoice_receipt/models/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def add_to_purchase(self):
"""

for invoice in self:
if invoice.state != "draft":
continue
if invoice.move_type not in ["in_invoice", "in_refund"]:
continue

if not invoice.invoice_date:
raise UserError(_("Please enter invoice date"))
# exista o comanda de achizitie legata de aceasta factura ?
Expand Down
2 changes: 1 addition & 1 deletion deltatech_invoice_receipt/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Deltatech Invoice Receipt</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e3c7b260d52ace66ba28d69ea29ce037b829a93c9ae36e36e95a3fc5bd7c118b
!! source digest: sha256:959a1d144ec9d526ca617b266736c456ae39c4d0d6cfadfc80cc832bd4aadecd
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="https://www.odoo.com/documentation/master/legal/licenses.html"><img alt="License: OPL-1" src="https://img.shields.io/badge/licence-OPL--1-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/dhongu/deltatech/tree/15.0/deltatech_invoice_receipt"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<dl class="docutils">
Expand Down
11 changes: 11 additions & 0 deletions deltatech_invoice_receipt/views/account_move_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="action_add_to_purchase" model="ir.actions.server">
<field name="name">Add to purchase order</field>
<field name="model_id" ref="model_account_move" />
<field name="binding_model_id" ref="account.model_account_move" />
<field name="binding_view_types">form</field>
<field name="state">code</field>
<field name="code">action = record.add_to_purchase()</field>
</record>
</odoo>

0 comments on commit 539bab8

Please sign in to comment.