ODOO 8 : Why purchase receipt form doesn't have a "Pay Bill" button like supplier bill? - odoo-8

What I'm trying to do :
I'm trying to reproduce the button "Pay Bill" of the "Supplier Bill"'s form in the "Purchase receipt"'s form.
For that, I inherit account.voucher to add a function voucher_pay_customer, which is inspired from invoice_pay_customer. I also replicated the view account.voucher.receipt.dialog.form.
Why ?
Because the accountant currently has to create a supplier payment from an other form, in which he search for the previously create Receipt in order to register the payment
The Problem :
I can't make the writeoff_amount change in the dialog form, while trying to have as little differences between my onchanges and thoses of the invoice, since I don't want to alter some behavior I'm not aware about.
Since I'm new to the accounting module of Odoo, I'm struggling to understand the way it is developped. Hence my question : Why purchase receipt's form doesn't already have a "Pay Bill" button like supplier bill's form ? I hope that understanding the limits that were encountered during the development, or maybe simply the reason of this choice, if it is one, will help me to better understand the root of my problem, and correct it.

Related

Some kind of Dashboard in FullCalendar

yeah what more to describe
I have no clue how to do that. Setup fullcalendar, fetsch data and enter data works fine.
The last thing I needit is a Dashboard under the Calendar witch get the selected week that visible in the Calendar (would be great when act also with the prev and next Arrow Buttons form the Calendar), and get the summary Events from selected Week witch holds already the durration of the single Events.
Do you know what a mean? and shy asking would you be ma hero?
Maby i found the Solution
main.js
weekNumberClassNames: function(view, element){ $('#card-title').html(calWeek); }
Let the magic happen by every view change, it also the WeekNumber change
A big part is solved.

Require PayPal DropDown Answer

Is there a way to REQUIRE a PayPal dropdown to be answered? Currently, my choices are 1. Select One, 2. Satchel Brown, and 3. Midnight Black. If I skip it, it accepts "Select One" as the option. What to do? Leave the first option blank? I don't want to use a default answer.
Are you using a custom button (code generated using a form) or a paypal supported button that you generated the code for in paypal?
If you are using a paypal custom created button, create a confirmation page and have it post the users choice to there. Then, using php, check to see that the users choice is one of the valid options. If it is not, then simply use the header('Location: http://www.MyWebsiteHere.com/Wherever.php?&error=Unselected') to send them back to the page and add a error message so if(isset($_GET['error'])), then echo $correspondingErrorMessage. Very simple thing if you do it like this.

Changing magento order status and button action on admin

I want to change to button actions in the Magento admin orders section, and after looking at a lot of posts on here I can not find an answer that fulfills my question:
Question:
I want to be able to click the print invoice button on the order and have it automatically change to shipped status and when I add shipping to the order with a tracking number and click submit I would like that status to change to shipped.. and I was wondering how this could be done?
In summary:
status changed to shipped - when invoice is printed
status changed to complete - when order is shipped
I assume I would start in editing this section: app/code/core/Mage/Adminhtml/Block/Sales/Order/View.php
To change the status of an order the instruction is :
$order->setState('your state', true);
Ex. :
$order->setState('complete', true);
To have what you want you should edit the controller called when printing the invoice or creating the shipment. It's :
/app/code/core/Mage/Adminhtml/Controller/Sales/Invoice.php in the printAction() method just after the line :
$pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf(array($invoice));
For the printing of invoice and
/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php in the saveAction() method just after the line :
$shipment->register();
But editing Controller is the most simple but the worst solution. If you know well Magento and php you could do this through Model or through events.
Best Regards,

In Magento, what is an observer exactly? What does it do?

I'm an extremely novice programmer who finds himself tasked with learning how to program for Magento. So please forgive me for such a rudimentary question but there don't seem to be a ton of beginning level content on Google regarding Mage.
Can someone explain to me what exactly an observer is? What does it do? What can it be used for?
If someone can give me a super 101 explanation (not assuming much prior knowledge) you'll be my new hero. Thanks.
You can consider Event observer as a trigger.
Once you have set an event observer, for example you can set observer before or after an event, i.e., You can add a event which would execute right after user adds a product to cart or before the add product to cart.
In this event observer, you can write code to customize the data which is either passed to the occuring event (before) or is the output of occured event (after)
Reference : http://www.magentocommerce.com/wiki/5_-_modules_and_development/0_-_module_development_in_magento/customizing_magento_using_event-observer_method
Event :
In Magento you may consider a Controller Action as an event, for example addAction in CartController is an event.
Observer :
As mentioned in name, the observer observes when this action occurs (in our case addAction in CartController) and calls a function either before or after this addAction is called.
You may add your custom code in this obeserver for customization.
An Observer is the piece of code you'll need to write if you implement an Event.
Your question is : what is an event ?
See an event as a "broadcast action" that you can intercept in order to add your specific code to a specific action.
There are events fired all over magento key functionnalities.. For example, you can intercept:
- after or before saving a product
- product added to the cart
- etc
It's just an open-door leaved by magento core developers for you to plug-in..
In magento you have several ways to modify the behavior of the standard fucntionnality :
- you can rewrite classes ( tags in config.xml)
- and you can use the events when an event is available for the functionnality you want to modify
To understand, dive in the code and search "dispatchEvent" in app/code/core ...

Ajax - disabling input until response received

should input buttons that submit ajax requests be disabled after a request is made untl the response is received.
Im thinking specifically adding products to a shopping basket using a button.
Im trying to make the process as bullit proof as possible but a quite new to using ajax so dont know the best practices on these situations.
Yes, I think that is a great practice. But, it would also help to give the user a "processing" (or some other phrase) notice while you've disabled the button.
Disabling input is a very useful UI element to prevent the user from doing something bad, but I would caution against relying on it too much.
You should probably also do some server side checking to make sure you aren't receiving a duplicate request. This will shield you from browser bugs/non js-browsers etc.
If you want to make it as bullet proof as possible, then you need to show an animation right before you kick off the AJAX request, and handle both success and failure of that request.
As far as preventing an additional request, that depends on your specific action. In your case, updating a cart, it could go both ways. If I "click to add item to cart" once, but there are other items on the page that I could also add to my cart, let me click on the other "Add to Cart" button...right?

Resources