Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] point_of_sale: extension point xml rendering #26363

Conversation

blaggacao
Copy link
Contributor

Before, extending the xml rendering environment was a matter of overriding the
whole method.

This commit enables a clean extenstion point to alter the rendering dict in
the mean time till a thourough refactoring in the near future according to the
new js guidlines.

Description of the issue/feature this PR addresses:

  • Missing (clean) extension point made alterations to the xml rendering context a real pain

Current behavior before PR:

  • Unclean extension forces to rewrite the whole method.
  • Maintainability of downstream code is suboptimal.

Desired behavior after PR is merged:

  • Clean extension is possible
  • (As if the this js code was already refactored according to the new style)

Note: Please do not close, even if not immediately accepted (wishlist tag). This PR is meant to be carried along and actively maintained, until this semantic will be completed this way or another.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@xoe-labs

@blaggacao
Copy link
Contributor Author

Note: Unfortunately, the diff is uglier than it needs to be...

@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch 6 times, most recently from 462627f to 3822a73 Compare August 21, 2018 17:25
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 3822a73 to dcb73a5 Compare September 18, 2018 21:21
@robodoo robodoo added seen 🙂 CI 🤖 Robodoo has seen passing statuses labels Sep 18, 2018
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from dcb73a5 to 11118c2 Compare October 22, 2018 19:11
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Oct 22, 2018
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 11118c2 to c332e52 Compare November 26, 2018 00:33
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Nov 26, 2018
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from c332e52 to fa43ec6 Compare December 3, 2018 15:16
@blaggacao
Copy link
Contributor Author

blaggacao commented Dec 20, 2018

@switch87 Could you have a kind look at this? The problem it solves is to be able to manipulate the receipt environment before passing it to the header and footer rendering, so that header and footer can make use of an custom extended environment.

This enables client-by-client customization in an extended (legal) receipt environment.

EDIT: This equivalent gist looks nicer than the PR diff, see this line for what it does in reality.

@switch87 switch87 self-assigned this Dec 20, 2018
@switch87
Copy link
Contributor

Will do! 👍

@blaggacao
Copy link
Contributor Author

blaggacao commented Dec 20, 2018

FYI, what I actually do:

    _export_for_printing: function(){
      var _super = order_model_super._export_for_printing.apply(this, arguments);
      var company = this.pos.company;
      var client  = this.get('client');
      _super.company = _.extend(_super.company, {
        legalname: company.l10n_co_oficial_name,
        fiscal_regime: company.l10n_co_regimen_char,
        vat: company.vat_formatted,
        economic_activity: company.l10n_co_economic_activity_id,
      });
      if (!!client) {
          _super.client = {
            name: client.name,
            legalname: client.l10n_co_oficial_name,
            vat: client.vat_formatted,
            vat_label: company.country && company.country.vat_label || '',
          };
      }
      return _super;
    }

@switch87
Copy link
Contributor

It will have to wait until next year.

@blaggacao
Copy link
Contributor Author

Happy new year! I've no hurry, I'm maintaining a patched Odoo for the many reasons I sporadically try to push one or the other PR. If it will be included in master, I'm more than happy on the long run...

@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Dec 22, 2018
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 81e5668 to fa43ec6 Compare December 22, 2018 21:46
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from fa43ec6 to ae9abd6 Compare March 13, 2019 23:44
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Mar 14, 2019
@Deiber Deiber force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from ae9abd6 to 27a56d0 Compare March 29, 2019 01:34
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Mar 29, 2019
@Deiber Deiber force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 0affe7c to 83ce43b Compare April 16, 2019 01:13
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 16, 2019
@Deiber Deiber force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 83ce43b to 5bf2ed7 Compare April 27, 2019 00:34
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels Apr 27, 2019
@blaggacao
Copy link
Contributor Author

@switch87 Could you give this a go once again? It would be nice, could this be merged...

@Deiber Deiber force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 5bf2ed7 to 719d29e Compare May 4, 2019 00:31
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels May 4, 2019
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from 719d29e to cc77a80 Compare May 4, 2019 02:07
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels May 4, 2019
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from cc77a80 to eb23231 Compare May 6, 2019 15:47
@robodoo robodoo added CI 🤖 Robodoo has seen passing statuses and removed CI 🤖 Robodoo has seen passing statuses labels May 6, 2019
@blaggacao
Copy link
Contributor Author

@switch87 Shall we? 😉

@switch87
Copy link
Contributor

@pimodoo I think this would be an improvement. What do you think?

@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from eb23231 to ae00f7b Compare November 13, 2019 03:07
@robodoo robodoo removed the CI 🤖 Robodoo has seen passing statuses label Nov 13, 2019
Before, extending the xml rendering environment was a matter of overriding the
whole method.

This commit enables a clean extenstion point to alter the rendering dict in
the mean time till a thourough refactoring in the near future according to the
new js guidlines.
@blaggacao blaggacao force-pushed the master-pos-receipt-render-whole-preprocessed-xml branch from ae00f7b to 9278cfa Compare November 25, 2019 21:17
@robodoo robodoo added the CI 🤖 Robodoo has seen passing statuses label Nov 25, 2019
@pedrobaeza
Copy link
Collaborator

Is this still relevant?

@pimodoo pimodoo closed this Jan 22, 2020
@robodoo robodoo added closed 💔 and removed CI 🤖 Robodoo has seen passing statuses labels Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants