changeset b04b27124ad0 in modules/account_stock_continental:default
details: 
https://hg.tryton.org/modules/account_stock_continental?cmd=changeset;node=b04b27124ad0
description:
        Replace 'Update Cost Price' by 'Modify Cost Price'

        issue7903
        review271541002
diffstat:

 CHANGELOG                                    |   2 +
 __init__.py                                  |   6 +-
 exceptions.py                                |   2 +-
 message.xml                                  |   6 +-
 product.py                                   |  44 ++++++++++++++--------------
 product.xml                                  |  26 ++++++++--------
 tests/scenario_account_stock_continental.rst |  17 ++++++++++
 view/modify_cost_price_ask_form.xml          |  15 +++++++++
 view/modify_cost_price_show_move_form.xml    |  18 +++++++++++
 view/update_cost_price_ask_form.xml          |  15 ---------
 view/update_cost_price_show_move_form.xml    |  18 -----------
 11 files changed, 94 insertions(+), 75 deletions(-)

diffs (309 lines):

diff -r f6fc247bac8a -r b04b27124ad0 CHANGELOG
--- a/CHANGELOG Mon May 06 14:59:07 2019 +0200
+++ b/CHANGELOG Mon Jul 08 18:35:57 2019 +0200
@@ -1,3 +1,5 @@
+* Replace 'Update Cost Price' by 'Modify Cost Price'
+
 Version 5.2.0 - 2019-05-06
 * Bug fixes (see mercurial logs for details)
 * Enforce balance and income statement on stock accounts
diff -r f6fc247bac8a -r b04b27124ad0 __init__.py
--- a/__init__.py       Mon May 06 14:59:07 2019 +0200
+++ b/__init__.py       Mon Jul 08 18:35:57 2019 +0200
@@ -19,9 +19,9 @@
         account.ConfigurationCostPriceCounterpartAccount,
         account.FiscalYear,
         account.AccountMove,
-        product.UpdateCostPriceAsk,
-        product.UpdateCostPriceShowMove,
+        product.ModifyCostPriceAsk,
+        product.ModifyCostPriceShowMove,
         module='account_stock_continental', type_='model')
     Pool.register(
-        product.UpdateCostPrice,
+        product.ModifyCostPrice,
         module='account_stock_continental', type_='wizard')
diff -r f6fc247bac8a -r b04b27124ad0 exceptions.py
--- a/exceptions.py     Mon May 06 14:59:07 2019 +0200
+++ b/exceptions.py     Mon Jul 08 18:35:57 2019 +0200
@@ -4,5 +4,5 @@
 from trytond.exceptions import UserError
 
 
-class UpdateCostPriceError(UserError):
+class ModifyCostPriceError(UserError):
     pass
diff -r f6fc247bac8a -r b04b27124ad0 message.xml
--- a/message.xml       Mon May 06 14:59:07 2019 +0200
+++ b/message.xml       Mon Jul 08 18:35:57 2019 +0200
@@ -5,10 +5,10 @@
     <data group="1">
         <record model="ir.message" id="msg_product_change_cost_price">
             <field name="text">You cannot change the cost price of a product 
which is associated to stock moves.
-You must use the "Update Cost Price" wizard.</field>
+You must use the "Modify Cost Price" wizard.</field>
         </record>
-        <record model="ir.message" id="msg_update_cost_price_same_account">
-            <field name="text">To update cost price, you must change the 
counterpart account "%(account)s".</field>
+        <record model="ir.message" id="msg_modify_cost_price_same_account">
+            <field name="text">To modify the cost price, you must change the 
counterpart account "%(account)s".</field>
         </record>
     </data>
 </tryton>
diff -r f6fc247bac8a -r b04b27124ad0 product.py
--- a/product.py        Mon May 06 14:59:07 2019 +0200
+++ b/product.py        Mon Jul 08 18:35:57 2019 +0200
@@ -13,11 +13,11 @@
 from trytond.modules.account_product.product import (
     account_used, template_property)
 from trytond.modules.product import price_digits
-from .exceptions import UpdateCostPriceError
+from .exceptions import ModifyCostPriceError
 
 __all__ = ['Category', 'CategoryAccount', 'Template',
-    'Product', 'UpdateCostPriceAsk',
-    'UpdateCostPriceShowMove', 'UpdateCostPrice']
+    'Product', 'ModifyCostPriceAsk',
+    'ModifyCostPriceShowMove', 'ModifyCostPrice']
 account_names = [
     'account_stock', 'account_stock_supplier', 'account_stock_customer',
     'account_stock_production', 'account_stock_lost_found']
@@ -233,9 +233,9 @@
         'account_stock_lost_found_used')
 
 
-class UpdateCostPriceAsk(ModelView):
-    'Update Cost Price Ask'
-    __name__ = 'product.update_cost_price.ask'
+class ModifyCostPriceAsk(ModelView):
+    'Modify Cost Price Ask'
+    __name__ = 'product.modify_cost_price.ask'
     template = fields.Many2One('product.template', 'Product', readonly=True,
         states={
             'invisible': ~Eval('template'),
@@ -248,9 +248,9 @@
         digits=price_digits)
 
 
-class UpdateCostPriceShowMove(ModelView):
-    'Update Cost Price Show Move'
-    __name__ = 'product.update_cost_price.show_move'
+class ModifyCostPriceShowMove(ModelView):
+    'Modify Cost Price Show Move'
+    __name__ = 'product.modify_cost_price.show_move'
     price_difference = fields.Numeric('Price Difference', readonly=True,
         digits=price_digits)
     amount = fields.Numeric('Amount', readonly=True,
@@ -270,23 +270,23 @@
     description = fields.Char('Description')
 
 
-class UpdateCostPrice(Wizard):
-    'Update Cost Price'
-    __name__ = 'product.update_cost_price'
+class ModifyCostPrice(Wizard):
+    'Modify Cost Price'
+    __name__ = 'product.modify_cost_price'
     start_state = 'ask_price'
-    ask_price = StateView('product.update_cost_price.ask',
-        'account_stock_continental.update_cost_price_ask_form', [
+    ask_price = StateView('product.modify_cost_price.ask',
+        'account_stock_continental.modify_cost_price_ask_form', [
             Button('Cancel', 'end', 'tryton-cancel'),
             Button('OK', 'should_show_move', 'tryton-forward', default=True),
             ])
     should_show_move = StateTransition()
-    show_move = StateView('product.update_cost_price.show_move',
-        'account_stock_continental.update_cost_price_show_move_form', [
+    show_move = StateView('product.modify_cost_price.show_move',
+        'account_stock_continental.modify_cost_price_show_move_form', [
             Button('Cancel', 'end', 'tryton-cancel'),
             Button('OK', 'create_move', 'tryton-ok', default=True),
             ])
     create_move = StateTransition()
-    update_price = StateTransition()
+    modify_price = StateTransition()
 
     def default_ask_price(self, fields):
         pool = Pool()
@@ -324,7 +324,7 @@
     def transition_should_show_move(self):
         if self.get_quantity() != 0:
             return 'show_move'
-        return 'update_price'
+        return 'modify_price'
 
     def default_show_move(self, fields):
         pool = Pool()
@@ -388,16 +388,16 @@
         Move = Pool().get('account.move')
 
         if self.show_move.counterpart == self.show_move.stock_account:
-            raise UpdateCostPriceError(
+            raise ModifyCostPriceError(
                 gettext('account_stock_continental'
-                    '.msg_update_cost_price_same_account',
+                    '.msg_modify_cost_price_same_account',
                     account=self.show_move.counterpart.rec_name))
         move = self.get_move()
         move.save()
         Move.post([move])
-        return 'update_price'
+        return 'modify_price'
 
-    def transition_update_price(self):
+    def transition_modify_price(self):
         self.ask_price.product.set_multivalue(
             'cost_price', self.ask_price.cost_price)
         return 'end'
diff -r f6fc247bac8a -r b04b27124ad0 product.xml
--- a/product.xml       Mon May 06 14:59:07 2019 +0200
+++ b/product.xml       Mon Jul 08 18:35:57 2019 +0200
@@ -3,28 +3,28 @@
 this repository contains the full copyright notices and license terms. -->
 <tryton>
     <data>
-        <record model="ir.ui.view" id="update_cost_price_ask_form">
-            <field name="model">product.update_cost_price.ask</field>
+        <record model="ir.ui.view" id="modify_cost_price_ask_form">
+            <field name="model">product.modify_cost_price.ask</field>
             <field name="type">form</field>
-            <field name="name">update_cost_price_ask_form</field>
+            <field name="name">modify_cost_price_ask_form</field>
         </record>
-        <record model="ir.ui.view" id="update_cost_price_show_move_form">
-            <field name="model">product.update_cost_price.show_move</field>
+        <record model="ir.ui.view" id="modify_cost_price_show_move_form">
+            <field name="model">product.modify_cost_price.show_move</field>
             <field name="type">form</field>
-            <field name="name">update_cost_price_show_move_form</field>
+            <field name="name">modify_cost_price_show_move_form</field>
         </record>
-        <record model="ir.action.wizard" id="wizard_update_cost_price">
-            <field name="name">Update Cost Price</field>
-            <field name="wiz_name">product.update_cost_price</field>
+        <record model="ir.action.wizard" id="wizard_modify_cost_price">
+            <field name="name">Modify Cost Price</field>
+            <field name="wiz_name">product.modify_cost_price</field>
         </record>
-        <record model="ir.action.keyword" 
id="update_cost_price_product_keyword">
+        <record model="ir.action.keyword" 
id="modify_cost_price_product_keyword">
             <field name="keyword">form_action</field>
             <field name="model">product.product,-1</field>
-            <field name="action" ref="wizard_update_cost_price"/>
+            <field name="action" ref="wizard_modify_cost_price"/>
         </record>
         <record model="ir.action-res.group"
-            id="wizard_update_cost_price-group_account">
-            <field name="action" ref="wizard_update_cost_price"/>
+            id="wizard_modify_cost_price-group_account">
+            <field name="action" ref="wizard_modify_cost_price"/>
             <field name="group" ref="account.group_account" />
         </record>
 
diff -r f6fc247bac8a -r b04b27124ad0 
tests/scenario_account_stock_continental.rst
--- a/tests/scenario_account_stock_continental.rst      Mon May 06 14:59:07 
2019 +0200
+++ b/tests/scenario_account_stock_continental.rst      Mon Jul 08 18:35:57 
2019 +0200
@@ -375,3 +375,20 @@
     Decimal('66.00')
     >>> stock_customer.credit
     Decimal('0.00')
+
+Modify cost price::
+    >>> Account = Model.get('account.account')
+    >>> counterpart, = Account.find([('name', '=', 'Stock Lost and Found')])
+    >>> modify_price = Wizard('product.modify_cost_price', [product])
+    >>> modify_price.form.cost_price = Decimal('3.00')
+    >>> modify_price.execute('should_show_move')
+    >>> modify_price.form.description = 'Change product cost price.'
+    >>> modify_price.form.counterpart = counterpart
+    >>> modify_price.execute('create_move')
+    >>> product.cost_price
+    Decimal('3.00')
+    >>> stock_lost_found.reload()
+    >>> stock_lost_found.debit
+    Decimal('13.00')
+    >>> stock_lost_found.credit
+    Decimal('0.00')
diff -r f6fc247bac8a -r b04b27124ad0 view/modify_cost_price_ask_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/modify_cost_price_ask_form.xml       Mon Jul 08 18:35:57 2019 +0200
@@ -0,0 +1,15 @@
+<?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 cursor="cost_price">
+    <group id="label_product_template" col="1" xexpand="0">
+        <label name="template"/>
+        <label name="product"/>
+    </group>
+    <group id="product_template" col="1">
+        <field name="template"/>
+        <field name="product"/>
+    </group>
+    <label name="cost_price"/>
+    <field name="cost_price"/>
+</form>
diff -r f6fc247bac8a -r b04b27124ad0 view/modify_cost_price_show_move_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/modify_cost_price_show_move_form.xml Mon Jul 08 18:35:57 2019 +0200
@@ -0,0 +1,18 @@
+<?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>
+    <label name="description"/>
+    <field name="description" colspan="3"/>
+    <label name="journal"/>
+    <field name="journal"/>
+    <newline/>
+    <label name="amount"/>
+    <field name="amount"/>
+    <label name="price_difference"/>
+    <field name="price_difference"/>
+    <label name="stock_account"/>
+    <field name="stock_account"/>
+    <label name="counterpart"/>
+    <field name="counterpart"/>
+</form>
diff -r f6fc247bac8a -r b04b27124ad0 view/update_cost_price_ask_form.xml
--- a/view/update_cost_price_ask_form.xml       Mon May 06 14:59:07 2019 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-<?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 cursor="cost_price">
-    <group id="label_product_template" col="1" xexpand="0">
-        <label name="template"/>
-        <label name="product"/>
-    </group>
-    <group id="product_template" col="1">
-        <field name="template"/>
-        <field name="product"/>
-    </group>
-    <label name="cost_price"/>
-    <field name="cost_price"/>
-</form>
diff -r f6fc247bac8a -r b04b27124ad0 view/update_cost_price_show_move_form.xml
--- a/view/update_cost_price_show_move_form.xml Mon May 06 14:59:07 2019 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?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>
-    <label name="description"/>
-    <field name="description" colspan="3"/>
-    <label name="journal"/>
-    <field name="journal"/>
-    <newline/>
-    <label name="amount"/>
-    <field name="amount"/>
-    <label name="price_difference"/>
-    <field name="price_difference"/>
-    <label name="stock_account"/>
-    <field name="stock_account"/>
-    <label name="counterpart"/>
-    <field name="counterpart"/>
-</form>

Reply via email to