first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from sql.aggregate import Sum
from sql.conditionals import Coalesce
from trytond.model import fields
from trytond.pool import PoolMeta
from trytond.transaction import Transaction
class AbstractShipmentOutCostMixin:
__slots__ = ()
@classmethod
def _column_cost(cls, tables, withs, sign):
move = tables['move']
cost = super()._column_cost(tables, withs, sign)
if Transaction().context.get('include_shipment_cost'):
cost += Sum(
sign * cls.cost.sql_cast(move.internal_quantity)
* Coalesce(move.shipment_out_cost_price, 0))
return cost
class Context(metaclass=PoolMeta):
__name__ = 'stock.reporting.margin.context'
include_shipment_cost = fields.Boolean("Include Shipment Cost")
@classmethod
def default_include_shipment_cost(cls):
return Transaction().context.get('include_shipment_cost', False)