of course that helps a lot…if you know where to find it…
but i was thinking much more of someting like that
from proteus import config, Model, Wizard, Report
my_config = config.set_trytond('postgresql:///tryton',config_file='/etc/tryton/trytond.conf')
^^^^^^^^^^^^ tryton is the database name ^^^^^^^^^^^
##### the models you need #
Sale= Model.get('sale.sale')
PaymentMethod = Model.get('account.invoice.payment.method')
##### let's confirm the sale #####
sale=Sale(2057) # << number of the sale
sale.click('quote') #
sale.click('confirm') # << you __must__ quote before confirm
# now an invoice and a shipment is create #
# let's post the invoice done from the sale
[inv.click('post') for inv in sale.invoices]
# let's do the shipment
[ship.click('assign_force') for ship in sale.shipments] # you want to bypass the vérifications
[ship.click('pick') for ship in sale.shipments]
[ship.click('pack') for ship in sale.shipments]
[ship.click('done') for ship in sale.shipments # << you need (???) to get all theses steps
# now le'ts pay the invoice
for inv in sale.invoices :
with my_config.set_context(active_id=inv.id):
pay_invoice = Wizard("account.invoice.pay", context=my_config.context, models=[inv])
pay_invoice.form.date = inv.invoice_date
pay_invoice.form.description = 'Paiment invoice '+inv.number
pay_invoice.form.payment_method = PaymentMethod.find([('name', '=', 'cheque')], limit=1)[0] # << 'cheque' is the name of the paiement method i choose.
pay_invoice.execute('choice') # << all is done.
i get the help of this post
i get the suggestion of @ced about using .click() and i find here
openerp2tryton: d646f462dc07 (line 97) how to use that.
i am not satisfied with PaymentMethod.find([(‘name’, ‘=’, ‘cheque’)], limit=1)[0] but it works…
maybe that it is too “specific” to be of some utility for some, but i do think that it could help some people.