This commit is contained in:
2026-02-08 08:52:30 +01:00
parent c1a4b442a3
commit a09a88ff5f
11 changed files with 265 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ from . import (
valuation,
dimension,
weight_report,
backtoback,
service,
)
@@ -165,6 +166,7 @@ def register():
purchase.DocTemplate,
purchase.DocTypeTemplate,
purchase.PurchaseStrategy,
backtoback.Backtoback,
dimension.AnalyticDimension,
dimension.AnalyticDimensionValue,
dimension.AnalyticDimensionAssignment,
@@ -210,6 +212,7 @@ def register():
sale.ContractDocumentType,
sale.SaleStrategy,
sale.OpenPosition,
sale.Backtoback,
module='sale', type_='model')
Pool.register(
lot.LotShipping,

View File

@@ -0,0 +1,22 @@
from trytond.model import fields
from trytond.pool import Pool, PoolMeta
from trytond.pyson import Bool, Eval, Id
from trytond.model import (ModelSQL, ModelView)
from trytond.tools import is_full_text, lstrip_wildcard
from trytond.transaction import Transaction, inactive_records
from decimal import getcontext, Decimal, ROUND_HALF_UP
from sql.aggregate import Count, Max, Min, Sum, Avg, BoolOr
from sql.conditionals import Case
from sql import Column, Literal
from sql.functions import CurrentTimestamp, DateTrunc
from trytond.wizard import Button, StateTransition, StateView, Wizard
import datetime
import logging
class Backtoback(ModelSQL, ModelView):
'Back To Back'
__name__ = 'back.to.back'
reference = fields.Char("Reference")
purchase = fields.One2Many('purchase.purchase', "Purchase")

View File

@@ -0,0 +1,54 @@
<tryton>
<data>
<record model="ir.ui.icon" id="btb_icon">
<field name="name">tradon-btb</field>
<field name="path">icons/tradon-btb.svg</field>
</record>
<record model="ir.ui.view" id="btb_view_form">
<field name="model">back.to.back</field>
<field name="type">form</field>
<field name="name">btb_form</field>
</record>
<record model="ir.ui.view" id="purchase_btb_view_form">
<field name="model">purchase.purchase</field>
<field name="type">form</field>
<field name="name">purchase_btb_form</field>
</record>
<record model="ir.ui.view" id="btb_view_list">
<field name="model">back.to.back</field>
<field name="type">tree</field>
<field name="name">btb_tree</field>
</record>
<record model="ir.action.act_window" id="act_btb_form">
<field name="name">Back to back</field>
<field name="res_model">back.to.back</field>
</record>
<record model="ir.action.act_window.view" id="act_btb_form_view1">
<field name="sequence" eval="10"/>
<field name="view" ref="btb_view_list"/>
<field name="act_window" ref="act_btb_form"/>
</record>
<record model="ir.action.act_window.view" id="act_btb_form_view2">
<field name="sequence" eval="20"/>
<field name="view" ref="btb_view_form"/>
<field name="act_window" ref="act_btb_form"/>
</record>
<menuitem
name="Back to back"
sequence="99"
id="menu_btb_main"
icon="tradon-btb" />
<menuitem
name="Back to back"
action="act_btb_form"
parent="menu_btb_main"
sequence="10"
id="menu_btb" />
</data>
</tryton>

View File

@@ -0,0 +1,14 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<path d="M0 0h24v24H0z" fill="none"/>
<!-- Barre centrale (contrat / position) -->
<rect x="11" y="4" width="2" height="16" fill="#267F82"/>
<!-- Flèche gauche (achat) -->
<path d="M9 7 L5 12 L9 17 L9 14 L11 14 L11 10 L9 10 Z"
fill="#267F82"/>
<!-- Flèche droite (vente) -->
<path d="M15 7 L19 12 L15 17 L15 14 L13 14 L13 10 L15 10 Z"
fill="#267F82"/>
</svg>

After

Width:  |  Height:  |  Size: 496 B

View File

@@ -45,6 +45,12 @@ class FeeLots(metaclass=PoolMeta):
sale_line = fields.Many2One('sale.line',"Line")
class Backtoback(metaclass=PoolMeta):
'Back To Back'
__name__ = 'back.to.back'
sale = fields.One2Many('sale.sale', "Sale")
class OpenPosition(metaclass=PoolMeta):
"Open position"
__name__ = 'open.position'

View File

@@ -52,5 +52,11 @@ this repository contains the full copyright notices and license terms. -->
<field name="model">sale.sale,-1</field>
<field name="action" ref="act_sale_allocations_wizard"/>
</record>
<record model="ir.ui.view" id="sale_btb_view_form">
<field name="model">sale.sale</field>
<field name="type">form</field>
<field name="name">sale_btb_form</field>
</record>
</data>
</tryton>

View File

@@ -31,4 +31,5 @@ xml:
derivative.xml
valuation.xml
weight_report.xml
dimension.xml
dimension.xml
backtoback.xml

View File

@@ -0,0 +1,10 @@
<form>
<label name="reference"/>
<field name="reference"/>
<newline/>
<label name="purchase"/>
<field name="purchase" mode="form" view_ids="purchase_trade.purchase_btb_view_form"/>
<newline/>
<label name="sale"/>
<field name="sale" mode="form" view_ids="purchase_trade.sale_btb_view_form"/>
</form>

View File

@@ -0,0 +1,5 @@
<tree>
<field name="reference"/>
<field name="purchase"/>
<field name="sale"/>
</tree>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form col="6">
<group col="4" colspan="4" id="hd" yfill="1">
<label name="party"/>
<field name="party"/>
<label name="number"/>
<field name="number"/>
<newline/>
<label name="reference"/>
<field name="reference"/>
<label name="purchase_date"/>
<field name="purchase_date"/>
<newline/>
<label name="payment_term"/>
<field name="payment_term"/>
<label name="currency"/>
<field name="currency"/>
<newline/>
<label name="certif"/>
<field name="certif"/>
</group>
<group col="2" colspan="2" id="hd" yfill="1">
<field name="viewer" widget="html_viewer" height="300" width="600"/>
</group>
<notebook colspan="6">
<page string="Purchase" id="purchase">
<field name="lines" colspan="4"
view_ids="purchase.purchase_line_view_tree_sequence"/>
<notebook colspan="6">
<page string="State" id="state">
<group col="2" colspan="2" id="states" yfill="1">
<label name="invoice_state"/>
<field name="invoice_state"/>
<label name="shipment_state"/>
<field name="shipment_state"/>
<label name="state"/>
<field name="state"/>
</group>
<group col="2" colspan="2" id="amount" yfill="1">
<label name="untaxed_amount" xalign="1.0" xexpand="1"/>
<field name="untaxed_amount" xalign="1.0" xexpand="0"/>
<label name="tax_amount" xalign="1.0" xexpand="1"/>
<field name="tax_amount" xalign="1.0" xexpand="0"/>
<label name="total_amount" xalign="1.0" xexpand="1"/>
<field name="total_amount" xalign="1.0" xexpand="0"/>
</group>
</page>
</notebook>
</page>
</notebook>
<group id="links" col="-1" colspan="3">
<link icon="tryton-shipment-in" name="purchase.act_shipment_form"/>
<link icon="tryton-account" name="purchase.act_invoice_form"/>
<!-- <link icon="tryton-shipment-out" name="purchase.act_return_form"/> -->
</group>
<group col="-1" colspan="3" id="buttons">
<button name="cancel" icon="tryton-cancel"/>
<button name="draft"/>
<button name="modify_header" icon="tryton-launch"/>
<button name="quote" icon="tryton-forward"/>
<button name="handle_invoice_exception" icon="tryton-forward"/>
<button name="handle_shipment_exception" icon="tryton-forward"/>
<button name="confirm" icon="tryton-ok"/>
<button name="process"/>
<button name="manual_invoice" icon="tryton-forward"/>
</group>
<field name="party_lang" invisible="1" colspan="6"/>
</form>

View File

@@ -0,0 +1,73 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<form col="6">
<group col="4" colspan="4" id="hd" yfill="1">
<label name="party"/>
<field name="party"/>
<label name="number"/>
<field name="number"/>
<!-- <label name="contact"/>
<field name="contact"/> -->
<newline/>
<label name="reference"/>
<field name="reference"/>
<label name="sale_date"/>
<field name="sale_date"/>
<newline/>
<label name="payment_term"/>
<field name="payment_term"/>
<label name="currency"/>
<field name="currency"/>
<newline/>
<label name="certif"/>
<field name="certif"/>
</group>
<group col="2" colspan="2" id="hd" yfill="1">
<field name="viewer" widget="html_viewer" height="300" width="600"/>
</group>
<notebook colspan="6">
<page string="Sale" id="sale">
<field name="lines" colspan="4"
view_ids="sale.sale_line_view_tree_sequence"/>
<notebook colspan="6">
<page string="State" id="state">
<group col="2" colspan="2" id="states" yfill="1">
<label name="invoice_state"/>
<field name="invoice_state"/>
<label name="shipment_state"/>
<field name="shipment_state"/>
<label name="state"/>
<field name="state"/>
</group>
<group col="2" colspan="2" id="amount" yfill="1">
<label name="untaxed_amount" xalign="1.0" xexpand="1"/>
<field name="untaxed_amount" xalign="1.0" xexpand="0"/>
<label name="tax_amount" xalign="1.0" xexpand="1"/>
<field name="tax_amount" xalign="1.0" xexpand="0"/>
<label name="total_amount" xalign="1.0" xexpand="1"/>
<field name="total_amount" xalign="1.0" xexpand="0"/>
</group>
</page>
</notebook>
</page>
</notebook>
<group id="links" col="-1" colspan="3">
<link icon="tryton-shipment-out" name="sale.act_shipment_form"/>
<link icon="tryton-account" name="sale.act_invoice_form"/>
<link icon="tryton-shipment-in" name="sale.act_return_form"/>
</group>
<group col="-1" colspan="3" id="buttons">
<button name="cancel" icon="tryton-cancel"/>
<button name="modify_header" icon="tryton-launch"/>
<button name="draft"/>
<button name="quote" icon="tryton-forward"/>
<button name="handle_invoice_exception" icon="tryton-forward"/>
<button name="handle_shipment_exception" icon="tryton-forward"/>
<button name="confirm" icon="tryton-forward"/>
<button name="process"/>
<button name="manual_invoice" icon="tryton-forward"/>
<button name="manual_shipment" icon="tryton-forward"/>
</group>
<field name="party_lang" invisible="1" colspan="6"/>
</form>