-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] computed no of vols (from invoice) in stock.picking
- Loading branch information
1 parent
c1194e6
commit c3d28c5
Showing
6 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from . import document | ||
from . import product_product | ||
from . import product_template | ||
from . import stock_picking |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (C) 2024 Diego Paradeda - KMEE | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from odoo import fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
number_of_volumes = fields.Integer( | ||
string="Number of Volumes", | ||
compute="_compute_number_of_volumes", | ||
store=False, | ||
default=0, | ||
copy=False, | ||
) | ||
|
||
def _compute_number_of_volumes(self): | ||
for picking in self: | ||
if len(picking.invoice_ids) == 1: | ||
picking.number_of_volumes = sum( | ||
[ | ||
float(v) | ||
for v in picking.invoice_ids.mapped("nfe40_vol.nfe40_qVol") | ||
] | ||
) | ||
else: | ||
picking.number_of_volumes = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<odoo> | ||
<record id="view_picking_withcarrier_out_form_inherit" model="ir.ui.view"> | ||
<field name="model">stock.picking</field> | ||
<field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//group[@name='carrier_data']" position="inside"> | ||
<field | ||
name="number_of_volumes" | ||
attrs="{'invisible': [('invoice_ids', '=', [])]}" | ||
/> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |