[tryton-debian-vcs] tryton-modules-sale-supply branch upstream updated. upstream/3.4.1-1-g46cb8a1

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Thu Apr 23 16:06:34 UTC 2015


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-sale-supply.git;a=commitdiff;h=upstream/3.4.1-1-g46cb8a1

commit 46cb8a12819667dcea619aff6fccbd27cc994c74
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Thu Apr 23 17:00:06 2015 +0200

    Adding upstream version 3.6.0.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index b0d25fb..f8bb98d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,7 @@
-Version 3.4.1 - 2015-02-21
+Version 3.6.0 - 2015-04-20
 * Bug fixes (see mercurial logs for details)
+* Add support for PyPy
+* Add sale supplied move to shipment in state 'staging'
 
 Version 3.4.0 - 2014-10-20
 * Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 79427ae..777b19f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_sale_supply
-Version: 3.4.1
+Version: 3.6.0
 Summary: Tryton module for sale supply
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
 Description: sale_supply
         ===========
         
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
 Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/__init__.py b/__init__.py
index f3f8fb8..c9e6c5c 100644
--- a/__init__.py
+++ b/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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.pool import Pool
 from .sale import *
diff --git a/doc/index.rst b/doc/index.rst
index 24e147e..ff0156d 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -2,7 +2,6 @@ Sale Supply Module
 ##################
 
 The Sale Supply module adds a supply on sale option on product.
-If checked, it will generate a purchase request for each sale lines of this
-product regardless of the stock levels. At the confirmation of the purchase,
-the customer shipments are created. Once the purchased products are received
-then the products on the customer shipments are assigned.
+If checked, it will generate a purchase request for each sale line of this
+product regardless of the stock levels. Once the purchased products are
+received they are assigned on the customer shipments.
diff --git a/product.py b/product.py
index 14dd037..61a8896 100644
--- a/product.py
+++ b/product.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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.model import fields
 from trytond.pool import PoolMeta
 from trytond.pyson import Eval
diff --git a/purchase.py b/purchase.py
index 8228328..5abadba 100644
--- a/purchase.py
+++ b/purchase.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 itertools import chain
 
 from trytond.model import ModelView, Workflow
diff --git a/sale.py b/sale.py
index ea763ff..1417115 100644
--- a/sale.py
+++ b/sale.py
@@ -1,8 +1,7 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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.model import fields
 from trytond.pool import Pool, PoolMeta
-from trytond.transaction import Transaction
 from trytond.pyson import Eval
 
 __all__ = ['Sale', 'SaleLine']
@@ -21,9 +20,13 @@ class Sale:
         return done
 
     def create_shipment(self, shipment_type):
-        shipments = super(Sale, self).create_shipment(shipment_type)
         if shipment_type == 'out':
+            # purchase requests must be created before shipments to get
+            # information about requests during the shipments creation
+            # like the supplier
             self.create_purchase_requests()
+            self.create_move_from_purchase_requests()
+        shipments = super(Sale, self).create_shipment(shipment_type)
         return shipments
 
     def create_purchase_requests(self):
@@ -37,6 +40,24 @@ class Sale:
             line.purchase_request = request
             line.save()
 
+    def create_move_from_purchase_requests(self):
+        'Set to draft move linked to purchase requests'
+        pool = Pool()
+        Move = pool.get('stock.move')
+        ShipmentOut = pool.get('stock.shipment.out')
+
+        moves = []
+        for line in self.lines:
+            if line.purchase_request_state in ['purchased', 'cancel']:
+                for move in line.moves:
+                    if move.state == 'staging':
+                        move.state = 'draft'
+                        moves.append(move)
+        Move.save(moves)
+        shipments = {m.shipment for m in moves
+            if isinstance(m.shipment, ShipmentOut)}
+        ShipmentOut.wait(shipments)
+
 
 class SaleLine:
     __name__ = 'sale.line'
@@ -80,17 +101,18 @@ class SaleLine:
                 or not self.product
                 or self.quantity <= 0
                 or not self.product.purchasable
-                or any(m.state != 'cancel' for m in self.moves)):
+                or any(m.state not in ['staging', 'cancel'] for m in self.moves)):
             return False
         return self.product.supply_on_sale
 
     def get_move(self, shipment_type):
         move = super(SaleLine, self).get_move(shipment_type)
-        if (shipment_type == 'out'
+        if (move
+                and shipment_type == 'out'
                 and (self.supply_on_sale
                     or self.purchase_request)):
             if self.purchase_request_state in ('', 'requested'):
-                return
+                move.state = 'staging'
         return move
 
     def get_purchase_request(self):
diff --git a/sale.xml b/sale.xml
index 0895dde..d52bb21 100644
--- a/sale.xml
+++ b/sale.xml
@@ -12,7 +12,9 @@ this repository contains the full copyright notices and license terms. -->
         <record model="ir.action.act_window" id="act_purchase_request_form">
             <field name="name">Purchase Requests</field>
             <field name="res_model">purchase.request</field>
-            <field name="domain">[('origin', '=', ('sale.sale', Eval('id')))]</field>
+            <field name="domain"
+                eval="[('origin.id', 'in', Eval('active_ids'), 'sale.sale')]"
+                pyson="1"/>
         </record>
         <record model="ir.action.keyword"
             id="act_open_purchase_request_keyword">
diff --git a/setup.py b/setup.py
index 3298c08..65bea9c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 setuptools import setup
 import re
@@ -91,6 +91,8 @@ setup(name=name,
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: Implementation :: CPython',
+        'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Office/Business',
         'Topic :: Office/Business :: Financial :: Accounting',
         ],
diff --git a/stock.py b/stock.py
index dc1f8eb..3739cc4 100644
--- a/stock.py
+++ b/stock.py
@@ -1,8 +1,7 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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.model import ModelView, Workflow
 from trytond.pool import Pool, PoolMeta
-from trytond.transaction import Transaction
 
 
 __all__ = ['ShipmentIn']
diff --git a/tests/__init__.py b/tests/__init__.py
index 81becbb..e80754c 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,5 +1,5 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# 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 test_sale_supply import suite
 
diff --git a/tests/scenario_sale_supply.rst b/tests/scenario_sale_supply.rst
index 5a13bdd..b0973de 100644
--- a/tests/scenario_sale_supply.rst
+++ b/tests/scenario_sale_supply.rst
@@ -2,16 +2,18 @@
 Sale Supply Scenario
 ====================
 
-=============
-General Setup
-=============
-
 Imports::
 
     >>> import datetime
     >>> from dateutil.relativedelta import relativedelta
     >>> from decimal import Decimal
     >>> from proteus import config, Model, Wizard
+    >>> from trytond.modules.company.tests.tools import create_company, \
+    ...     get_company
+    >>> from trytond.modules.account.tests.tools import create_fiscalyear, \
+    ...     create_chart, get_accounts
+    >>> from.trytond.modules.account_invoice.tests.tools import \
+    ...     set_fiscalyear_invoice_sequences, create_payment_term
     >>> today = datetime.date.today()
 
 Create database::
@@ -26,34 +28,14 @@ Install sale_supply, sale, purchase::
     ...         ('name', 'in', ('sale_supply', 'sale', 'purchase',
     ...                 'stock_supply')),
     ...         ])
-    >>> Module.install([x.id for x in modules], config.context)
+    >>> for module in modules:
+    ...     module.click('install')
     >>> Wizard('ir.module.module.install_upgrade').execute('upgrade')
 
 Create company::
 
-    >>> Currency = Model.get('currency.currency')
-    >>> CurrencyRate = Model.get('currency.currency.rate')
-    >>> Company = Model.get('company.company')
-    >>> Party = Model.get('party.party')
-    >>> company_config = Wizard('company.company.config')
-    >>> company_config.execute('company')
-    >>> company = company_config.form
-    >>> party = Party(name='Dunder Mifflin')
-    >>> party.save()
-    >>> company.party = party
-    >>> currencies = Currency.find([('code', '=', 'USD')])
-    >>> if not currencies:
-    ...     currency = Currency(name='US Dollar', symbol='$', code='USD',
-    ...         rounding=Decimal('0.01'), mon_grouping='[]',
-    ...         mon_decimal_point='.')
-    ...     currency.save()
-    ...     CurrencyRate(date=today + relativedelta(month=1, day=1),
-    ...         rate=Decimal('1.0'), currency=currency).save()
-    ... else:
-    ...     currency, = currencies
-    >>> company.currency = currency
-    >>> company_config.execute('add')
-    >>> company, = Company.find()
+    >>> _ = create_company()
+    >>> company = get_company()
 
 Reload the context::
 
@@ -97,60 +79,16 @@ Create stock user::
 
 Create fiscal year::
 
-    >>> FiscalYear = Model.get('account.fiscalyear')
-    >>> Sequence = Model.get('ir.sequence')
-    >>> SequenceStrict = Model.get('ir.sequence.strict')
-    >>> fiscalyear = FiscalYear(name='%s' % today.year)
-    >>> fiscalyear.start_date = today + relativedelta(month=1, day=1)
-    >>> fiscalyear.end_date = today + relativedelta(month=12, day=31)
-    >>> fiscalyear.company = company
-    >>> post_move_sequence = Sequence(name='%s' % today.year,
-    ...     code='account.move',
-    ...     company=company)
-    >>> post_move_sequence.save()
-    >>> fiscalyear.post_move_sequence = post_move_sequence
-    >>> invoice_sequence = SequenceStrict(name='%s' % today.year,
-    ...     code='account.invoice',
-    ...     company=company)
-    >>> invoice_sequence.save()
-    >>> fiscalyear.out_invoice_sequence = invoice_sequence
-    >>> fiscalyear.in_invoice_sequence = invoice_sequence
-    >>> fiscalyear.out_credit_note_sequence = invoice_sequence
-    >>> fiscalyear.in_credit_note_sequence = invoice_sequence
-    >>> fiscalyear.save()
-    >>> FiscalYear.create_period([fiscalyear.id], config.context)
+    >>> fiscalyear = set_fiscalyear_invoice_sequences(
+    ...     create_fiscalyear(company))
+    >>> fiscalyear.click('create_period')
 
 Create chart of accounts::
 
-    >>> AccountTemplate = Model.get('account.account.template')
-    >>> Account = Model.get('account.account')
-    >>> AccountJournal = Model.get('account.journal')
-    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
-    >>> create_chart = Wizard('account.create_chart')
-    >>> create_chart.execute('account')
-    >>> create_chart.form.account_template = account_template
-    >>> create_chart.form.company = company
-    >>> create_chart.execute('create_account')
-    >>> receivable, = Account.find([
-    ...         ('kind', '=', 'receivable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> payable, = Account.find([
-    ...         ('kind', '=', 'payable'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> revenue, = Account.find([
-    ...         ('kind', '=', 'revenue'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> expense, = Account.find([
-    ...         ('kind', '=', 'expense'),
-    ...         ('company', '=', company.id),
-    ...         ])
-    >>> create_chart.form.account_receivable = receivable
-    >>> create_chart.form.account_payable = payable
-    >>> create_chart.execute('create_properties')
-    >>> stock_journal, = AccountJournal.find([('code', '=', 'STO')])
+    >>> _ = create_chart(company)
+    >>> accounts = get_accounts(company)
+    >>> revenue = accounts['revenue']
+    >>> expense = accounts['expense']
 
 Create parties::
 
@@ -191,33 +129,31 @@ Create product::
 
 Create payment term::
 
-    >>> PaymentTerm = Model.get('account.invoice.payment_term')
-    >>> PaymentTermLine = Model.get('account.invoice.payment_term.line')
-    >>> payment_term = PaymentTerm(name='Direct')
-    >>> payment_term_line = PaymentTermLine(type='remainder', days=0)
-    >>> payment_term.lines.append(payment_term_line)
+    >>> payment_term = create_payment_term()
     >>> payment_term.save()
 
 Sale 250 products::
 
     >>> config.user = sale_user.id
     >>> Sale = Model.get('sale.sale')
-    >>> SaleLine = Model.get('sale.line')
     >>> sale = Sale()
     >>> sale.party = customer
     >>> sale.payment_term = payment_term
-    >>> sale_line = SaleLine()
-    >>> sale.lines.append(sale_line)
+    >>> sale_line = sale.lines.new()
     >>> sale_line.product = product
     >>> sale_line.quantity = 250
-    >>> sale.save()
-    >>> Sale.quote([sale.id], config.context)
-    >>> Sale.confirm([sale.id], config.context)
-    >>> Sale.process([sale.id], config.context)
+    >>> sale.click('quote')
+    >>> sale.click('confirm')
+    >>> sale.click('process')
     >>> sale.state
     u'processing'
-    >>> sale.shipments
-    []
+    >>> shipment, = sale.shipments
+    >>> move, = shipment.outgoing_moves
+    >>> move.state
+    u'staging'
+    >>> move, = shipment.inventory_moves
+    >>> move.state
+    u'staging'
 
 Delete Purchase Request::
 
@@ -252,6 +188,12 @@ Create Purchase from Request::
     >>> config.user = sale_user.id
     >>> sale.reload()
     >>> shipment, = sale.shipments
+    >>> move, = shipment.outgoing_moves
+    >>> move.state
+    u'draft'
+    >>> move, = shipment.inventory_moves
+    >>> move.state
+    u'draft'
 
 Receive 100 products::
 
@@ -262,9 +204,8 @@ Receive 100 products::
     >>> move, = shipment.incoming_moves.find()
     >>> shipment.incoming_moves.append(move)
     >>> move.quantity = 100
-    >>> shipment.save()
-    >>> ShipmentIn.receive([shipment.id], config.context)
-    >>> ShipmentIn.done([shipment.id], config.context)
+    >>> shipment.click('receive')
+    >>> shipment.click('done')
     >>> shipment.state
     u'done'
     >>> config.user = sale_user.id
@@ -302,7 +243,6 @@ not create a new purchase request::
 
     >>> config.user = sale_user.id
     >>> Sale = Model.get('sale.sale')
-    >>> SaleLine = Model.get('sale.line')
     >>> sale = Sale()
     >>> sale.party = customer
     >>> sale.payment_term = payment_term
@@ -317,7 +257,6 @@ not create a new purchase request::
     >>> shipment, = sale.shipments
     >>> config.user = stock_user.id
     >>> Inventory = Model.get('stock.inventory')
-    >>> InventoryLine = Model.get('stock.inventory.line')
     >>> Location = Model.get('stock.location')
     >>> storage, = Location.find([
     ...         ('code', '=', 'STO'),
@@ -333,10 +272,9 @@ not create a new purchase request::
     >>> inventory.click('confirm')
     >>> inventory.state
     u'done'
-    >>> ShipmentOut = Model.get('stock.shipment.out')
-    >>> ShipmentOut.assign_try([shipment.id], config.context)
+    >>> shipment.click('assign_try')
     True
-    >>> ShipmentOut.pack([shipment.id], config.context)
+    >>> shipment.click('pack')
 
     >>> config.user = admin_user.id
     >>> changing_template.supply_on_sale = True
diff --git a/tests/test_sale_supply.py b/tests/test_sale_supply.py
index 66164f4..d136f10 100644
--- a/tests/test_sale_supply.py
+++ b/tests/test_sale_supply.py
@@ -1,25 +1,15 @@
-#This file is part of Tryton.  The COPYRIGHT file at the top level of
-#this repository contains the full copyright notices and license terms.
+# This file is part of Tryton.  The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
 import unittest
 import doctest
 import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import ModuleTestCase
 from trytond.tests.test_tryton import doctest_setup, doctest_teardown
 
 
-class SaleSupplyTestCase(unittest.TestCase):
+class SaleSupplyTestCase(ModuleTestCase):
     'Test SaleSupply module'
-
-    def setUp(self):
-        trytond.tests.test_tryton.install_module('sale_supply')
-
-    def test0005views(self):
-        'Test views'
-        test_view('sale_supply')
-
-    def test0006depends(self):
-        'Test depends'
-        test_depends()
+    module = 'sale_supply'
 
 
 def suite():
diff --git a/tryton.cfg b/tryton.cfg
index 847c2a1..063c58d 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.4.1
+version=3.6.0
 depends:
     ir
     purchase
diff --git a/trytond_sale_supply.egg-info/PKG-INFO b/trytond_sale_supply.egg-info/PKG-INFO
index db11ad1..18ccedc 100644
--- a/trytond_sale_supply.egg-info/PKG-INFO
+++ b/trytond_sale_supply.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-sale-supply
-Version: 3.4.1
+Version: 3.6.0
 Summary: Tryton module for sale supply
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/3.4/
+Download-URL: http://downloads.tryton.org/3.6/
 Description: sale_supply
         ===========
         
@@ -64,5 +64,7 @@ Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
 Classifier: Topic :: Office/Business :: Financial :: Accounting
diff --git a/trytond_sale_supply.egg-info/requires.txt b/trytond_sale_supply.egg-info/requires.txt
index 3b66806..0ee268a 100644
--- a/trytond_sale_supply.egg-info/requires.txt
+++ b/trytond_sale_supply.egg-info/requires.txt
@@ -1,5 +1,5 @@
-trytond_purchase >= 3.4, < 3.5
-trytond_sale >= 3.4, < 3.5
-trytond_stock >= 3.4, < 3.5
-trytond_stock_supply >= 3.4, < 3.5
-trytond >= 3.4, < 3.5
\ No newline at end of file
+trytond_purchase >= 3.6, < 3.7
+trytond_sale >= 3.6, < 3.7
+trytond_stock >= 3.6, < 3.7
+trytond_stock_supply >= 3.6, < 3.7
+trytond >= 3.6, < 3.7
\ No newline at end of file
-- 
tryton-modules-sale-supply



More information about the tryton-debian-vcs mailing list