Migrate to 6.0

This commit is contained in:
José Miguel Pardo Salar 2021-10-11 19:26:39 +02:00
parent b2cd29fa0a
commit 9ec5f6d70f
5 changed files with 16 additions and 13 deletions

View File

@ -2,7 +2,7 @@
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:sale.line.quick_action:"
msgctxt "model:ir.message,text:msg_wrong_state"
msgid "Sale must be in Draft state."
msgstr "Venta debe estar en estado Borrador."

10
message.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tryton>
<data grouped="1">
<record model="ir.message" id="msg_wrong_state">
<field name="text">Sale must be in Draft state.</field>
</record>
</data>
</tryton>

15
sale.py
View File

@ -5,9 +5,8 @@ from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.wizard import Wizard, StateTransition, StateView, Button
__all__ = ['SaleLine', 'SaleLineQuickAction', 'SaleLineQuickActionSplit',
'SaleLineQuickActionMove', 'SaleLineQuickActionDuplicate']
from trytond.exceptions import UserError
from trytond.i18n import gettext
class SaleLine(metaclass=PoolMeta):
@ -166,20 +165,14 @@ class SaleLineQuickAction(Wizard):
)
do_move = StateTransition()
@classmethod
def __setup__(cls):
super().__setup__()
cls._error_messages.update({
'wrong_state': 'Sale must be in Draft state.'
})
def transition_start(self):
pool = Pool()
SaleLine = pool.get('sale.line')
records = SaleLine.browse(Transaction().context['active_ids'])
if any(r.sale_state != 'draft' for r in records):
self.raise_user_error('wrong_state')
raise UserError(gettext(
'sale_line_quick_actions.msg_wrong_state'))
action_id = Transaction().context['action_id']
return self._get_action_state()[action_id]

View File

@ -89,7 +89,6 @@ Create product::
>>> template.name = 'product'
>>> template.default_uom = unit
>>> template.type = 'goods'
>>> template.purchasable = True
>>> template.salable = True
>>> template.list_price = Decimal('10')
>>> template.account_category = account_category_tax

View File

@ -7,3 +7,4 @@ depends:
xml:
sale.xml
message.xml