Challenge with multiple B2BUnit - sap

We have come across a situation while working on a implementation, below is the sequence of requirement
Some of the users (B2BCustomer), have access to more than one SoldTo (B2BUnit) in the system
Before starting of the commerce journey, user has to choose a SoldTo
Selected SoldTo then marked as ‘DefaultB2BUnit’
Rest of the commerce journey (PLP, Cart, Checkout and Order) is based on selected SoldTo
The challenge here is due to ‘branch’ restriction, user has access to only SoldTo set as ‘DefaultB2BUnit’ and none of the OOTB service let us get the list of all B2BUnit assigned and change the user’s selected one as default.
Is there any service available through which we can retrieve all SoldTo’s (B2BUnit) assigned to the user and set one as default after login

You need to create B2Bunit and assigned it to the B2BCustomer group then all you can read all the groups.

Please try following method:
/**
* Assigns a default unit for a customer who may be a member of multiple units. and modifies a branch for this
* customers session based on the unit
*
* #param customer
* The current customer
* #param unit
* A {#link B2BUnitModel} to be assigned as the default for a customer
*/
void setCurrentUnit(B2BCustomerModel customer, B2BUnitModel unit);

As per your requirement, you need to remove the branch restriction.
branch restriction allows customers to access data of their b2b unit and its descendants within one organization hierarchy.
If you don't have a hierarchical structure of b2b units then the branch restriction shouldn't be relevant and can be disabled.
Once you will disable the restriction, then I think your requirement can be implemented easily.

Related

Retrieve customer related to payment

Anyone know if it's possible to retrieve the customer name related to a transaction from the API?
I see it under "Paid by" if I follow the "payment_url" in the connect v1 https://connect.squareup.com/v1/{{location_id}}/payments/{{payment_id}} endpoint but can't see to find it anywhere else
Background: I'm working on a ticketing system that breaks out items by item_category so a kitchen gets only food items and the bar gets only drink items.
I have queues and itemized tickets by category BUT I can't seem to find the customer's name anywhere
You'll need to utilize the V2 Transactions API. When you call ListTransactions or RetrieveTransaction (ListTransactions), the Transaction object will have an array of Tenders, tenders, which has a field called customer_id. With this id, you will be able to pass it to RetrieveCustomer (RetrieveCustomer) to find out their name. Note that if you're not explicitly filling out their name, the name might not be available (an "instant profile" (Instant Profiles) will be created with whatever information can be retrieve from the card used to pay).
Update: Alternatively, as suggested by #Dan, would be to strip the payment_url from a V1 RetrievePayment (RetrievePayment) which includes the transaction_id at the end of the URL: https://squareup.com/dashboard/sales/transactions/TRANSACTION_ID. This is more efficient as you won't need to loop through transactions, and allow you to send it straight to RetrieveTransaction.

Is it possible to retrive the 'account' associated with a xero bank transaction

I'm using Xero's private API to export bank transactions (so I can automate a bunch of financial reporting).
Retrieving the transactions works well (as documented here https://developer.xero.com/documentation/api/banktransactions) but this endpoint doesn't return the account field associated with each transaction, which I want to use to group the transactions into e.g. "Cost of sale", "Operating expenses" and so on.
Does anyone know of a way to find the account for a given transaction via the API?
Further info:
If the transaction contains line items, then the account associated with each line item is returned by the endpoint above. I'm mostly interested in transactions that do not include line items (the LineItems field is an empty array)
Most of the transactions i'm working with are of the "Spend Money" type
I'm currently using pyxero SDK, but open to other options
The account field is present in Xero's web interface, and on the CSV export available from the web interface.
Our contacts in Xero don't have default accounts.
It is the LineItems of Bank Transactions that have AccountCodes associated with them and I've not been able to find a bank transaction record without a line item in the data I have available to me.
Is it possible that you are not implementing paging? From the bank transactions documentation you linked to above:
Paging BankTransactions (recommended)
To utilise paging, append a page parameter to the URL e.g. ?page=1. If there are 100 records in the response you will need to check if there is any more data by fetching the next page e.g ?page=2 and continuing this process until no more results are returned.
By using paging all the line item details for each bank transaction are returned which may avoid the need to retrieve each individual bank transaction.
I'm not familiar with the pyXero implementation, but it looks like they support Xero paging. From the pyXero readme:
# Grab 100 invoices created after 01-01-2013
xero.invoices.filter(since=datetime(2013, 1, 1), page=1)

How to set customer specific pricelists which is common in B2B

How to set customer specific pricelists which is common in B2B.
Pricelists per customer or organisation.
If this not exist out of the box, should i tag pricelists witch dynamic properties or add a custom condition, what is tag (TagsContainsCondition).
It dosnt seems to be possible to add own conditions for pricelist assignments!?
I guess this is the best method to override if you dont want to send to many pricelists to the client:
PricingServiceImpl.EvaluatePriceLists
This is already possible out of the box. Simply go to price list assignments and then add a new condition: "Tags contains". In the frontend, you'll need to populate the tags passed to the pricing engine with whatever values you'd like, for instance it can be customerid, or organization name.
You can also extend and add your own conditions as described here: http://docs.virtocommerce.com/display/vc2devguide/Composing+dynamic+conditions.

Access controls list "Editing Odoo security rules"

I'm trying to modify the access control list of Leave Requests to approve under Leave managements module.
I need to make the Leave Requests to approve menu only accessed by each employee's manager.
ea. if the company has 10 employees under Sales/marketing and 5 employees under IT department. I need the sales manager access his 10 employees' leave requests only and not able to access the rest of company's employees who are not under his authority.
To do it, I modified the record rule domain definition of Leaves officer from [(1,'=',1)] to [('employee_id.parent_id,'=',user.id)]
but it didn't work. How to fix it?
In Your case basically your are totally pass the wrong domain for the record rules.
You are previously using the domain like
[(1,'=',1)] = > Access the all the model record for that model
[('employee_id.parent_id,'=',user.id)] = > Access the Manager parent_id as current user employee only
But in your are accessing only with the manager user only not to access its related user.
so you must have to add the below domain in your record rules:
['|',('employee_id.user_id','=',user.id),('employee_id.parent_id.user_id','=',user.id)]
Basically the manager its self as employee of the company and employee having to attached with its related user.
first Need to understand the following relation :
1. employee_id :
which is indicate the each leave related with one employee.
2. parent_id :
which is indicate the each employee related with one manager for hr.holidays model w[('employee_id.parent_id,'=',user.id)]particular model.hich is called the leave request
3. user_id :
If you want to access the login to the particular employee then and then you must have to set the related user for each employee form.which is labeled as Related User.
4. user :
Which is indicate the global user name means current user which you are currently logged in.
5.id :
means unique id for each record
In your case how the domain will work ?
first it will check the current logged in user as attached current leave employee related user or not.
and then then find the user ids which are having with the same employee attached with the same managers.
It means it will perform the OR operation of SQL Statement for both of the domain.
I hope my answer may helpful for you :)

Where can I find the SAP configuration properties?

I need to know which status should I choose to release a PM order, to create a quotation after . Is there a place where I can find something like this :
For the order type ZCS9 the right release status is OKDE
For the order type ZCS3 the right release status is VALD
Regards
Statuses of PM orders consist of System statuses and User statuses. System statuses cannot be changed by user and are used by system for determining available business transaction for certain object type. Usual system status assigned before release is REL.
The functional scope of the user status depends on your settings in Customizing. General process for customizing user statuses for release strategy is following:
Go to SPRO -> Plant Maintenance and Customer Service ->Maintenance and Service Processing -> Maintenance and Service Orders -> General Data -> User status for Orders -> Define status profiles and select option Assign User Status to Order Types
There you can discover which status profile is assigned to target order type
Then go to Define User Status Profile for Orders and select status profile discovered on previous step.
On profile page you can observe and adjust all statuses which were set up for this order type.
I don't have a SAP System to check the exact path, but look in SPRO->Plant Maitenance and Customer Service -> Maitenance and Services Processing -> Functions and setting for order.
There must be an option in this sumbenu.