Skip to content

Commit

Permalink
Merge PR #99 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by legalsylvain
  • Loading branch information
github-grap-bot committed Oct 7, 2024
2 parents c84a114 + 6795211 commit b94814f
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 7 deletions.
1 change: 1 addition & 0 deletions joint_buying_product/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# OCA
"product_uom_measure_type",
"web_notify",
"web_tree_dynamic_colored_field",
"web_tree_image_tooltip",
"web_widget_x2many_2d_matrix",
# GRAP
Expand Down
5 changes: 0 additions & 5 deletions joint_buying_product/readme/INSTALL.rst

This file was deleted.

1 change: 1 addition & 0 deletions joint_buying_product_food/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"data": [
"views/view_res_partner.xml",
"views/view_product_product.xml",
"views/view_joint_buying_purchase_order.xml",
],
"installable": True,
"auto_install": True,
Expand Down
25 changes: 23 additions & 2 deletions joint_buying_product_food/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * joint_buying_product_food
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-08-12 13:30+0000\n"
"PO-Revision-Date: 2021-08-12 13:30+0000\n"
"POT-Creation-Date: 2024-09-18 01:14+0000\n"
"PO-Revision-Date: 2024-09-18 01:14+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: joint_buying_product_food
#: model:ir.model,name:joint_buying_product_food.model_joint_buying_purchase_order_line
msgid "Joint Buying Purchase Order"
msgstr "Commande"

#. module: joint_buying_product_food
#: model:ir.model,name:joint_buying_product_food.model_joint_buying_tour
msgid "Joint buying tour"
msgstr "Tournée de commandes groupées"

#. module: joint_buying_product_food
#: model:ir.model,name:joint_buying_product_food.model_product_product
msgid "Product"
msgstr "Article"

#. module: joint_buying_product_food
#: model:ir.model.fields,field_description:joint_buying_product_food.field_joint_buying_purchase_order_line__residual_use_by_date
msgid "Residual Use By Date"
msgstr "DLC résiduelle"

1 change: 1 addition & 0 deletions joint_buying_product_food/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from . import product_product
from . import joint_buying_tour
from . import joint_buying_purchase_order_line
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright (C) 2023-Today: GRAP (http://www.grap.coop)
# @author: Sylvain LE GAL (https://twitter.com/legalsylvain)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import math

from odoo import api, fields, models


class JointBuyingPurchaseOrderLine(models.Model):
_inherit = "joint.buying.purchase.order.line"

residual_use_by_date = fields.Integer(compute="_compute_residual_use_by_date")

@api.depends(
"product_id.use_by_date_day",
"order_id.request_arrival_date",
"order_id.deposit_date",
)
def _compute_residual_use_by_date(self):
for line in self.filtered(
lambda x: not x.product_id.use_by_date_day
or not x.order_id.request_arrival_date
):
line.residual_use_by_date = -999
for line in self.filtered(
lambda x: x.product_id.use_by_date_day and x.order_id.request_arrival_date
):
line.residual_use_by_date = line.product_id.use_by_date_day - math.ceil(
(
line.order_id.request_arrival_date - line.order_id.deposit_date
).total_seconds()
/ 3600
/ 24
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2021 - Today: GRAP (http://www.grap.coop)
@author: Sylvain LE GAL (https://twitter.com/legalsylvain)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
-->
<odoo>

<record id="view_joint_buying_purchase_order_form" model="ir.ui.view">
<field name="model">joint.buying.purchase.order</field>
<field name="inherit_id" ref="joint_buying_product.view_joint_buying_purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='line_ids']/tree/field[@name='uom_different_description']" position="after">
<field name="residual_use_by_date" attrs="{'invisible': [('residual_use_by_date', '=', -999)]}"
options="{'bg_color': '
white: residual_use_by_date == -999;
red: residual_use_by_date &lt; 1;
orange: residual_use_by_date &lt; 7;
yellow: residual_use_by_date &lt; 14;
'}"/>
</xpath>
</field>
</record>

</odoo>

0 comments on commit b94814f

Please sign in to comment.