← Back to team overview

openerp-connector-community team mailing list archive

Re: Sync Invoice to Magento

 

On 01/10/2014 10:48 AM, jan-philipp.fischer@xxxxxxxxxxxxxx wrote:
Thanks, glad to hear it worked for you. Yes, it could be possible to
have these options in the payment method. I would seriously consider a
merge proposal for this improvement.

This would be so great. I think this would be a nice improvement for the
connector. Do you think it's much work there?

No, this change is light (most of the work is in the test):
1. add the same selection field than the store's one on payment.method (optional) 2. changing the line where the option is used [0] to look in the payment method's option, fall-backing to the store's one if empty
 3. add a test for that (already exist for the store's option)


Ok, Magento is definitely very special in some ways ;-) This was the
rationale to create the invoice on Magento only when it was paid on
OpenERP and not when it was validated by default.

You're right. I also do not understand why magento doesn't manage that.
It's a huge piece of software but that isn't done ;)
I've done some research there:
- If you look in Magento Backend at the Invoice Tab you cann see that
you can filter with 'Pending', 'Paid' and 'Canceled' but you can't give
any of these other two Status to the Invoice. Strange!
- If you look here [0] you can see at 'sales_order_invoice.capture' that
you can check the invoice at different Status.
- This is done in 'Mage_Sales_Model_Order_Invoice' referring to this
page [1].
- And if you look here [2] at the posts of 'tzyganu' you can see that it
is easily possible to arrange that Magento can handle it. It's only
setting something to True.
I've tested it, and it worked. But the connector won't set it in Magento
to paid then. I think because the connector only syncs invoices once,
right?

So do you think it is possible to do that over API with
'Mage_Sales_Model_Order_Invoice'? I can imagine.

Very interesting! Yes the connector only ask to create the invoice once.
If I understood right, Magento has internal methods to achieve that, but does not propose public methods in the API? In such case, we could add them to the PHP side of the connector (I don't have the knowledge to do that), then we would be able to adapt the connector (OpenERP side) to create once the invoice as "pending" and then mark it as paid when paid in OpenERP. I can't represent myself how much changes it need though.


Many thanks for your translation!

You're welcome!:)

Jan

> [0]: http://www.magentocommerce.com/wiki/doc/webservices-api/api
> /sales_order_invoice
> [1]: http://docs.magentocommerce.com/Mage_Sales
> /Mage_Sales_Model_Order_Invoice.html
> [2]: http://www.magentocommerce.com/boards/viewthread/54391/


Guewen

[0] http://bazaar.launchpad.net/~openerp-connector-core-editors/openerp-connector-magento/7.0/view/head:/magentoerpconnect/invoice.py#L225


References