changeset 22c80034a51f in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset;node=22c80034a51f
description:
        Add delivery usage to contact mechanism

        issue9991
        review320581002
diffstat:

 CHANGELOG                             |   1 +
 __init__.py                           |   3 ++-
 party.py                              |  22 ++++++++++++++++++++++
 party.xml                             |  26 ++++++++++++++++++++++++++
 shipment.py                           |   6 ------
 shipment.xml                          |  11 -----------
 view/party_contact_mechanism_form.xml |   9 +++++++++
 view/party_contact_mechanism_tree.xml |   8 ++++++++
 8 files changed, 68 insertions(+), 18 deletions(-)

diffs (162 lines):

diff -r 5d69d93e06f5 -r 22c80034a51f CHANGELOG
--- a/CHANGELOG Tue Feb 09 00:32:18 2021 +0100
+++ b/CHANGELOG Sat Feb 13 22:10:53 2021 +0100
@@ -1,3 +1,4 @@
+* Add delivery usage to contact mechanism
 * Add margin reporting
 * Add products_by_locations Model
 
diff -r 5d69d93e06f5 -r 22c80034a51f __init__.py
--- a/__init__.py       Tue Feb 09 00:32:18 2021 +0100
+++ b/__init__.py       Sat Feb 13 22:10:53 2021 +0100
@@ -35,7 +35,8 @@
         shipment.ShipmentOutReturn,
         shipment.ShipmentInternal,
         shipment.AssignPartial,
-        shipment.Address,
+        party.Address,
+        party.ContactMechanism,
         period.Period,
         period.Cache,
         product.Template,
diff -r 5d69d93e06f5 -r 22c80034a51f party.py
--- a/party.py  Tue Feb 09 00:32:18 2021 +0100
+++ b/party.py  Sat Feb 13 22:10:53 2021 +0100
@@ -1,11 +1,33 @@
 # 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 trytond.i18n import gettext
+from trytond.model import fields
 from trytond.pool import PoolMeta, Pool
 
 from trytond.modules.party.exceptions import EraseError
 
 
+class Address(metaclass=PoolMeta):
+    __name__ = 'party.address'
+    delivery = fields.Boolean(
+        'Delivery',
+        help="Check to send deliveries to the address.")
+
+
+class ContactMechanism(metaclass=PoolMeta):
+    __name__ = 'party.contact_mechanism'
+    delivery = fields.Boolean(
+        'Delivery',
+        help="Check to use for delivery.")
+
+    @classmethod
+    def usages(cls, _fields=None):
+        if _fields is None:
+            _fields = []
+        _fields.append('delivery')
+        return super().usages(_fields=_fields)
+
+
 class Replace(metaclass=PoolMeta):
     __name__ = 'party.replace'
 
diff -r 5d69d93e06f5 -r 22c80034a51f party.xml
--- a/party.xml Tue Feb 09 00:32:18 2021 +0100
+++ b/party.xml Sat Feb 13 22:10:53 2021 +0100
@@ -3,12 +3,38 @@
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
+        <record model="ir.ui.view" id="address_view_tree">
+            <field name="model">party.address</field>
+            <field name="inherit" ref="party.address_view_tree"/>
+            <field name="name">party_address_tree</field>
+        </record>
+        <record model="ir.ui.view" id="address_view_form">
+            <field name="model">party.address</field>
+            <field name="inherit" ref="party.address_view_form"/>
+            <field name="name">party_address_form</field>
+        </record>
         <record model="ir.ui.view" id="address_view_tree_sequence">
             <field name="model">party.address</field>
             <field name="inherit" ref="party.address_view_tree_sequence"/>
             <field name="name">party_address_tree</field>
         </record>
 
+        <record model="ir.ui.view" id="contact_mechanism_view_tree">
+            <field name="model">party.contact_mechanism</field>
+            <field name="inherit" ref="party.contact_mechanism_view_tree"/>
+            <field name="name">party_contact_mechanism_tree</field>
+        </record>
+        <record model="ir.ui.view" id="contact_mechanism_view_form">
+            <field name="model">party.contact_mechanism</field>
+            <field name="inherit" ref="party.contact_mechanism_view_form"/>
+            <field name="name">party_contact_mechanism_form</field>
+        </record>
+        <record model="ir.ui.view" id="contact_mechanism_view_tree_sequence">
+            <field name="model">party.contact_mechanism</field>
+            <field name="inherit" 
ref="party.contact_mechanism_view_tree_sequence"/>
+            <field name="name">party_contact_mechanism_tree</field>
+        </record>
+
         <record model="ir.action.act_window" id="act_shipment_out_form2">
             <field name="name">Customer Shipments</field>
             <field name="res_model">stock.shipment.out</field>
diff -r 5d69d93e06f5 -r 22c80034a51f shipment.py
--- a/shipment.py       Tue Feb 09 00:32:18 2021 +0100
+++ b/shipment.py       Sat Feb 13 22:10:53 2021 +0100
@@ -2519,12 +2519,6 @@
         cls.save(shipments)
 
 
-class Address(metaclass=PoolMeta):
-    __name__ = 'party.address'
-    delivery = fields.Boolean('Delivery',
-        help="Check to send deliveries to the address.")
-
-
 class Assign(Wizard):
     "Assign Shipment"
     __name__ = 'stock.shipment.assign'
diff -r 5d69d93e06f5 -r 22c80034a51f shipment.xml
--- a/shipment.xml      Tue Feb 09 00:32:18 2021 +0100
+++ b/shipment.xml      Sat Feb 13 22:10:53 2021 +0100
@@ -487,17 +487,6 @@
                 <field name="code">stock.shipment.in.return</field>
         </record>
 
-        <record model="ir.ui.view" id="address_view_tree">
-            <field name="model">party.address</field>
-            <field name="inherit" ref="party.address_view_tree"/>
-            <field name="name">party_address_tree</field>
-        </record>
-        <record model="ir.ui.view" id="address_view_form">
-            <field name="model">party.address</field>
-            <field name="inherit" ref="party.address_view_form"/>
-            <field name="name">party_address_form</field>
-        </record>
-
         <record model="ir.model.access" id="access_shipment_in">
             <field name="model" search="[('model', '=', 
'stock.shipment.in')]"/>
             <field name="perm_read" eval="False"/>
diff -r 5d69d93e06f5 -r 22c80034a51f view/party_contact_mechanism_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/party_contact_mechanism_form.xml     Sat Feb 13 22:10:53 2021 +0100
@@ -0,0 +1,9 @@
+<?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. -->
+<data>
+    <xpath expr="//group[@id='checkboxes']/field[@name='active']" 
position="after">
+        <label name="delivery"/>
+        <field name="delivery" xexpand="0" width="25"/>
+    </xpath>
+</data>
diff -r 5d69d93e06f5 -r 22c80034a51f view/party_contact_mechanism_tree.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/party_contact_mechanism_tree.xml     Sat Feb 13 22:10:53 2021 +0100
@@ -0,0 +1,8 @@
+<?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. -->
+<data>
+    <xpath expr="//field[@name='party']" position="after">
+        <field name="delivery"/>
+    </xpath>
+</data>

Reply via email to