Skip to content

Commit

Permalink
Merge pull request #1180 from VoicuStefan2001/17.0-mig-deltatech_invo…
Browse files Browse the repository at this point in the history
…ice_color

[17.0][MIG] deltatech_invoice_color update
  • Loading branch information
dhongu authored Jan 4, 2024
2 parents c914300 + 4b63f1a commit fee967b
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 38 deletions.
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:ab054f8fef9cf9d123b367a654268d55353c6d1d2b42b6c0078f15db7c12413f
!! source digest: sha256:ec56e2883029b310a13be89f8151abfffe090e0af804ffa57c3622e1e51e4bbe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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": "17.0.0.0.0",
"version": "17.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
48 changes: 25 additions & 23 deletions deltatech_invoice_color/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Deltatech Invoice Delivery</title>
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Deltatech Invoice Color</title>
<style type="text/css">

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/

Expand Down Expand Up @@ -360,55 +360,57 @@
</style>
</head>
<body>
<div class="document" id="deltatech-invoice-delivery">
<h1 class="title">Deltatech Invoice Delivery</h1>
<div class="document" id="deltatech-invoice-color">
<h1 class="title">Deltatech Invoice Color</h1>

<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:c2c9de7cc12b16aa14f3ef419580810fc51d94e92fa92982d5f51e98baf54205
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" href="https://github.com/dhongu/deltatech/tree/16.0/deltatech_invoice_delivery"><img alt="dhongu/deltatech" src="https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github" /></a></p>
<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">
<dt>Features:</dt>
<dd><ul class="first last simple">
<li>Generation of a sale order and delivery automatically when validating an sale invoice</li>
<li>Allow negative quantity in sale order</li>
<li>Colors in red the invoice lines that are not associated to a Purchase Order or a Sale Order</li>
<li>Colors in yellow the invoice lines that don’t have a product selected</li>
</ul>
</dd>
</dl>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#bug-tracker" id="id1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id3">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="id4">Maintainers</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-4">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id1">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/dhongu/deltatech/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/dhongu/deltatech/issues/new?body=module:%20deltatech_invoice_delivery%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/dhongu/deltatech/issues/new?body=module:%20deltatech_invoice_color%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id2">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-2">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<ul class="simple">
<li>Terrabit</li>
<li>Dorin Hongu</li>
<li>Voicu Stefan</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id4">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Maintainers</a></h2>
<p>Current maintainer:</p>
<p><a class="reference external" href="https://github.com/dhongu"><img alt="dhongu" src="https://github.com/dhongu.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/dhongu/deltatech/tree/16.0/deltatech_invoice_delivery">dhongu/deltatech</a> project on GitHub.</p>
<p><a class="reference external image-reference" href="https://github.com/VoicuStefan2001"><img alt="VoicuStefan2001" src="https://github.com/VoicuStefan2001.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/dhongu/deltatech/tree/15.0/deltatech_invoice_color">dhongu/deltatech</a> project on GitHub.</p>
<p>You are welcome to contribute.</p>
</div>
</div>
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

0 comments on commit fee967b

Please sign in to comment.