[tryton-debian-vcs] tryton-modules-sale-supply branch upstream updated. upstream/3.2.0-1-g82a43f0
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Thu Oct 23 12:18:17 UTC 2014
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.2.0-1-g82a43f0
commit 82a43f0ccf872845fe11fbe134f3a8d790f1d97c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Oct 21 11:29:21 2014 +0200
Adding upstream version 3.4.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index aeba0cd..7405999 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.4.0 - 2014-10-20
+* Bug fixes (see mercurial logs for details)
+
Version 3.2.0 - 2014-04-21
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 2ed73db..ce30900 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_sale_supply
-Version: 3.2.0
+Version: 3.4.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.2/
+Download-URL: http://downloads.tryton.org/3.4/
Description: sale_supply
===========
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 0f44502..0b6b981 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Estat de la sol·licitud de compra"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Sol·licituds de compra"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 5be40ce..b3ce7d3 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:product.template,supply_on_sale:"
msgid "Supply On Sale"
-msgstr "Lieferung bei Verkauf"
+msgstr "Beschaffung bei Verkauf"
msgctxt "field:sale.line,purchase_request:"
msgid "Purchase Request"
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Bestellvorschlag Status"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Bestellvorschläge"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/locale/es_AR.po b/locale/es_AR.po
index ab15ef5..2867427 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Estado de solicitud de compra"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Solicitudes de compra"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/locale/es_CO.po b/locale/es_CO.po
index fca375e..43a5a71 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Estado de Orden de Compra"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Ordenes de Compra"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/locale/es_CO.po b/locale/es_EC.po
similarity index 78%
copy from locale/es_CO.po
copy to locale/es_EC.po
index fca375e..b0767be 100644
--- a/locale/es_CO.po
+++ b/locale/es_EC.po
@@ -8,11 +8,15 @@ msgstr "Provisión en Venta"
msgctxt "field:sale.line,purchase_request:"
msgid "Purchase Request"
-msgstr "Orden de Compra"
+msgstr "Solicitud de Compra"
msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
-msgstr "Estado de Orden de Compra"
+msgstr "Estado de Solicitud de Compra"
+
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Solicitudes de Compra"
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
diff --git a/locale/es_ES.po b/locale/es_ES.po
index ab15ef5..2867427 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Estado de solicitud de compra"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Solicitudes de compra"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 3f7b9a8..720ec70 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -12,7 +12,11 @@ msgstr "Demande d'achat"
msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
-msgstr "Etat demande d'achat"
+msgstr "État demande d'achat"
+
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Demandes d'achat"
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 2c7cfeb..e9b6173 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -14,6 +14,10 @@ msgctxt "field:sale.line,purchase_request_state:"
msgid "Purchase Request State"
msgstr "Stanje nabavnega zahtevka"
+msgctxt "model:ir.action,name:act_purchase_request_form"
+msgid "Purchase Requests"
+msgstr "Nabavni zahtevki"
+
msgctxt "selection:sale.line,purchase_request_state:"
msgid ""
msgstr ""
diff --git a/purchase.py b/purchase.py
index 11f1a12..8228328 100644
--- a/purchase.py
+++ b/purchase.py
@@ -5,6 +5,7 @@ from itertools import chain
from trytond.model import ModelView, Workflow
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
+from trytond.tools import grouped_slice
__all__ = ['PurchaseRequest', 'Purchase']
__metaclass__ = PoolMeta
@@ -14,29 +15,21 @@ class PurchaseRequest:
__name__ = 'purchase.request'
@classmethod
- def origin_get(cls):
- Model = Pool().get('ir.model')
- result = super(PurchaseRequest, cls).origin_get()
- model, = Model.search([
- ('model', '=', 'sale.sale'),
- ])
- result.append([model.model, model.name])
- return result
+ def _get_origin(cls):
+ return super(PurchaseRequest, cls)._get_origin() | {'sale.sale'}
@classmethod
def delete(cls, requests):
pool = Pool()
Sale = pool.get('sale.sale')
SaleLine = pool.get('sale.line')
- cursor = Transaction().cursor
sale_ids = list(set(r.origin.id for r in requests
if isinstance(r.origin, Sale)))
- with Transaction().set_user(0, set_context=True):
+ with Transaction().set_context(_check_access=False):
sale_lines = []
- for i in range(0, len(requests), cursor.IN_MAX):
- sub_requests = requests[i:i + cursor.IN_MAX]
+ for sub_requests in grouped_slice(requests):
sale_lines.append(SaleLine.search([
('purchase_request', 'in',
[r.id for r in sub_requests]),
@@ -50,7 +43,7 @@ class PurchaseRequest:
super(PurchaseRequest, cls).delete(requests)
if sale_ids:
- with Transaction().set_user(0, set_context=True):
+ with Transaction().set_context(_check_access=False):
Sale.process(Sale.browse(sale_ids))
@@ -62,35 +55,25 @@ class Purchase:
pool = Pool()
Request = pool.get('purchase.request')
Sale = pool.get('sale.sale')
- cursor = Transaction().cursor
requests = []
- for i in range(0, len(purchases), cursor.IN_MAX):
- purchase_ids = [p.id for p in purchases[i:i + cursor.IN_MAX]]
+ for sub_purchases in grouped_slice(purchases):
requests.append(Request.search([
- ('purchase_line.purchase.id', 'in', purchase_ids),
+ ('purchase_line.purchase.id', 'in',
+ [x.id for x in sub_purchases]),
('origin', 'like', 'sale.sale,%'),
]))
requests = list(chain(*requests))
if requests:
sale_ids = list(set(req.origin.id for req in requests))
- with Transaction().set_user(0, set_context=True):
- Sale.process(Sale.browse(sale_ids))
+ Sale.process(Sale.browse(sale_ids))
@classmethod
@ModelView.button
- @Workflow.transition('confirmed')
- def confirm(cls, purchases):
- super(Purchase, cls).confirm(purchases)
- cls._sale_supply_process(purchases)
-
- @classmethod
def process(cls, purchases):
super(Purchase, cls).process(purchases)
- # If not yet confirmed, it will be processed by confirm
- if any(p.state == 'confirmed' for p in purchases):
- cls._sale_supply_process(purchases)
+ cls._sale_supply_process(purchases)
@classmethod
@ModelView.button
diff --git a/sale.py b/sale.py
index a74f744..ea763ff 100644
--- a/sale.py
+++ b/sale.py
@@ -53,21 +53,17 @@ class SaleLine:
'invisible': ~Eval('purchase_request_state'),
}), 'get_purchase_request_state')
- @classmethod
- def get_purchase_request_state(cls, lines, name):
- states = dict((l.id, '') for l in lines)
- with Transaction().set_user(0, set_context=True):
- for line in cls.browse(states.keys()):
- if line.purchase_request is not None:
- states[line.id] = 'requested'
- purchase_line = line.purchase_request.purchase_line
- if purchase_line is not None:
- purchase = purchase_line.purchase
- if purchase.state == 'cancel':
- states[line.id] = 'cancel'
- elif purchase.state in ('confirmed', 'done'):
- states[line.id] = 'purchased'
- return states
+ def get_purchase_request_state(self, name):
+ if self.purchase_request is not None:
+ purchase_line = self.purchase_request.purchase_line
+ if purchase_line is not None:
+ purchase = purchase_line.purchase
+ if purchase.state == 'cancel':
+ return 'cancel'
+ elif purchase.state in ('processing', 'done'):
+ return 'purchased'
+ return 'requested'
+ return ''
@classmethod
def copy(cls, lines, default=None):
@@ -111,20 +107,19 @@ class SaleLine:
self.delivery_date)
uom = product.purchase_uom or product.default_uom
quantity = Uom.compute_qty(self.unit, self.quantity, uom)
- with Transaction().set_user(0, set_context=True):
- return Request(
- product=product,
- party=supplier,
- quantity=quantity,
- uom=uom,
- computed_quantity=quantity,
- computed_uom=uom,
- purchase_date=purchase_date,
- supply_date=self.delivery_date,
- company=self.sale.company,
- warehouse=self.warehouse,
- origin=self.sale,
- )
+ return Request(
+ product=product,
+ party=supplier,
+ quantity=quantity,
+ uom=uom,
+ computed_quantity=quantity,
+ computed_uom=uom,
+ purchase_date=purchase_date,
+ supply_date=self.delivery_date,
+ company=self.sale.company,
+ warehouse=self.warehouse,
+ origin=self.sale,
+ )
def assign_supplied(self, location_quantities):
'''
diff --git a/sale.xml b/sale.xml
index 5068a77..0895dde 100644
--- a/sale.xml
+++ b/sale.xml
@@ -8,5 +8,27 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="sale.sale_line_view_form"/>
<field name="name">sale_line_form</field>
</record>
+
+ <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>
+ </record>
+ <record model="ir.action.keyword"
+ id="act_open_purchase_request_keyword">
+ <field name="keyword">form_relate</field>
+ <field name="model">sale.sale,-1</field>
+ <field name="action" ref="act_purchase_request_form"/>
+ </record>
+ <record model="ir.action-res.group"
+ id="action_purchase_request_group_purchase_request">
+ <field name="action" ref="act_purchase_request_form"/>
+ <field name="group" ref="stock_supply.group_purchase_request"/>
+ </record>
+ <record model="ir.action-res.group"
+ id="action_purchase_request_group_purchase">
+ <field name="action" ref="act_purchase_request_form"/>
+ <field name="group" ref="purchase.group_purchase"/>
+ </record>
</data>
</tryton>
diff --git a/stock.py b/stock.py
index d3f3e29..dc1f8eb 100644
--- a/stock.py
+++ b/stock.py
@@ -21,19 +21,18 @@ class ShipmentIn:
super(ShipmentIn, cls).done(shipments)
# Assigned sale move lines
- with Transaction().set_user(0, set_context=True):
- for shipment in shipments:
- move_ids = [x.id for x in shipment.incoming_moves]
- sale_lines = SaleLine.search([
- ('purchase_request.purchase_line.moves',
- 'in', move_ids),
- ('purchase_request.origin', 'like', 'sale.sale,%'),
- ])
- pbl = {}
- for move in shipment.inventory_moves:
- pbl.setdefault(move.product, {}).setdefault(
- move.to_location, 0.0)
- pbl[move.product][move.to_location] += \
- move.internal_quantity
- for sale_line in sale_lines:
- sale_line.assign_supplied(pbl[sale_line.product])
+ for shipment in shipments:
+ move_ids = [x.id for x in shipment.incoming_moves]
+ sale_lines = SaleLine.search([
+ ('purchase_request.purchase_line.moves',
+ 'in', move_ids),
+ ('purchase_request.origin', 'like', 'sale.sale,%'),
+ ])
+ pbl = {}
+ for move in shipment.inventory_moves:
+ pbl.setdefault(move.product, {}).setdefault(
+ move.to_location, 0.0)
+ pbl[move.product][move.to_location] += \
+ move.internal_quantity
+ for sale_line in sale_lines:
+ sale_line.assign_supplied(pbl[sale_line.product])
diff --git a/tests/scenario_sale_supply.rst b/tests/scenario_sale_supply.rst
index 7749d05..5a13bdd 100644
--- a/tests/scenario_sale_supply.rst
+++ b/tests/scenario_sale_supply.rst
@@ -17,6 +17,7 @@ Imports::
Create database::
>>> config = config.set_trytond()
+ >>> config.pool.test = True
Install sale_supply, sale, purchase::
@@ -241,13 +242,13 @@ Create Purchase from Request::
... [purchase_request])
>>> create_purchase.form.party = supplier
>>> create_purchase.execute('start')
- >>> create_purchase.form.payment_term = payment_term
- >>> create_purchase.execute('start')
>>> purchase, = Purchase.find()
- >>> Purchase.quote([purchase.id], config.context)
- >>> Purchase.confirm([purchase.id], config.context)
+ >>> purchase.payment_term = payment_term
+ >>> purchase.click('quote')
+ >>> purchase.click('confirm')
+ >>> purchase.click('process')
>>> purchase.state
- u'confirmed'
+ u'processing'
>>> config.user = sale_user.id
>>> sale.reload()
>>> shipment, = sale.shipments
diff --git a/tests/test_sale_supply.py b/tests/test_sale_supply.py
index 31882f3..66164f4 100644
--- a/tests/test_sale_supply.py
+++ b/tests/test_sale_supply.py
@@ -3,7 +3,8 @@
import unittest
import doctest
import trytond.tests.test_tryton
-from trytond.tests.test_tryton import test_view, test_depends, doctest_dropdb
+from trytond.tests.test_tryton import test_view, test_depends
+from trytond.tests.test_tryton import doctest_setup, doctest_teardown
class SaleSupplyTestCase(unittest.TestCase):
@@ -26,6 +27,6 @@ def suite():
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
SaleSupplyTestCase))
suite.addTests(doctest.DocFileSuite('scenario_sale_supply.rst',
- setUp=doctest_dropdb, tearDown=doctest_dropdb, encoding='utf-8',
+ setUp=doctest_setup, tearDown=doctest_teardown, encoding='utf-8',
optionflags=doctest.REPORT_ONLY_FIRST_FAILURE))
return suite
diff --git a/tryton.cfg b/tryton.cfg
index 39c40ee..043f471 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.2.0
+version=3.4.0
depends:
ir
purchase
diff --git a/trytond_sale_supply.egg-info/PKG-INFO b/trytond_sale_supply.egg-info/PKG-INFO
index 5b62bea..dcbd452 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.2.0
+Version: 3.4.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.2/
+Download-URL: http://downloads.tryton.org/3.4/
Description: sale_supply
===========
diff --git a/trytond_sale_supply.egg-info/SOURCES.txt b/trytond_sale_supply.egg-info/SOURCES.txt
index aeab9f5..8b57ed7 100644
--- a/trytond_sale_supply.egg-info/SOURCES.txt
+++ b/trytond_sale_supply.egg-info/SOURCES.txt
@@ -10,16 +10,31 @@ setup.py
tryton.cfg
./__init__.py
./product.py
+./product.xml
./purchase.py
./sale.py
+./sale.xml
./stock.py
+./tryton.cfg
+./locale/ca_ES.po
+./locale/de_DE.po
+./locale/es_AR.po
+./locale/es_CO.po
+./locale/es_EC.po
+./locale/es_ES.po
+./locale/fr_FR.po
+./locale/sl_SI.po
./tests/__init__.py
+./tests/scenario_sale_supply.rst
./tests/test_sale_supply.py
+./view/sale_line_form.xml
+./view/template_form.xml
doc/index.rst
locale/ca_ES.po
locale/de_DE.po
locale/es_AR.po
locale/es_CO.po
+locale/es_EC.po
locale/es_ES.po
locale/fr_FR.po
locale/sl_SI.po
diff --git a/trytond_sale_supply.egg-info/requires.txt b/trytond_sale_supply.egg-info/requires.txt
index cb9d8fa..3b66806 100644
--- a/trytond_sale_supply.egg-info/requires.txt
+++ b/trytond_sale_supply.egg-info/requires.txt
@@ -1,5 +1,5 @@
-trytond_purchase >= 3.2, < 3.3
-trytond_sale >= 3.2, < 3.3
-trytond_stock >= 3.2, < 3.3
-trytond_stock_supply >= 3.2, < 3.3
-trytond >= 3.2, < 3.3
\ No newline at end of file
+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
--
tryton-modules-sale-supply
More information about the tryton-debian-vcs
mailing list