$self->_pre_render();
$self->{cv}->assign_attributes(hourly_rate => $::instance_conf->get_customer_hourly_rate) if $self->{cv}->is_customer;
+
$self->render(
'customer_vendor/form',
title => ($self->is_vendor() ? $::locale->text('Add Vendor') : $::locale->text('Add Customer')),
$::request->{layout}->add_javascripts('autocomplete_customer.js');
$::request->{layout}->add_javascripts('kivi.CustomerVendor.js');
$::request->{layout}->add_javascripts('kivi.File.js');
+
+ for my $bar ($::request->layout->get('actionbar')) {
+ $bar->add_actions("combobox");
+ $bar->actions->[-1]->add_actions([ t8('Save'),
+ submit => [ '#form', { action_save => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]);
+ $bar->actions->[-1]->add_actions([ t8('Save and Close'),
+ submit => [ '#form', { action_save_and_close => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]);
+ $bar->add_actions('combobox');
+ $bar->actions->[-1]->add_actions([ t8('Workflow'),
+ disabled => 1,
+ ]);
+ $bar->actions->[-1]->add_actions([ t8('Save and AP Transaction'),
+ submit => [ '#form', { action_save_and_ap_transaction => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]) if $self->is_vendor;
+ $bar->actions->[-1]->add_actions([ t8('Save and AR Transaction'),
+ submit => [ '#form', { action_save_and_ar_transaction => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]) if !$self->is_vendor;
+ $bar->actions->[-1]->add_actions([ t8('Save and Invoice'),
+ submit => [ '#form', { action_save_and_invoice => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]);
+ $bar->actions->[-1]->add_actions([ t8('Save and Order'),
+ submit => [ '#form', { action_save_and_order => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]);
+ $bar->actions->[-1]->add_actions([ t8('Save and RFQ'),
+ submit => [ '#form', { action_save_and_rfq => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]) if $self->is_vendor;
+ $bar->actions->[-1]->add_actions([ t8('Save and Quotation'),
+ submit => [ '#form', { action_save_and_quotation => 1 } ],
+ checks => [ 'check_taxzone_and_ustid' ],
+ ]) if !$self->is_vendor;
+ $bar->add_actions([ t8('Delete'),
+ submit => [ '#form', { action_delete => 1 } ],
+ confirm => t8('Do you really want to delete this object?'),
+ disabled => !$self->{cv}->id || !$self->is_orphaned,
+ ]);
+ $bar->add_actions('separator');
+ $bar->add_actions([ t8('History'),
+ call => [ 'kivi.CustomerVendor.showHistoryWindow', $self->{cv}->id ],
+ disabled => !$self->{cv}->id,
+ ]);
+ }
}
sub _prepare_cvar_configs_for_ajaj {
<br>
[% L.hidden_tag('action', 'CustomerVendor/dispatch') %]
-
- [% L.submit_tag('action_save', LxERP.t8('Save'), onclick = "return check_taxzone_and_ustid()", accesskey = "s") %]
- [% L.submit_tag('action_save_and_close', LxERP.t8('Save and Close'), onclick = "return check_taxzone_and_ustid()") %]
-
- [%- IF ( SELF.is_vendor ) %]
- [% L.submit_tag('action_save_and_ap_transaction', LxERP.t8('Save and AP Transaction'), onclick = "return check_taxzone_and_ustid()") %]
- [%- ELSE %]
- [% L.submit_tag('action_save_and_ar_transaction', LxERP.t8('Save and AR Transaction'), onclick = "return check_taxzone_and_ustid()") %]
- [%- END %]
-
- [% L.submit_tag('action_save_and_invoice', LxERP.t8('Save and Invoice'), onclick = "return check_taxzone_and_ustid()") %]
- [% L.submit_tag('action_save_and_order', LxERP.t8('Save and Order'), onclick = "return check_taxzone_and_ustid()") %]
-
- [%- IF ( SELF.is_vendor ) %]
- [% L.submit_tag('action_save_and_rfq', LxERP.t8('Save and RFQ'), onclick = "return check_taxzone_and_ustid()") %]
- [%- ELSE %]
- [% L.submit_tag('action_save_and_quotation', LxERP.t8('Save and Quotation'), onclick = "return check_taxzone_and_ustid()") %]
- [%- END %]
-
- [%- IF ( SELF.cv.id && SELF.is_orphaned ) %]
- [% L.submit_tag('action_delete', LxERP.t8('Delete'), confirm => LxERP.t8('Do you really want to delete this object?')) %]
- [%- END %]
-
- [%- IF ( SELF.cv.id ) %]
- <input type="button" class="submit" onclick="kivi.CustomerVendor.showHistoryWindow([% SELF.cv.id %]);" name="history" id="history" value="[% 'history' | $T8 %]">
- [%- END %]
-
</form>
<script type="text/javascript">