mirror of
https://gitlab.com/datalifeit/trytond-carrier_load_done2running
synced 2023-12-14 04:42:57 +01:00
Migrate to 6.0
This commit is contained in:
parent
131bc27d7a
commit
c3584412cd
12
load.py
12
load.py
|
@ -4,6 +4,8 @@ from trytond.model import fields
|
|||
from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
|
||||
|
||||
class LoadOrder(metaclass=PoolMeta):
|
||||
|
@ -20,8 +22,6 @@ class LoadOrder(metaclass=PoolMeta):
|
|||
'depends': ['state']
|
||||
},
|
||||
})
|
||||
cls._error_messages.update({
|
||||
'sale_state': 'Cannot cancel Sale "%s" due to it is confirmed.'})
|
||||
|
||||
def _get_load_sale(self, Sale):
|
||||
number = None
|
||||
|
@ -70,9 +70,11 @@ class LoadOrder(metaclass=PoolMeta):
|
|||
to_run = [r for r in records if r.state == 'done']
|
||||
if to_run:
|
||||
for item in to_run:
|
||||
if (item.sale and item.sale.origin == item and
|
||||
item.sale.state not in ('draft', 'quotation')):
|
||||
cls.raise_user_error('sale_state', item.sale.rec_name)
|
||||
if (item.sale and item.sale.origin == item
|
||||
and item.sale.state not in ('draft', 'quotation')):
|
||||
raise UserError(gettext(
|
||||
'msg_carrier_load_order_sale_state',
|
||||
sale=item.sale.rec_name))
|
||||
|
||||
sales = [r.sale for r in to_run if r.sale and r.sale.origin and
|
||||
r.sale.origin.__name__ == 'carrier.load.order']
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "error:carrier.load.order:"
|
||||
msgid "Cannot cancel Sale \"%s\" due to it is confirmed."
|
||||
msgstr "No puede cancelar la Venta \"%s\" porque está confirmada."
|
||||
msgctxt "model:ir.message,text:msg_carrier_load_order_sale_state"
|
||||
msgid "Cannot cancel Sale \"%(sale)s\" due to it is confirmed."
|
||||
msgstr "No puede cancelar la Venta \"%(sale)s\" porque está confirmada."
|
||||
|
||||
msgctxt "model:res.group,name:group_force_undo_load"
|
||||
msgid "Force undo load"
|
||||
|
|
11
message.xml
Normal file
11
message.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?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">
|
||||
<!-- carrier.load.order -->
|
||||
<record model="ir.message" id="msg_carrier_load_order_sale_state">
|
||||
<field name="text">Cannot cancel Sale "%(sale)s" due to it is confirmed.</field>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -39,13 +39,6 @@ Create chart of accounts::
|
|||
>>> accounts = get_accounts(company)
|
||||
>>> revenue = accounts['revenue']
|
||||
>>> expense = accounts['expense']
|
||||
>>> cash = accounts['cash']
|
||||
|
||||
>>> Journal = Model.get('account.journal')
|
||||
>>> cash_journal, = Journal.find([('type', '=', 'cash')])
|
||||
>>> cash_journal.credit_account = cash
|
||||
>>> cash_journal.debit_account = cash
|
||||
>>> cash_journal.save()
|
||||
|
||||
Create tax::
|
||||
|
||||
|
@ -181,10 +174,10 @@ Add other products to unit load::
|
|||
>>> template.type = 'goods'
|
||||
>>> template.salable = True
|
||||
>>> template.list_price = Decimal('10')
|
||||
>>> template.cost_price = Decimal('5')
|
||||
>>> template.account_category = account_category_tax
|
||||
>>> template.save()
|
||||
>>> product.template = template
|
||||
>>> product, = template.products
|
||||
>>> product.cost_price = Decimal('5')
|
||||
>>> product.save()
|
||||
>>> move = ul.moves.new()
|
||||
>>> move.planned_date = today
|
||||
|
@ -193,6 +186,7 @@ Add other products to unit load::
|
|||
>>> move.from_location = ul.moves[0].from_location
|
||||
>>> move.to_location = ul.moves[0].to_location
|
||||
>>> move.currency = move.company.currency
|
||||
>>> move.unit_price = product.cost_price
|
||||
>>> ul.save()
|
||||
|
||||
Starting load wizard::
|
||||
|
@ -366,9 +360,9 @@ Undo Sale and Shipment::
|
|||
>>> order.click('run')
|
||||
>>> order.reload()
|
||||
>>> order.sale.state
|
||||
'cancel'
|
||||
'cancelled'
|
||||
>>> order.shipment.state
|
||||
'cancel'
|
||||
'cancelled'
|
||||
>>> not order.inventory_moves
|
||||
True
|
||||
>>> not order.outgoing_moves
|
||||
|
|
|
@ -8,3 +8,4 @@ depends:
|
|||
|
||||
xml:
|
||||
load.xml
|
||||
message.xml
|
||||
|
|
Loading…
Reference in a new issue