changeset db1114768795 in modules/product_price_list_dates:default
details: 
https://hg.tryton.org/modules/product_price_list_dates?cmd=changeset;node=db1114768795
description:
        Add salable products menu entry

        This shows the same product list as when selecting product from the 
sale line
        and provide the same contextual options.

        issue8981
        review258651002
diffstat:

 __init__.py                        |   1 +
 product.py                         |  12 ++++++++++++
 product.xml                        |   8 ++++++++
 view/product_sale_context_form.xml |   8 ++++++++
 4 files changed, 29 insertions(+), 0 deletions(-)

diffs (57 lines):

diff -r a830f01a6150 -r db1114768795 __init__.py
--- a/__init__.py       Wed Dec 04 11:09:36 2019 +0100
+++ b/__init__.py       Sun Feb 23 13:55:00 2020 +0100
@@ -16,5 +16,6 @@
         module='product_price_list_dates', type_='model')
     Pool.register(
         sale.Line,
+        product.SaleContext,
         module='product_price_list_dates', type_='model',
         depends=['sale_price_list'])
diff -r a830f01a6150 -r db1114768795 product.py
--- a/product.py        Wed Dec 04 11:09:36 2019 +0100
+++ b/product.py        Sun Feb 23 13:55:00 2020 +0100
@@ -68,3 +68,15 @@
         pool = Pool()
         Date = pool.get('ir.date')
         return Date.today()
+
+
+class SaleContext(metaclass=PoolMeta):
+    __name__ = 'product.sale.context'
+
+    date = fields.Function(
+        fields.Date("Date"),
+        'on_change_with_date')
+
+    @fields.depends('sale_date')
+    def on_change_with_date(self, name=None):
+        return self.sale_date
diff -r a830f01a6150 -r db1114768795 product.xml
--- a/product.xml       Wed Dec 04 11:09:36 2019 +0100
+++ b/product.xml       Sun Feb 23 13:55:00 2020 +0100
@@ -69,4 +69,12 @@
             <field name="name">price_list_line_context_form</field>
         </record>
     </data>
+
+    <data depends="sale_price_list">
+        <record model="ir.ui.view" id="product_sale_context_view_form">
+            <field name="model">product.sale.context</field>
+            <field name="inherit" ref="sale.product_sale_context_view_form"/>
+            <field name="name">product_sale_context_form</field>
+        </record>
+    </data>
 </tryton>
diff -r a830f01a6150 -r db1114768795 view/product_sale_context_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/product_sale_context_form.xml        Sun Feb 23 13:55:00 2020 +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="/form" position="inside">
+        <field name="date" invisible="1" colspan="4"/>
+    </xpath>
+</data>

Reply via email to